File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,8 +42,27 @@ elseif (MSVC)
4242 endif ()
4343endif ()
4444
45+ # Find CMAKE_EXPERIMENTAL_CXX_IMPORT_STD UUID
4546# https://github.com/Kitware/CMake/blob/master/Help/dev/experimental.rst
4647set (CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "a9e1cf81-9932-4810-974b-6eccaf14e457" )
48+ string (REGEX REPLACE "-[A-Za-z0-9_]+$" "" CMAKE_VER_FULL "${CMAKE_VERSION} " )
49+ file (READ "${CMAKE_CURRENT_LIST_DIR} /cmake_import_std_uuids.json" _json_str )
50+ string (REGEX MATCH "\" ${CMAKE_VER_FULL} \" [ \t ]*:[ \t ]*\" ([0-9a-fA-F\\ -]+)\" " _match "${_json_str} " )
51+ if (_match)
52+ string (REGEX REPLACE ".*\" ${CMAKE_VER_FULL} \" [ \t ]*:[ \t ]*\" ([0-9a-fA-F\\ -]+)\" .*" "\\ 1" _uuid "${_match} " )
53+ message (STATUS "Detected CMake version ${CMAKE_VER_FULL} , using import_std UUID = ${_uuid} " )
54+ set (CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "${_uuid} " )
55+ else ()
56+ string (REGEX MATCH "\" default\" [ \t ]*:[ \t ]*\" ([0-9a-fA-F\\ -]+)\" " _default_match "${_json_str} " )
57+
58+ if (_default_match)
59+ string (REGEX REPLACE ".*\" default\" [ \t ]*:[ \t ]*\" ([0-9a-fA-F\\ -]+)\" .*" "\\ 1" _uuid "${_default_match} " )
60+ message (STATUS "CMake version ${CMAKE_VER_FULL} not found in mapping, forcing default UUID = ${_uuid} " )
61+ else ()
62+ message (FATAL_ERROR "Default UUID not found in cmake_import_std_uuids.json — cannot proceed without import std configuration" )
63+ endif ()
64+ endif ()
65+
4766set (CMAKE_CXX_STANDARD 23)
4867set (CMAKE_CXX_MODULE_STD 1)
4968
You can’t perform that action at this time.
0 commit comments