[CMake] Problem with different #include for precompiled Headers
Matthieu Estrada
m.estrada at alpi.fr
Wed Mar 4 07:10:00 EST 2015
Hello,
I have a CMakeLists.txt who contains the following :
project(sql_sqlite)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /D_USRDLL /DSQL_SQLITE_EXPORTS /D_UNICODE /DUNICODE")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /GL /Oi /Gy /O2 /GR- /Gm- /OPT")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX- /ZI /Oy- /Gm /EHsc /MDd /GS /Gd ")
set_source_files_properties(../sql_sqlite/stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
set_source_files_properties(../sql_sqlite/sql_sqlite.cpp PROPERTIES COMPILE_FLAGS "/Yustdafx.h")
set_source_files_properties(../sql_sqlite/win32/main.cpp PROPERTIES COMPILE_FLAGS /Yu"../stdafx.h")
set_source_files_properties(../../../external/sqlite/sqlite3.c PROPERTIES COMPILE_FLAGS "/Y-")
add_library(
sql_sqlite
SHARED
../sql_sqlite/stdafx.h
../../../external/sqlite/sqlite3.h
../sql_sqlite/sql_sqlite.cpp
../sql_sqlite/stdafx.cpp
../sql_sqlite/win32/main.cpp
../../../external/sqlite/sqlite3.c
)
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. When I generate Makefile with the NMake Makefiles generator, and type « nmake » I've the following issue :
« fatal error C1083: Cannot open precompiled header file: '../stdafx.pch': No such file or directory »
Why he doesn't find the stdafx.pch ?
I've trying many way to resolve this problem : use backslah, slash, in CMakeLists.txt or my main.cpp.. Nothing works.
How I can resolve this problem ? Is there a way to force it or a custom command special for precompiled header using relative path ?
Cordials,
Estrada Matthieu
Service Informatique / Intégration
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150304/6fb02195/attachment-0001.html>
More information about the CMake
mailing list