[CMake] Make target dependent on all executables & libraries

Lezz Giles lgiles at SoapStoneNetworks.com
Tue Mar 31 12:47:33 EDT 2009


I don't think I can make a custom command depend on ALL.  Here's the relevant CMakeLists.txt fragment that I have now...

ADD_EXECUTABLE( hellow hellow.c )

ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/docs COMMAND cat ${CMAKE_SOURCE_DIR}/hellowdoc.template > ${CMAKE_BINARY_DIR}/docs)

ADD_CUSTOM_TARGET(documentation DEPENDS ${CMAKE_BINARY_DIR}/docs)

I want to make my custom_command dependent on the executable.  If I add "DEPENDS hellow" then it works, but as I said before, this is going to be shared across multiple projects.  If I add "DEPENDS ALL" or "DEPENDS all" then it interprets "all" as a filename and looks for "../all"

I can also use the second form of ADD_CUSTOM_TARGET, but then I need to tie it to one specific executable, not "all".

Lezz

From: Adolfo Rodríguez [mailto:dofo79 at gmail.com]
Sent: Tuesday, March 31, 2009 12:19 PM
To: Lezz Giles
Cc: Cmake Mailing List
Subject: Re: [CMake] Make target dependent on all executables & libraries

How about making it depend on the ALL target?
On Tue, Mar 31, 2009 at 6:07 PM, Lezz Giles <lgiles at soapstonenetworks.com<mailto:lgiles at soapstonenetworks.com>> wrote:
I want to use doxygen to generate documentation, but I also want it to only run if something has changed.  At first I was playing with the idea of having it be dependent on all source & header files, but I quickly realized that that would be difficult or impossible in cmake.  Then I realized that if any source files changed, at least one of my executables or libraries would rebuild, and so I could make my doxygen dependent on the executables & libraries.

Is there any simple way to get a list of all executables and libraries?  I was hoping for variables ALL_EXECUTABLES and ALL_LIBRARIES but unfortunately they don't exist.  The doxygen target will be added to a central cmake file that is shared by many projects so I'd like to have a solution that has little or no impact on the projects.  I know I can define my own ALL_TARGETS and just go to all the projects and assign to ALL_TARGETS, but this is not a good solution from a maintenance perspective.

Lezz Giles


_______________________________________________
Powered by www.kitware.com<http://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



--
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090331/331fe09e/attachment-0001.htm>


More information about the CMake mailing list