When using cet_make_library, if a user explicitly provides an EXPORT_NAME argument, it appears to be ignored/overwritten if the LIBRARY_NAME (or calculated target name) matches the pattern ${NAMESPACE}_${SUFFIX}.
In CetMakeLibrary.cmake, the logic appears to be:
cet_regex_escape("${namespace}" e_namespace)
if(CML_TARGET_NAME MATCHES "^${e_namespace}_(.*)$")
set(CML_EXPORT_NAME "${CMAKE_MATCH_1}")
else()
unset(CML_EXPORT_NAME)
endif()
This block runs after argument parsing, effectively overwriting any EXPORT_NAME passed by the user.
Example:
cet_make_library(
LIBRARY_NAME phlex_int
EXPORT_NAME module
...
)
Expected Result:
Target phlex::module is created/exported.
Actual Result:
Target phlex::int is created/exported because phlex_int matches the namespace pattern, and the explicit EXPORT_NAME module is discarded.
Workaround:
The user must rename the library to match the desired export name (e.g., phlex_module) to force the correct export name via the automatic logic. cet_make_library should respect the explicit EXPORT_NAME if provided.
When using
cet_make_library, if a user explicitly provides anEXPORT_NAMEargument, it appears to be ignored/overwritten if theLIBRARY_NAME(or calculated target name) matches the pattern${NAMESPACE}_${SUFFIX}.In
CetMakeLibrary.cmake, the logic appears to be:This block runs after argument parsing, effectively overwriting any
EXPORT_NAMEpassed by the user.Example:
Expected Result:
Target
phlex::moduleis created/exported.Actual Result:
Target
phlex::intis created/exported becausephlex_intmatches the namespace pattern, and the explicitEXPORT_NAME moduleis discarded.Workaround:
The user must rename the library to match the desired export name (e.g.,
phlex_module) to force the correct export name via the automatic logic.cet_make_libraryshould respect the explicitEXPORT_NAMEif provided.