I decided to include a library in my project (more precisely, yaml-cpp ). Since both projects (yaml-cpp and mine) use CMAKE to build, I decided to try placing the yaml-cpp directory inside my root directory and just use add_subdirectory(yaml-cpp) and target_link_libraries(${EXECUTABLE_NAME} foolib yaml-cpp) , so as yaml-cpp CMakeLists.txt already contains
include_directories(${YAML_CPP_SOURCE_DIR}/include) # ... add_library(yaml-cpp ${sources} ${public_headers} ${private_headers} ${contrib_sources} ${contrib_public_headers} ${contrib_private_headers} )
... and I should be fine for both include and target library. But, as it turns out, when compiling, I get the following error:
P: \ zpp \ TheGameShow \ TGS.cpp (16): fatal error C1083: cannot include include file: 'yaml-cpp / yaml.h': no ββsuch file or directory
... if I do not duplicate the line include_directories(${YAML_CPP_SOURCE_DIR}/include) in my own CMakeLists.txt
My question is: is this the desired behavior? Shouldn't distribute include directories from subdirectories to root directories? Am I doing something wrong?
edit: I am using Visual Studio 2010 and CMake 2.8.6
source share