On 2013-03-08 15:19, Alexander Neundorf wrote:
There is no need to overengineer it.
Just do
include_directories(${CMAKE_SOURCE_DIR}/lib1/src)
in CMakeLists.txt (3). No need to put it in the cache or something.

This can break if your current project tree ever lands in a larger tree. In general I prefer to avoid ${CMAKE_SOURCE_DIR} in favor of ${<project>_SOURCE_DIR} instead.

Even better, if each of your libraries declares a project, you can use ${lib1_SOURCE_DIR}/src, and you won't have to change it if you later move lib1 to a different place in the source tree.

(I've seen legitimate uses of defining variables for libraries' interface properties, e.g. include directories, but all of this is about to become properly supported :-), and anyway isn't something I would recommend trying to emulate in a young project.)

--
Matthew

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to