[CMake] cmake 2.6: add_custom_command - add_custom_target

Spicy spam at lhanke.de
Fri Jan 1 07:15:48 EST 2010


Thanks a lot Alan,

this solved the issue and also my original problem concerning the pot 
target.

 > Yes.  replace bla.txt everywhere by ${CMAKE_CURRENT_BINARY_DIR}/bla.txt,

It is sufficient to specify the path for add_custom_target, i.e.

--8<-------CMakeLists.txt------------
cmake_minimum_required(VERSION 2.6)
project(test)
add_custom_command(
   OUTPUT bla.txt
   COMMAND touch bla.txt
)
add_custom_target(bla DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bla.txt)
--8<-------CMakeLists.txt------------

And then it's also clear why this is required. The OUTPUT is created in 
the build tree, while DEPENDS are expected in the source tree.

Many thanks and a happy new year,
  - lars.


More information about the CMake mailing list