mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 23:00:07 -06:00
Tests/CXXModules: add a test which scans a PCH-using source
This tests that PCH usage works with scanning logic.
This commit is contained in:
@@ -165,6 +165,8 @@ if (RunCMake_GENERATOR MATCHES "Ninja")
|
||||
run_cxx_module_test_target(ninja-cmp0154 "${ninja_cmp0154_target}")
|
||||
endif ()
|
||||
|
||||
run_cxx_module_test(scan-with-pch)
|
||||
|
||||
# Tests which use named modules.
|
||||
if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
|
||||
run_cxx_module_test(simple)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(cxx_modules_scan_with_pch CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
add_executable(simple)
|
||||
target_sources(simple
|
||||
PRIVATE
|
||||
main.cxx)
|
||||
target_compile_features(simple PUBLIC cxx_std_20)
|
||||
target_precompile_headers(simple PRIVATE pch.h)
|
||||
|
||||
add_test(NAME simple COMMAND simple)
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef from_pch
|
||||
# error "pch not present"
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
1
Tests/RunCMake/CXXModules/examples/scan-with-pch/pch.h
Normal file
1
Tests/RunCMake/CXXModules/examples/scan-with-pch/pch.h
Normal file
@@ -0,0 +1 @@
|
||||
#define from_pch
|
||||
Reference in New Issue
Block a user