[CMake] How to pass values up to parent CMakeLists.txt

Lezz Giles lgiles at SoapStoneNetworks.com
Tue Mar 31 16:47:23 EDT 2009


So I want to collect a list of targets which I'll use in a central CMakeLists.txt.  My files are arranged like this:


Project CMakeLists.txt

-        Central CMakeLists.txt file which pulls in

o   src/CMakeLists.txt

o   tst/CMakeLists.txt

-        Central CMakeLists.txt file then defines a custom_command

What I want to do is pass values up from src/CMakeLists.txt and tst/CMakeLists.txt that can be used in the custom_command.  A normal variable doesn't work - the value is scoped to the current CMakeLists.txt file.  I can define the values in the project CMakeLists.txt, but then that separates them from where they really should be, i.e. src|tst/CMakeLists.txt.

Can anybody help me pass up these values?  If it makes any difference, I'm collecting all executables and libraries.

Lezz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090331/3b890186/attachment-0001.htm>


More information about the CMake mailing list