That seems like add_custom_command should fail with an error when the named target does not exist. (I have never noticed this, because I never use that signature of add_custom_command...)
On Tue, Aug 30, 2011 at 12:45 PM, Johan Björk <[email protected]> wrote: > Hi guys, > I just ran into the following issue, and I'm quite baffled? Is this really > expected behaviour? > cherimoya:cmake-postbuildearly phb$ cat CMakeLists > ADD_CUSTOM_COMMAND(TARGET foo POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo > 'hello') > TARGET_LINK_LIBRARIES(foo "-lbar") > cherimoya:cmake-postbuildearly phb$ cat CMakeLists.txt > cmake_minimum_required(VERSION 2.8) > ADD_CUSTOM_COMMAND(TARGET foo POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo > 'hello') > FILE(WRITE foo.c "") > ADD_LIBRARY(foo foo.c) > FILE(WRITE bar.c "") > ADD_LIBRARY(bar bar.c) > ADD_CUSTOM_COMMAND(TARGET bar POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo > 'hello') > > <after generation, makefile or xcode generator doesn't matter> > cherimoya:cmake-postbuildearly phb$ grep -R hello * > CMakeFiles/bar.dir/build.make: /usr/local/Cellar/cmake/2.8.5/bin/cmake -E > echo 'hello' > CMakeLists:ADD_CUSTOM_COMMAND(TARGET foo POST_BUILD COMMAND ${CMAKE_COMMAND} > -E echo 'hello') > CMakeLists.txt:ADD_CUSTOM_COMMAND(TARGET foo POST_BUILD COMMAND > ${CMAKE_COMMAND} -E echo 'hello') > CMakeLists.txt:ADD_CUSTOM_COMMAND(TARGET bar POST_BUILD COMMAND > ${CMAKE_COMMAND} -E echo 'hello') > ie, it simply ignores the custom command for when the target does not yet > exist! > > /Johan > > _______________________________________________ > 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 > _______________________________________________ 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
