diff --git a/create_gz_vendor_pkg/create_vendor_package.py b/create_gz_vendor_pkg/create_vendor_package.py index 1b27a81..5a66359 100644 --- a/create_gz_vendor_pkg/create_vendor_package.py +++ b/create_gz_vendor_pkg/create_vendor_package.py @@ -391,7 +391,7 @@ def main(argv=sys.argv[1:]): parser.add_argument( "--overwrite_cmake_configs", action="store_true", - default=False, + default=True, help="If true, overwrites cmake config (.in) files", ) args = parser.parse_args(argv) diff --git a/create_gz_vendor_pkg/templates/config.cmake.in b/create_gz_vendor_pkg/templates/config.cmake.in index 56d06dd..5971c60 100644 --- a/create_gz_vendor_pkg/templates/config.cmake.in +++ b/create_gz_vendor_pkg/templates/config.cmake.in @@ -2,23 +2,25 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) find_package(@LIB_NAME@@LIB_VER_MAJOR@ ${@LIB_NAME@_FIND_VERSION} REQUIRED COMPONENTS ${@LIB_NAME@_FIND_COMPONENTS}) -# Set up the core library and add it to the list of all components -add_library(@LIB_NAME_COMP_PREFIX@::@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) -add_library(@LIB_NAME_COMP_PREFIX@::core ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) +if (NOT "@LIB_NAME@" STREQUAL "gz-cmake") + # Set up the core library and add it to the list of all components + add_library(@LIB_NAME_COMP_PREFIX@::@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) + add_library(@LIB_NAME_COMP_PREFIX@::core ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) -# Retrieve the list of components -get_target_property(components @LIB_NAME@@LIB_VER_MAJOR@::requested INTERFACE_LINK_LIBRARIES) + # Retrieve the list of components + get_target_property(components @LIB_NAME@@LIB_VER_MAJOR@::requested INTERFACE_LINK_LIBRARIES) -foreach(component ${components}) - # Skip the core library - if(${component} STREQUAL @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) - continue() - endif() + foreach(component ${components}) + # Skip the core library + if(${component} STREQUAL @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) + continue() + endif() - # Change "gz-libN::gz-libN-component" to "component" - string(REGEX REPLACE "@LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@-" "" component_name ${component}) - add_library(@LIB_NAME_COMP_PREFIX@::${component_name} ALIAS ${component}) -endforeach() + # Change "gz-libN::gz-libN-component" to "component" + string(REGEX REPLACE "@LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@-" "" component_name ${component}) + add_library(@LIB_NAME_COMP_PREFIX@::${component_name} ALIAS ${component}) + endforeach() -# Add a root gz-lib alias -add_library(@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) + # Add a root gz-lib alias + add_library(@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) +endif()