I have an external cmake project which I want to use in my cmake project. I've put it into my include directory to compile it with my project. Let's say:
project dir
| include
| | external
| | | CMakeList.txt
| | | src
| | | | externalLib.h
| src
| CMakeList.txt
In my cmake file is:
add_subdirectory(include/external)
So, the project is linked and when I try to make it the error occurs:
fatal error: src/exernalLib.h: No such file or directory
But as a standalone it compiles. So, I think that I have to say somewhere that the external project has to take his scope. But where?
It isn't enough. You have to set include directories inside your project definition:
include_directories(${CMAKE_SOURCE_DIR}/include/external/)
But the best solution is to write own FindExternLib.cmake according to https://cmake.org/Wiki/CMake:How_To_Find_Libraries
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.