Commit 6b2fb4ff authored by Brad King's avatar Brad King
Browse files

VS: Fix using PCH from source with COMPILE_OPTIONS

If a source file gets per-source flags from both PCH and custom
`COMPILE_OPTIONS`, combine them correctly.

Fixes: #20694, #20456
parent 4c82f309
......@@ -2345,7 +2345,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
pchOptions =
this->GeneratorTarget->GetPchUseCompileOptions(config, lang);
}
customAndPchOptions += pchOptions;
customAndPchOptions = cmStrCat(customAndPchOptions, ';', pchOptions);
}
// if we have flags or defines for this config then
......
......@@ -9,6 +9,9 @@ target_precompile_headers(foo PUBLIC
<stdio.h>
\"string.h\"
)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
set_property(SOURCE foo.c APPEND PROPERTY COMPILE_OPTIONS "-WX-")
endif()
add_library(bar INTERFACE)
target_include_directories(bar INTERFACE include)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment