Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion create_gz_vendor_pkg/create_vendor_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
34 changes: 18 additions & 16 deletions create_gz_vendor_pkg/templates/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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()