PCH: Precompiled header generator expression always treated as absolute path
In this commit the input filename is always treated as an absolute path if it starts with a generator expression. Is this documented anywhere outside the code?
We had to specify $<COMPILE_LANGUAGE:CXX>
for GCC to work correctly with our local C++ headers, but doing so broke targets from other CMake modules that also included the generated PCH file. After discovering this behavior the fix was simple enough, but clarifying this in the documentation would have helped us find the issue sooner.
Our fix was:
target_precompile_headers(${target} PUBLIC
"$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/${header}>"
)
Edited by nkross