Kaynağa Gözat

Merge topic 'vs-pch-compile-opts' into release-3.17

6b2fb4ffd2 VS: Fix using PCH from source with COMPILE_OPTIONS

Acked-by: Kitware Robot <[email protected]>
Merge-request: !4734
Brad King 5 yıl önce
ebeveyn
işleme
44ae68d976

+ 1 - 1
Source/cmVisualStudio10TargetGenerator.cxx

@@ -2369,7 +2369,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
         pchOptions =
         pchOptions =
           this->GeneratorTarget->GetPchUseCompileOptions(config, lang);
           this->GeneratorTarget->GetPchUseCompileOptions(config, lang);
       }
       }
-      customAndPchOptions += pchOptions;
+      customAndPchOptions = cmStrCat(customAndPchOptions, ';', pchOptions);
     }
     }
 
 
     // if we have flags or defines for this config then
     // if we have flags or defines for this config then

+ 3 - 0
Tests/RunCMake/PrecompileHeaders/PchInterface.cmake

@@ -9,6 +9,9 @@ target_precompile_headers(foo PUBLIC
   <stdio.h>
   <stdio.h>
   \"string.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)
 add_library(bar INTERFACE)
 target_include_directories(bar INTERFACE include)
 target_include_directories(bar INTERFACE include)