Skip to content

cet_make_library: EXPORT_NAME argument is overwritten by automatic naming logic #33

@greenc-FNAL

Description

@greenc-FNAL

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions