PCH + VS2017 generator + File compile options = compile error
I'm using cmake code like following:
add_library(${PROJECT_NAME} STATIC
...
file.cpp
...
)
target_precompile_headers(${PROJECT_NAME} PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/stdafx.h>"
)
set_source_files_properties("file.cpp" PROPERTIES COMPILE_OPTIONS "/WX-")
Error output:
cl : Command line error D8021: invalid numeric argument '/WX-/YuD:/SLB/OLGA/framework/rulesengine/src/build/Visual Studio 15 2017 Win64/Unit/CMakeFiles/Unit.dir/cmake_pch.hxx'
File options concatenates with /Yu flag. Happens only with VS generator (Ninja and NMake Makefiles are ok)
CMake 3.16.6.