diff options
author | Brad King <brad.king@kitware.com> | 2024-12-12 14:11:48 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-12-12 14:11:59 (GMT) |
commit | 2670dd4ed1de4e7ae0b2f50bfad8f5a3b686ae9b (patch) | |
tree | bb6ca2d99ac95c8acfbf8225e8eb05e9279953c3 /Tests | |
parent | 6622ae651f1e5df996acc9729f49177131f9fd94 (diff) | |
parent | 854eba0c53505190adb8fdd32cbdaed318d8dfda (diff) | |
download | CMake-2670dd4ed1de4e7ae0b2f50bfad8f5a3b686ae9b.zip CMake-2670dd4ed1de4e7ae0b2f50bfad8f5a3b686ae9b.tar.gz CMake-2670dd4ed1de4e7ae0b2f50bfad8f5a3b686ae9b.tar.bz2 |
Merge topic 'iface-public-modules' into release-3.31
854eba0c53 target_sources: Improve error message for CXX_MODULES on INTERFACE libraries
cd179e7560 Tests/RunCMake/CXXModules: Rename FileSetModules cases to be more specific
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10090
Diffstat (limited to 'Tests')
15 files changed, 56 insertions, 2 deletions
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterface-result.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnInterface-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CXXModules/FileSetModulesInterface-result.txt +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnInterface-result.txt diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnInterface-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnInterface-stderr.txt new file mode 100644 index 0000000..d14a221 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnInterface-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at FileSetModulesInterfaceOnInterface.cmake:[0-9]+ \(target_sources\): + target_sources File set TYPE "CXX_MODULES" may not have "INTERFACE" + visibility +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnInterface.cmake b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnInterface.cmake new file mode 100644 index 0000000..c2c4d63 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnInterface.cmake @@ -0,0 +1,8 @@ +add_library(module INTERFACE) +target_sources(module + INTERFACE + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(module + INTERFACE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnStatic-result.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnStatic-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnStatic-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterface-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnStatic-stderr.txt index 7269c65..7d099de 100644 --- a/Tests/RunCMake/CXXModules/FileSetModulesInterface-stderr.txt +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnStatic-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at FileSetModulesInterface.cmake:[0-9]+ \(target_sources\): +CMake Error at FileSetModulesInterfaceOnStatic.cmake:[0-9]+ \(target_sources\): target_sources File set TYPE "CXX_MODULES" may not have "INTERFACE" visibility Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterface.cmake b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnStatic.cmake index 24cec3e..24cec3e 100644 --- a/Tests/RunCMake/CXXModules/FileSetModulesInterface.cmake +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceOnStatic.cmake diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface-result.txt b/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface-stderr.txt new file mode 100644 index 0000000..f949df9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetModulesPrivateOnInterface\.cmake:[0-9]+ \(target_sources\): + target_sources File set TYPE "CXX_MODULES" may not have "PUBLIC" or + "PRIVATE" visibility on INTERFACE libraries\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface.cmake b/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface.cmake new file mode 100644 index 0000000..9ee4024 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnInterface.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) +set(CMAKE_CXX_SCANDEP_SOURCE "") + +add_library(module INTERFACE) +target_sources(module + PRIVATE + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(module + INTERFACE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPrivate.cmake b/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnStatic.cmake index 83bbd4d..83bbd4d 100644 --- a/Tests/RunCMake/CXXModules/FileSetModulesPrivate.cmake +++ b/Tests/RunCMake/CXXModules/FileSetModulesPrivateOnStatic.cmake diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface-result.txt b/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface-stderr.txt new file mode 100644 index 0000000..7d732eb --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetModulesPublicOnInterface\.cmake:[0-9]+ \(target_sources\): + target_sources File set TYPE "CXX_MODULES" may not have "PUBLIC" or + "PRIVATE" visibility on INTERFACE libraries\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface.cmake b/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface.cmake new file mode 100644 index 0000000..0bc4123 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesPublicOnInterface.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) +set(CMAKE_CXX_SCANDEP_SOURCE "") + +add_library(module INTERFACE) +target_sources(module + PUBLIC + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(module + INTERFACE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPublic.cmake b/Tests/RunCMake/CXXModules/FileSetModulesPublicOnStatic.cmake index 52ba35f..52ba35f 100644 --- a/Tests/RunCMake/CXXModules/FileSetModulesPublic.cmake +++ b/Tests/RunCMake/CXXModules/FileSetModulesPublicOnStatic.cmake diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index 4ed79ef..ceb990a 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -71,9 +71,15 @@ set(scopes Interface Private Public) +set(target_types + Interface + Static + ) foreach (fileset_type IN LISTS fileset_types) foreach (scope IN LISTS scopes) - run_cmake("FileSet${fileset_type}${scope}") + foreach (target_type IN LISTS target_types) + run_cmake("FileSet${fileset_type}${scope}On${target_type}") + endforeach () endforeach () run_cmake("FileSet${fileset_type}InterfaceImported") |