I attempt to resolve a problem with my precompiled header. Normally, with /Yu and /Yc, all is working well. But in the case I have a different path for #include
in same project, I can't find a solution.
The tree directory is like that :
sql_sqlite
---|sql_sqlite.cpp
---|stdafx.cpp
---|stdafx.h
---|win32
------|main.cpp
I use "NMake Makefiles" Generator.
I've stdafx.cpp and sql-sqlite.cpp with #include "stdafx.h"
(for them that's ok), but main.cpp with #include "../stdafx.h"
doesn't work, so I've tried this :
set_source_files_properties(../datasec/src/sql_sqlite/stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
set_source_files_properties(../datasec/src/sql_sqlite/win32/main.cpp PROPERTIES COMPILE_FLAGS "/Yu../stdafx.h")
But that's not working and say :
fatal error C1083: Cannot open precompiled header file: '../stdafx.pch': No such file or directory
Is there a way in CMake to use 2 different precompiled headers ? Or maybe the path is not set correctly ?
Any help will be welcome please.
EDIT :
Here is the answer of CMake Mailing-list... http://permalink.gmane.org/gmane.comp.programming.tools.cmake.user/51904 It appears that MSVC doesn't like the include with relative path for the precompiled header.
The way to solve this is to pass the /Y-
flag on the specified file.
If anyone has another solution, he is welcome.
Thanks