The is almost exactly the same, except that you have allow for CMake to run in another location for “out-of-tree” builds. You do this by specifying the path relative to ${CMAKE_CURRENT_SOURCE_DIR}
, which is the directory containing the current CMakeLists.txt file.
${CMAKE_CURRENT_SOURCE_DIR}/../../External/Library
But, you might want to reconsider, and instead use FIND_LIBRARY()
and FIND_FILE()
commands to search a set of predefined locations, so that users of your library don’t have to keep the same relative structure.