Files
CMake/Tests/RunCMake/CXXModules/ExportBuildCxxModulesTargets.cmake
Ben Boeckel d791f3a180 cxxmodules: make export trampoline script files unique
Include the name of the `EXPORT` in the filename when generating export
information for C++ modules. This allows the same directory to be used
for multiple sets of C++ module-using targets.

For `export(TARGETS)` uses, generate a name based on the hash of the
concatenation of the target names involved with the `export()` call.

Fixes: #25609
2024-01-18 17:40:44 -05:00

22 lines
577 B
CMake

enable_language(CXX)
set(CMAKE_CXX_SCANDEP_SOURCE "")
add_library(export-modules)
target_sources(export-modules
PUBLIC
FILE_SET fs TYPE CXX_MODULES FILES
sources/module.cxx)
target_compile_features(export-modules
PRIVATE
cxx_std_20)
set_property(TARGET export-modules
PROPERTY EXPORT_NAME export-name)
install(TARGETS export-modules
EXPORT exp
FILE_SET fs DESTINATION "include/cxx/export-modules")
export(TARGETS export-modules
FILE "${CMAKE_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake"
CXX_MODULES_DIRECTORY "cxx-modules")