COMPILE_OPTIONS and pch error
If I combine target_precompile_header and setting COMPILE_OPTIONS on a source file, I get a build error:
2>cl : Command line error D8021: invalid numeric argument '/wd6387/YuC:/Users/.../CMakeFiles/mylib.dir/cmake_pch.hxx'
A snippet of my CMake is like this:
target_precompile_headers(mylib PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:MyHeader.hpp>
)
set_source_files_properties(MySource.cpp PROPERTIES COMPILE_OPTIONS "/wd6387")
If I remove the set_source_files_properties() the build error goes away. It looks like the compile option I give is combined with a /Yu flag but with a space.
Edited by Brad King