0

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

Algorys
  • 1,710
  • 2
  • 25
  • 52
  • Does it work without CMake when you just use hand-written Makefiles? If yes, can you post them? – usr1234567 Mar 04 '15 at 09:36
  • @usr1234567 Thanks for answer. I've never do Makefiles myself :-/ , only with CMake. But when I generate a solution for Visual it works and take well the path for precompiled header – Algorys Mar 04 '15 at 09:51
  • @usr1234567 I think CMake try to make 2 different stdafx.pch... or something like that... I try many solution with slash, backslash... etc... but nothings change... – Algorys Mar 04 '15 at 11:04

0 Answers0