Browse Source

Merge topic 'import-std-experimental-docs'

a46395df06 importstd: clarify when the experimental UUID must be available

Acked-by: Kitware Robot <[email protected]>
Merge-request: !9522
Brad King 1 year ago
parent
commit
e3d6efadc6

+ 2 - 1
Help/dev/experimental.rst

@@ -50,7 +50,8 @@ set
 
 This UUID may change in future versions of CMake.  Be sure to use the value
 documented here by the source tree of the version of CMake with which you are
-experimenting.
+experimenting.  It must be set before the ``CXX`` toolchain is discovered by
+CMake, usually as part of a :command:`project` call.
 
 When activated, this experimental feature provides the following:
 

+ 1 - 1
Modules/Compiler/CMakeCommonCompilerMacros.cmake

@@ -250,7 +250,7 @@ function(cmake_create_cxx_import_std std variable)
     _cmake_supported_import_std_experimental)
   if (NOT _cmake_supported_import_std_experimental)
     set("${variable}"
-      "set(CMAKE_CXX${std}_COMPILER_IMPORT_STD_NOT_FOUND_MESSAGE \"Experimental `import std` support not enabled when detecting toolchain\")\n"
+      "set(CMAKE_CXX${std}_COMPILER_IMPORT_STD_NOT_FOUND_MESSAGE \"Experimental `import std` support not enabled when detecting toolchain; it must be set before `CXX` is enabled (usually a `project()` call)\")\n"
       PARENT_SCOPE)
     return ()
   endif ()

+ 1 - 1
Tests/RunCMake/CXXModules/NoCXX23TargetRequired-stderr.txt

@@ -3,7 +3,7 @@ CMake Error in CMakeLists.txt:
   the "__CMAKE::CXX23" target exist, but it was not provided by the
   toolchain.  Reason:
 
-    (Toolchain does not support discovering `import std` support|Experimental `import std` support not enabled when detecting toolchain|Unsupported generator: [^\n]*)
+    (Toolchain does not support discovering `import std` support|Experimental `import std` support not enabled when detecting toolchain; it must be set before `CXX` is enabled \(usually a `project\(\)` call\)|Unsupported generator: [^\n]*)
 
 
 CMake Generate step failed.  Build files cannot be regenerated correctly.

+ 1 - 1
Tests/RunCMake/CXXModules/NoCXX26TargetRequired-stderr.txt

@@ -3,7 +3,7 @@ CMake Error in CMakeLists.txt:
   the "__CMAKE::CXX26" target exist, but it was not provided by the
   toolchain.  Reason:
 
-    (Toolchain does not support discovering `import std` support|Experimental `import std` support not enabled when detecting toolchain|Unsupported generator: [^\n]*)
+    (Toolchain does not support discovering `import std` support|Experimental `import std` support not enabled when detecting toolchain; it must be set before `CXX` is enabled \(usually a `project\(\)` call\)|Unsupported generator: [^\n]*)
 
 
 CMake Generate step failed.  Build files cannot be regenerated correctly.