mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
Experimental/CXXModules: Implement EcoStd Module Metadata parser
Adds a parser and serializer for the EcoStd Module Metadata format RFC: https://github.com/ecostd/rfcs/pull/3 This adapts the existing experimental support for import std; to use the new parser. The CMAKE_CXX_STDLIB_MODULES_JSON is now the canonical variable for controlling how CMake discovers the stdlib module metadata, and is used directly by compiler detection. Toolchains can still override the __CMAKE::CXX## targets if they wish, either in conjunction with CMAKE_CXX_STDLIB_MODULE_JSON or not. It is possible to disable automatic detection of CMAKE_CXX_STDLIB_MODULE_JSON by setting it to the empty string. When available, the CMAKE_CXX_STDLIB_MODULE_JSON will be used to create all requested C++ stdlibs which do not already have targets.
This commit is contained in:
@@ -37,6 +37,7 @@ set(CMAKE_CXX_COMPILE_FEATURES \"${CMAKE_CXX_COMPILE_FEATURES}\")
|
||||
set(CMAKE_MAKE_PROGRAM \"${CMAKE_MAKE_PROGRAM}\")
|
||||
set(forced_cxx_standard \"${forced_cxx_standard}\")
|
||||
set(have_cxx23_import_std \"${have_cxx23_import_std}\")
|
||||
set(have_cxx26_import_std \"${have_cxx26_import_std}\")
|
||||
set(CMAKE_CXX_COMPILER_VERSION \"${CMAKE_CXX_COMPILER_VERSION}\")
|
||||
set(CMAKE_CXX_OUTPUT_EXTENSION \"${CMAKE_CXX_OUTPUT_EXTENSION}\")
|
||||
set(CXXModules_default_build_type \"${CMAKE_BUILD_TYPE}\")
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
CMake Error in CMakeLists\.txt:
|
||||
The "CXX_MODULE_STD" property on the target "nocxx23target" requires that
|
||||
the "__CMAKE::CXX23" target exist, but it was not provided by the
|
||||
toolchain\. Reason:
|
||||
The "CXX_MODULE_STD" property on target "nocxx23target" requires toolchain
|
||||
support, but it was not provided. Reason:
|
||||
|
||||
(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]*)
|
||||
(Toolchain does not support discovering module metadata|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,9 +1,8 @@
|
||||
CMake Error in CMakeLists\.txt:
|
||||
The "CXX_MODULE_STD" property on the target "nocxx26target" requires that
|
||||
the "__CMAKE::CXX26" target exist, but it was not provided by the
|
||||
toolchain\. Reason:
|
||||
The "CXX_MODULE_STD" property on target "nocxx26target" requires toolchain
|
||||
support, but it was not provided. Reason:
|
||||
|
||||
(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]*)
|
||||
(Toolchain does not support discovering module metadata|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\.
|
||||
|
||||
@@ -2,7 +2,7 @@ CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_create_cxx_import_std\)
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
|
||||
@@ -2,7 +2,7 @@ CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_create_cxx_import_std\)
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
|
||||
@@ -2,7 +2,7 @@ CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_create_cxx_import_std\)
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
|
||||
@@ -2,7 +2,7 @@ CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_create_cxx_import_std\)
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
|
||||
@@ -2,7 +2,7 @@ CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_create_cxx_import_std\)
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
|
||||
@@ -2,7 +2,7 @@ CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_create_cxx_import_std\)
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0-9]* \(cmake_language\):
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
@@ -0,0 +1,8 @@
|
||||
CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0-9]* \(cmake_language\):
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
@@ -2,7 +2,7 @@ CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_create_cxx_import_std\)
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
|
||||
@@ -2,7 +2,7 @@ CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros\.cmake:[0
|
||||
CMake's support for `import std;` in C\+\+23 and newer is experimental\. It
|
||||
is meant only for experimentation and feedback to CMake developers\.
|
||||
Call Stack \(most recent call first\):
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_create_cxx_import_std\)
|
||||
.*/Modules/CMakeDetermineCompilerSupport\.cmake:[0-9]* \(cmake_cxx_find_modules_json\)
|
||||
.*/Modules/CMakeTestCXXCompiler\.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
|
||||
CMakeLists\.txt:[0-9]* \(project\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
|
||||
@@ -102,7 +102,6 @@ set(properties
|
||||
"C_LINKER_LAUNCHER" "ccache" "<SAME>"
|
||||
### C++
|
||||
"CXX_LINKER_LAUNCHER" "ccache" "<SAME>"
|
||||
"CXX_MODULE_STD" "ON" "<SAME>"
|
||||
### CUDA
|
||||
"CUDA_RESOLVE_DEVICE_SYMBOLS" "ON" "<SAME>"
|
||||
"CUDA_RUNTIME_LIBRARY" "Static" "<SAME>"
|
||||
@@ -229,6 +228,15 @@ macro (add_language_properties lang std)
|
||||
)
|
||||
endmacro ()
|
||||
|
||||
set(_cmake_supported_import_std_experimental "")
|
||||
cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED "CxxImportStd" _cmake_supported_import_std_experimental)
|
||||
if(_cmake_supported_import_std_experimental)
|
||||
list(APPEND properties
|
||||
# property expected alias
|
||||
"CXX_MODULE_STD" "ON" "<SAME>"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Mock up knowing the standard flag. This doesn't actually build, so nothing
|
||||
# should care at this point.
|
||||
set(CMAKE_Cc_std_11_STANDARD_COMPILE_OPTION "-std=c11")
|
||||
|
||||
Reference in New Issue
Block a user