mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-29 18:49:03 -06:00
Tests/CXXModules: add test case for import std support
This commit is contained in:
@@ -175,6 +175,7 @@ endfunction ()
|
||||
# - `partitions`: module partitions are supported
|
||||
# - `internal_partitions`: internal module partitions are supported
|
||||
# - `bmionly`: the compiler supports BMI-only builds
|
||||
# - `import_std23`: the compiler supports `import std` for C++23
|
||||
#
|
||||
# Generator-based:
|
||||
# - `compile_commands`: the generator supports `compile_commands.json`
|
||||
@@ -221,6 +222,11 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
|
||||
run_cxx_module_test(same-src-name)
|
||||
run_cxx_module_test(scan_properties)
|
||||
run_cxx_module_test(target-objects)
|
||||
|
||||
if ("cxx_std_23" IN_LIST CMAKE_CXX_COMPILE_FEATURES AND
|
||||
"import_std23" IN_LIST CMake_TEST_MODULE_COMPILATION)
|
||||
run_cxx_module_test(import-std)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Tests which require compile commands support.
|
||||
|
||||
12
Tests/RunCMake/CXXModules/examples/import-std/CMakeLists.txt
Normal file
12
Tests/RunCMake/CXXModules/examples/import-std/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.29)
|
||||
project(cxx_modules_import_std CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
set(CMAKE_CXX_MODULE_STD 1)
|
||||
|
||||
add_executable(main
|
||||
main.cxx)
|
||||
target_compile_features(main PRIVATE cxx_std_23)
|
||||
|
||||
add_test(NAME main COMMAND main)
|
||||
10
Tests/RunCMake/CXXModules/examples/import-std/main.cxx
Normal file
10
Tests/RunCMake/CXXModules/examples/import-std/main.cxx
Normal file
@@ -0,0 +1,10 @@
|
||||
import std;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc > 0 && argv[0]) {
|
||||
std::string argv0 = argv[0];
|
||||
std::cout << "program: " << argv0 << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user