-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
This issue addresses the lines of code that create an alias target for a specific namespace:
PackageProject.cmake/CMakeLists.txt
Lines 33 to 42 in 2d8a468
# we want to automatically add :: to our namespace, so only append if a namespace was given in the | |
# first place we also provide an alias to ensure that local and installed versions have the same | |
# name | |
if(DEFINED PROJECT_NAMESPACE) | |
if(PROJECT_CPACK) | |
set(CPACK_PACKAGE_NAMESPACE ${PROJECT_NAMESPACE}) | |
endif() | |
set(PROJECT_NAMESPACE ${PROJECT_NAMESPACE}::) | |
add_library(${PROJECT_NAMESPACE}${PROJECT_NAME} ALIAS ${PROJECT_NAME}) | |
endif() |
It is suggested to create the alias target only if the alias does not already exist; otherwise, it may cause issues as highlighted in boost-ext/ut#564.
Before CMake 3.18, this may not have caused an issue because any new alias target would replace the old alias. However, the behavior has changed since then (see also).
Metadata
Metadata
Assignees
Labels
No labels