diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake | 24 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/VSWindowsFormsResx/CMakeLists.txt | 6 |
3 files changed, 31 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake b/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake new file mode 100644 index 0000000..b4fdb71 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.16) +project(PchLibObjLibExe CXX) + +foreach(i 1 2 3) + file(WRITE ${CMAKE_BINARY_DIR}/empty${i}.cpp "void nothing${i}() {}\n") +endforeach() + +add_library(base_lib_static STATIC ${CMAKE_BINARY_DIR}/empty1.cpp) +target_precompile_headers(base_lib_static PRIVATE <vector>) + +add_library(object_lib OBJECT ${CMAKE_BINARY_DIR}/empty2.cpp) +target_precompile_headers(object_lib REUSE_FROM base_lib_static) + +add_library(mid_lib_static STATIC ${CMAKE_BINARY_DIR}/empty3.cpp) +target_link_libraries(mid_lib_static PRIVATE object_lib) + +add_executable(exec main.cpp) +target_link_libraries(exec PRIVATE mid_lib_static) +set_target_properties(exec PROPERTIES MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>) + +target_precompile_headers(exec PRIVATE <string>) + +enable_testing() +add_test(NAME exec COMMAND exec) diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake index e723e03..ca5b52e 100644 --- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake +++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake @@ -29,3 +29,4 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") endif() run_test(PchReuseFromObjLib) run_test(PchIncludedAllLanguages) +run_test(PchLibObjLibExe) diff --git a/Tests/VSWindowsFormsResx/CMakeLists.txt b/Tests/VSWindowsFormsResx/CMakeLists.txt index 43c4833..b9b2163 100644 --- a/Tests/VSWindowsFormsResx/CMakeLists.txt +++ b/Tests/VSWindowsFormsResx/CMakeLists.txt @@ -33,6 +33,12 @@ set(TARGET_RESX set(TARGET_LIBRARIES ${SYSLIBS}) add_executable(${PROJECT_NAME} ${TARGET_SRC} ${TARGET_H} ${TARGET_RESX}) +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 1[0-6]") + # VS 17 2022 and above require a global mark on managed assemblies. + # CMake adds this automatically when using COMMON_LANGUAGE_RUNTIME, + # but this test covers direct use of /clr. + set_property(TARGET ${PROJECT_NAME} PROPERTY VS_GLOBAL_ManagedAssembly "true") +endif() # Note: The property VS_GLOBAL_KEYWORD must be set. set_property(TARGET ${PROJECT_NAME} PROPERTY VS_GLOBAL_KEYWORD "ManagedCProj") |