summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-09-28 00:31:20 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-10-02 14:17:31 (GMT)
commit197a6bf1714267ad536f27fef5a24cbe6fd3fcff (patch)
treed1f7b455e2d23dac4330999f423f169986bd8418 /Tests
parent5eb7bd641a909925c6341819bc7900300776924f (diff)
downloadCMake-197a6bf1714267ad536f27fef5a24cbe6fd3fcff.zip
CMake-197a6bf1714267ad536f27fef5a24cbe6fd3fcff.tar.gz
CMake-197a6bf1714267ad536f27fef5a24cbe6fd3fcff.tar.bz2
cxxmodules: rework control logic for scanning regular C++ sources
Now that scanning support is no longer experimental, the logic for whether or not to scan C++ 20 sources is now important because all projects are now exposted to the logic. Make the scanning rules explicit in the documentation and rework the queries to localize all of the associated logic. A policy to handle the ultimate fallback logic will be implemented in a following commit.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX-stderr.txt13
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX20-stderr.txt14
-rw-r--r--Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/NoScanningSourceFileProperty-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NoScanningSourceFileProperty-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/NoScanningSourceFileProperty.cmake13
-rw-r--r--Tests/RunCMake/CXXModules/NoScanningTargetProperty-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NoScanningTargetProperty-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/NoScanningTargetProperty.cmake10
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake3
10 files changed, 58 insertions, 23 deletions
diff --git a/Tests/RunCMake/CXXModules/NoCXX-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX-stderr.txt
index 5b609a9..da65c26 100644
--- a/Tests/RunCMake/CXXModules/NoCXX-stderr.txt
+++ b/Tests/RunCMake/CXXModules/NoCXX-stderr.txt
@@ -1,13 +1,8 @@
-CMake Error in CMakeLists.txt:
- The target named "nocxx" has C\+\+ sources that export modules but the "CXX"
+(CMake Error in CMakeLists.txt:
+( The target named "nocxx" has C\+\+ sources that use modules but the "CXX"
language has not been enabled
-
-(
-CMake Error in CMakeLists.txt:
-( The target named "nocxx" has C\+\+ sources that export modules but the "CXX"
- language has not been enabled
-| The target named "nocxx" contains C\+\+ sources that export modules which is
- not supported by the generator
+| The target named "nocxx" contains C\+\+ sources that use modules which is not
+ supported by the generator
| Target "nocxx" has source file
.*/Tests/RunCMake/CXXModules/sources/module.cxx
diff --git a/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt
index 4a1641b8..5a9b6e7 100644
--- a/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt
+++ b/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt
@@ -1,15 +1,9 @@
-CMake Error in CMakeLists.txt:
- The target named "nocxx20" has C\+\+ sources that export modules but does not
+(CMake Error in CMakeLists.txt:
+( The target named "nocxx20" has C\+\+ sources that use modules but does not
include "cxx_std_20" \(or newer\) among its `target_compile_features`; found
"cxx_std_17"
-
-(
-CMake Error in CMakeLists.txt:
-( The target named "nocxx20" has C\+\+ sources that export modules but does not
- include "cxx_std_20" \(or newer\) among its `target_compile_features`; found
- "cxx_std_17"
-| The target named "nocxx20" contains C\+\+ sources that export modules which
- is not supported by the generator
+| The target named "nocxx20" contains C\+\+ sources that use modules which is
+ not supported by the generator
)
)*
CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt b/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt
index 6640c99..6a9c995 100644
--- a/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt
+++ b/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt
@@ -6,13 +6,13 @@
due to lack of required features. Ninja 1.11 or higher is required.
|CMake Error in CMakeLists.txt:
- The target named "nodyndep" contains C\+\+ sources that export modules which
- is not supported by the generator
+ The target named "nodyndep" contains C\+\+ sources that use modules which is
+ not supported by the generator
(
CMake Error in CMakeLists.txt:
- The target named "nodyndep" contains C\+\+ sources that export modules which
- is not supported by the generator
+ The target named "nodyndep" contains C\+\+ sources that use modules which is
+ not supported by the generator
)*)
CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty-result.txt b/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty-stderr.txt b/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty-stderr.txt
new file mode 100644
index 0000000..464627c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty-stderr.txt
@@ -0,0 +1,9 @@
+(CMake Error in CMakeLists.txt:
+( The target named "noscanning-sf-property" has C\+\+ sources that use modules
+ but the compiler does not provide a way to discover the import graph
+ dependencies
+| The target named "noscanning-sf-property" contains C\+\+ sources that use modules which
+ is not supported by the generator
+)
+)*
+CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty.cmake b/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty.cmake
new file mode 100644
index 0000000..f356a11
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoScanningSourceFileProperty.cmake
@@ -0,0 +1,13 @@
+enable_language(CXX)
+unset(CMAKE_CXX_SCANDEP_SOURCE)
+
+add_executable(noscanning-sf-property
+ sources/module-use.cxx)
+set_target_properties(noscanning-sf-property
+ PROPERTIES
+ CXX_STANDARD 20
+ CXX_STANDARD_REQUIRED ON
+ CXX_SCAN_FOR_MODULES 0)
+set_source_files_properties(sources/module-use.cxx
+ PROPERTIES
+ CXX_SCAN_FOR_MODULES 1)
diff --git a/Tests/RunCMake/CXXModules/NoScanningTargetProperty-result.txt b/Tests/RunCMake/CXXModules/NoScanningTargetProperty-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoScanningTargetProperty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NoScanningTargetProperty-stderr.txt b/Tests/RunCMake/CXXModules/NoScanningTargetProperty-stderr.txt
new file mode 100644
index 0000000..72c7a0a
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoScanningTargetProperty-stderr.txt
@@ -0,0 +1,9 @@
+(CMake Error in CMakeLists.txt:
+( The target named "noscanning-target-property" has C\+\+ sources that use
+ modules but the compiler does not provide a way to discover the import
+ graph dependencies
+| The target named "noscanning-target-property" contains C\+\+ sources that use modules which
+ is not supported by the generator
+)
+)*
+CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NoScanningTargetProperty.cmake b/Tests/RunCMake/CXXModules/NoScanningTargetProperty.cmake
new file mode 100644
index 0000000..97a3d44
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoScanningTargetProperty.cmake
@@ -0,0 +1,10 @@
+enable_language(CXX)
+unset(CMAKE_CXX_SCANDEP_SOURCE)
+
+add_executable(noscanning-target-property
+ sources/module-use.cxx)
+set_target_properties(noscanning-target-property
+ PROPERTIES
+ CXX_STANDARD 20
+ CXX_STANDARD_REQUIRED ON
+ CXX_SCAN_FOR_MODULES 1)
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index 2f32312..a697659 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -14,6 +14,9 @@ if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
if (NOT forced_cxx_standard)
run_cmake(NoCXX20)
endif ()
+
+ run_cmake(NoScanningSourceFileProperty)
+ run_cmake(NoScanningTargetProperty)
endif ()
if (RunCMake_GENERATOR MATCHES "Ninja")