[CMake] add_custom_command vs add_subdirectory
Mathieu Malaterre
mathieu.malaterre at gmail.com
Fri Feb 19 09:46:28 EST 2010
Hi,
I am trying to find a solution with add_custom_command that can only
depends on file generated within the same directory as where it is
defined. What would I need to change here to make this small example
work:
$ cat CMakeLists.txt
project(d12)
cmake_minimum_required(VERSION 2.8)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bla.txt
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/bla.txt
DEPENDS ${d12_BINARY_DIR}/sub/foo.txt
)
add_custom_target(bla ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bla.txt
)
add_subdirectory(sub)
and
$ cat sub/CMakeLists.txt
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foo.txt
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/foo.txt
)
Ref:
svn co https://gdcm.svn.sourceforge.net/svnroot/gdcm/Sandbox/CMakeBug/12
Thanks for suggestions,
--
Mathieu
More information about the CMake
mailing list