Hi Joerg,
> -----Original Message-----
> From: Joerg Bruehe [mailto:joerg@stripped]
> Sent: Freitag, 21. Januar 2011 21:40
> To: commits@stripped
> Subject: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969
> +ADD_CUSTOM_TARGET(VERSION_BIN ALL
> + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/version_files.cmake
> + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
> +)
A problem with ADD_CUSTOM_TARGET when it is used like this is that it is always rebuilt
(there are no inputs and not outputs , so it
is always considered out-of-date). However there is a way to make it work more like
classic make utility with input and output,
where rebuild is done only if input changes.
How about something like:
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_BINARY_DIR}/VERSION_bin
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/version_files.cmake
DEPENDS ${CMAKE_BINARY_DIR}/CMakeCache.txt
)
ADD_CUSTOM_TARGET(VERSION_BIN ALL
DEPENDS ${CMAKE_BINARY_DIR}/VERSION_bin)
Disclaimer: I have not tried that with your patch :) just took the technique from the
Cmake FAQ (
http://www.cmake.org/Wiki/CMake_FAQ , section "How do I generate an executable, then use
the executable to generate a file? " ) and
applied to your example (your example is simpler, because you do not have to generate an
executable). I assumed you generate the
VERSION_bin from CMakeCache.txt and there are no other dependencies , at least it seems so
to me.