Files
cmake/Tests/RunCMake/CXXModulesCompile/imp-std-trans/CMakeLists.txt
T
Brad King c1d58d3f3d Experimental: Restore import std gate
Several problems with this feature came up while testing 4.3.0-rc1.
These include both broken stdlib distributions and regressions in our
implementation of the feature since CMake 4.2.

Revert commit 70c1f0f43d (Experimental: Remove import std experimental
gate, 2026-02-04, v4.3.0-rc1~61^2) except for its incidental fixes.

Remove the 4.3 release notes related to `import std`.

Rotate the experimental gate's UUID.

Issue: #27426
Issue: #27597
Issue: #27626
Issue: #27635
2026-02-26 17:19:19 -05:00

30 lines
709 B
CMake

set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
"451f2fe2-a8a2-47c3-bc32-94786d8fc91b")
cmake_minimum_required(VERSION 3.29)
if (EXPORT_NO_STD)
# Block making C++ `import std` targets.
add_library(__CMAKE::CXX23 IMPORTED INTERFACE)
add_library(__CMAKE::CXX26 IMPORTED INTERFACE)
endif ()
project(cxx_modules_import_std_transitive CXX)
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
if (EXPORT_NO_STD)
set(package "import_std_export_no_std")
else ()
set(package "import_std_not_in_export")
endif ()
find_package("${package}" REQUIRED)
set(CMAKE_CXX_MODULE_STD 0)
add_executable(main
main.cxx)
target_link_libraries(main PRIVATE "CXXModules::${package}")
add_test(NAME main COMMAND main)