[CMake] Inherited project settings

Brian Davis bitminer at gmail.com
Tue Feb 2 16:15:11 EST 2010


So I have various CMakeLists.txt files in my directory structure.  Some with
the PROJECT( name ) specified at the top and some without.  I am using
add_sub directory to add each directory.

/CMakeLists.txt
/source/cpp/app/CMakeLists.txt
/source/cpp/app/someapp/CMakeLists.txt
/source/cpp/lib/CmakeLists.txt
source/cpp/lib/somelib

For the subdirectory structure above build settings for someapp will inherit
from app/CMakeLists.txt and the top level CMakeLists.txt file.  However if
the build directories and include paths are set for libraries in
/source/cpp/lib/CmakeLists.txt how would apps see these.

Is there a way for one project to inherit project settings from another
project which is not in the path from the originating subproject
CMakeLists.txt (app/CMakeLists.txt) up to the root CMakeLists.txt?

For example is there a way for apps to inherit project settings in libs
(such as include paths) without having to use CACHE STRING "" FORCE and
having to move these vars up the path to the root CMakeLists.txt file.

Is there also a way to disable recursive sub directory project inheritance
in CMake?

Is there another name I can give to my CMakeLists.txt files that CMake will
parse in add_subdirectory?  I have multiple CMakeLists.txt files open in
eclipse and can never keep which one is which straight (they all have the
same name).

I also noticed that if I have a CMakeLists.txt in between the top/root level
CMakeLists.txt without the PROJECT( name ) in the file that include paths
added at the intermediary CMakeLists.txt using INCLUDE_DIRECTORIES(
wherever) are still inherited.

-- 
Brian J. Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100202/5b8d0125/attachment.htm>


More information about the CMake mailing list