我正在使用CMake在Windows和Linux上构建项目。 我的CMake脚本正确生成了Visual Studio解决方案,但在Linux上,我在make期间遇到了boost include文件的错误。
hab @hab-VirtualBox:/ media / sf_GitHub / corona / experimental / MakefileParser $ make install [14%]构建CXX对象MakefileParser / src / CMakeFiles / LibMakefileParser.dir / lex.yy.c.o makefile.l:11:33:致命错误:boost \ filesystem.hpp:没有这样的文件或目录 #include “boost \ filesystem.hpp” ^ 编译终止。 make [2]: * [MakefileParser / src / CMakeFiles / LibMakefileParser.dir / lex.yy.c.o]错误1 make [1]:* [MakefileParser / src / CMakeFiles / LibMakefileParser.dir / all]错误2 make:*** [all]错误2
=============================================== =========================
CMakeList.txt
SET (INCLUDES
"${PROJECT_SOURCE_DIR}/include/Config.h"
"${PROJECT_SOURCE_DIR}/include/defines.hpp"
"${PROJECT_SOURCE_DIR}/include/Expansion.h"
"${PROJECT_SOURCE_DIR}/include/MakefileParser.h"
"${PROJECT_SOURCE_DIR}/include/StringUtils.h"
)
SET (SOURCES
"lex.yy.c"
"makefile.tab.h"
"Expansion.cpp"
"MakefileParser.cpp"
"StringUtils.cpp"
)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/ext/boost_1_60_0_Lite")
LINK_DIRECTORIES("${PROJECT_SOURCE_DIR}/ext/boost_1_60_0_Lite/stage/lib")
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES} ${INCLUDES})
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
SET_SOURCE_FILES_PROPERTIES("lex.yy.c" PROPERTIES LANGUAGE CXX )
if(WIN32)
INSTALL(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin)
else()
INSTALL(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib
COMPONENT library)
endif()
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${LIBRARY_OUTPUT_PATH}/$<CONFIGURATION>" ${EXECUTABLE_OUTPUT_PATH}/$<CONFIGURATION>
)
有人遇到过这样的问题吗? 提前谢谢!