[CMake] Add custom command problem ?
Michael Wild
themiwi at gmail.com
Fri Dec 10 04:28:28 EST 2010
On 12/10/2010 09:23 AM, Robert Bielik wrote:
> Hi all,
>
> Using 2.8.2 I'm trying to make a rule to create a timestamp header, but
> only if a certain file has changed, like so:
>
> ADD_CUSTOM_COMMAND(
> OUTPUT src/timestamp.h
> COMMAND tools/win32/timestamper
> ARGS src/timestamp.h
> DEPENDS Version.cmake
> WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> COMMENT "Generating timestamp header..."
> )
>
> but the rule is always executed, even if the Version.cmake file has not
> changed. What am I doing wrong ?
>
> TIA
> /Rob
1. Always use absolute paths (e.g. using CMAKE_CURRENT_SOURCE_DIR and
CMAKE_CURRENT_BINARY_DIR).
2. Never create output in the source tree.
HTH
Michael
More information about the CMake
mailing list