-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can"t find PCH file during build. #24
Comments
I think I"m getting the same thing with the example CMakeLists.txt from the readme. macOS 10.13, cmake version 3.12.2, ninja 1.8.2. For me what happens is the first time I run The makefile generator works for me; it builds the prefix.h target first and succeeds on the first try.
Running it again succeeds:
|
Last time I tried srcdir != builddir was not supported. |
Hm, I tried |
I also stumbled across this issue. Problem is that the diff --git a/CMakePCHCompiler.cmake b/CMakePCHCompiler.cmake
index 525a836e..b04181db 100644
--- a/CMakePCHCompiler.cmake
+++ b/CMakePCHCompiler.cmake
@@ -118,6 +118,7 @@ function(target_precompiled_header) # target [...] header
)
target_sources(${target} PRIVATE $<TARGET_OBJECTS:${pch_target}>)
else()
+ string(REPLACE ".." "__" header "${header}")
set(exclude -include ${target_dir}/${header})
endif()
target_compile_options(${target} PRIVATE ${exclude}) |
@themiwi Okay, so long story short - if I understand correctly - currently we cannot use PCH header path containing Does CMake indeed translates |
Isn"t that what my patch is doing? 🤔 |
@themiwi I was referring your statement:
And I was asking if it is really CMake behavior? But I found the evidence myself there in CMake"s And btw. it was NOT that trivial as you have suggested, as CMake does far more than |
Thanks, that"s as I suspected originally. With CMake there"s usually more to it 😉 |
I am testing this module out with our software but I can"t get it to compile. After calling add_library(), I call target_precompiled_header(${target} ${pch_path}) to add the PCH to it. CMake will run successfully if I use the absolute or relative path to the .pch file but when I try to compile the code I get one of the following errors:
(relative path)
cc1plus: fatal error: /home/smcmich1/repo/visionworkbench/build/src/vw/Core/CMakeFiles/VwCore.pch.dir/../stdafx.h: No such file or directory
(absolute path)
cc1plus: fatal error: /home/smcmich1/repo/visionworkbench/build/src/vw/Core/CMakeFiles/VwCore.pch.dir//home/smcmich1/repo/visionworkbench/src/vw/stdafx.h: No such file or directory
Do you know what could be going wrong? The PCH file is located at /home/smcmich1/repo/visionworkbench/src/vw/stdafx.h. CMake is being called from the "build" subfolder and the code is located in the "src" subfolder. The project line is:
project (VisionWorkbench C CXX CXXPCH CPCH)
This is on Red Hat 6, with CMake 3.5.2, and GCC 4.9.3.
Thanks,
Scott
The text was updated successfully, but these errors were encountered: