diff options
author | Brad King <brad.king@kitware.com> | 2024-01-18 22:44:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-18 22:45:07 (GMT) |
commit | 4cd153afe324afb228c9123ace15c5bffcd4fbdf (patch) | |
tree | f044cc459e65f8b59a1b35012dfe4e1ad298a204 /Tests/RunCMake | |
parent | c75047709f2ee2a3f8791f19b9ce8cc76e633521 (diff) | |
parent | d791f3a180c7231bc2b45c9204c0a912c06b91ee (diff) | |
download | CMake-4cd153afe324afb228c9123ace15c5bffcd4fbdf.zip CMake-4cd153afe324afb228c9123ace15c5bffcd4fbdf.tar.gz CMake-4cd153afe324afb228c9123ace15c5bffcd4fbdf.tar.bz2 |
Merge branch 'backport-cxxmodules-export-file-collisions'
Diffstat (limited to 'Tests/RunCMake')
5 files changed, 73 insertions, 11 deletions
diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake index cb6f6bd..94d4479 100644 --- a/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake @@ -1,19 +1,19 @@ file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake" export_script) -if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules\.cmake"\)]]) +if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules-exp\.cmake"\)]]) list(APPEND RunCMake_TEST_FAILED "Could not find C++ module property script inclusion") endif () -file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules.cmake" trampoline_script) +file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-exp.cmake" trampoline_script) if (RunCMake_GENERATOR_IS_MULTI_CONFIG) - if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-[^.]*\.cmake" OPTIONAL\)]]) + if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-exp-[^.]*\.cmake" OPTIONAL\)]]) list(APPEND RunCMake_TEST_FAILED "Could not find C++ module property per-config script inclusion(s)") endif () else () - if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-[^.]*\.cmake"\)]]) + if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-exp-[^.]*\.cmake"\)]]) list(APPEND RunCMake_TEST_FAILED "Could not find C++ module property per-config script inclusion(s)") endif () @@ -21,12 +21,12 @@ endif () set(any_exists 0) foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel) - if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-${config}.cmake") + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-exp-${config}.cmake") continue () endif () set(any_exists 1) - file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-${config}.cmake" config_script) + file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-exp-${config}.cmake" config_script) if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)") list(APPEND RunCMake_TEST_FAILED diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModulesTargets-check.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModulesTargets-check.cmake new file mode 100644 index 0000000..0402fd7 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModulesTargets-check.cmake @@ -0,0 +1,40 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake" export_script) + +if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules-7eb8e1b4d8a1\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property script inclusion") +endif () + +file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-7eb8e1b4d8a1.cmake" trampoline_script) + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-7eb8e1b4d8a1-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property per-config script inclusion(s)") + endif () +else () + if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-7eb8e1b4d8a1-[^.]*\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property per-config script inclusion(s)") + endif () +endif () + +set(any_exists 0) +foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-7eb8e1b4d8a1-${config}.cmake") + continue () + endif () + set(any_exists 1) + + file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-7eb8e1b4d8a1-${config}.cmake" config_script) + + if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)") + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module per-target property script inclusion") + endif () +endforeach () + +if (NOT any_exists) + list(APPEND RunCMake_TEST_FAILED + "No per-configuration target files exist.") +endif () diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModulesTargets.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModulesTargets.cmake new file mode 100644 index 0000000..1da6498 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModulesTargets.cmake @@ -0,0 +1,21 @@ +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") diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake index 9e83fd8..044b037 100644 --- a/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake +++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake @@ -1,25 +1,25 @@ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/exp.cmake" export_script) -if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules\.cmake"\)]]) +if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules-exp\.cmake"\)]]) list(APPEND RunCMake_TEST_FAILED "Could not find C++ module property script inclusion") endif () -file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules.cmake" trampoline_script) +file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-exp.cmake" trampoline_script) -if (NOT trampoline_script MATCHES [[file\(GLOB _cmake_cxx_module_includes "\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-\*\.cmake"\)]]) +if (NOT trampoline_script MATCHES [[file\(GLOB _cmake_cxx_module_includes "\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-exp-\*\.cmake"\)]]) list(APPEND RunCMake_TEST_FAILED "Could not find C++ module property per-config script inclusion(s)") endif () set(any_exists 0) foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel) - if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-${config}.cmake") + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-exp-${config}.cmake") continue () endif () set(any_exists 1) - file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-${config}.cmake" config_script) + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-exp-${config}.cmake" config_script) if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)") list(APPEND RunCMake_TEST_FAILED diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index b0571ed..0ac60e0 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -88,6 +88,7 @@ run_cmake(InstallBMIGenericArgs) run_cmake(InstallBMIIgnore) run_cmake(ExportBuildCxxModules) +run_cmake(ExportBuildCxxModulesTargets) run_cmake(ExportInstallCxxModules) # Generator-specific tests. |