mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 22:59:56 -05:00
183b9a9eca
Under the CMP0141 NEW behavior added by commit 0e96a20478 (MSVC: Add
abstraction for debug information format, 2022-08-25, v3.25.0-rc1~142^2~1),
the `-Zi` and `-ZI` flags do not appear in `CMAKE_<LANG>_FLAGS_<CONFIG>`
anymore. Teach the PCH REUSE_FROM implementation to recognize the
`EditAndContinue` and `ProgramDatabase` debug information formats
through the policy's new abstraction.
Fixes: #24106
30 lines
788 B
CMake
30 lines
788 B
CMake
enable_language(C)
|
|
|
|
if(CMAKE_C_COMPILE_OPTIONS_USE_PCH)
|
|
add_definitions(-DHAVE_PCH_SUPPORT)
|
|
endif()
|
|
|
|
# Add this before the target from which we will reuse the PCH
|
|
# to test that generators can handle reversed ordering.
|
|
add_library(foo foo.c)
|
|
target_include_directories(foo PUBLIC include)
|
|
|
|
add_library(empty empty.c)
|
|
target_precompile_headers(empty PRIVATE
|
|
<stdio.h>
|
|
<string.h>
|
|
)
|
|
target_include_directories(empty PUBLIC include)
|
|
|
|
target_precompile_headers(foo REUSE_FROM empty)
|
|
|
|
# should not cause problems if configured multiple times
|
|
target_precompile_headers(foo REUSE_FROM empty)
|
|
|
|
add_executable(foobar foobar.c)
|
|
target_link_libraries(foobar foo )
|
|
set_target_properties(foobar PROPERTIES PRECOMPILE_HEADERS_REUSE_FROM foo)
|
|
|
|
enable_testing()
|
|
add_test(NAME foobar COMMAND foobar)
|