diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-07-19 23:00:05 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-07-31 15:59:47 (GMT) |
commit | b768d293c5c358dd734234cacab7c34e61c88c54 (patch) | |
tree | c509fe68fab1661f978acd7a07b0aa3132c0d20c /Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt | |
parent | 93993c7ad4f634451fb1c8f67f00d4d959d199ac (diff) | |
download | CMake-b768d293c5c358dd734234cacab7c34e61c88c54.zip CMake-b768d293c5c358dd734234cacab7c34e61c88c54.tar.gz CMake-b768d293c5c358dd734234cacab7c34e61c88c54.tar.bz2 |
cmCoreTryCompile: use the source type context for source files
Also add a test to `RunCMake/CXXModules` to test `try_compile` with C++
modules.
Fixes: #25097
Diffstat (limited to 'Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt')
-rw-r--r-- | Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt new file mode 100644 index 0000000..fb03571 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_try_run CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +try_run(can_run_modules_result can_compile_modules + SOURCES_TYPE CXX_MODULE + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/importable.cxx" + SOURCES_TYPE NORMAL + SOURCE_FROM_FILE + main.cxx "${CMAKE_CURRENT_LIST_DIR}/main.cxx" + CXX_STANDARD 20) + +if (NOT can_compile_modules) + message(FATAL_ERROR + "`try_run` could not compile sources using modules.") +endif () + +if (can_run_modules_result) + message(FATAL_ERROR + "`try_run` could not run sources using modules.") +endif () |