[CMake] Why is this custom command run twice?
Aaron_Wright at selinc.com
Aaron_Wright at selinc.com
Mon Apr 26 11:31:05 EDT 2010
Thanks for checking on this Brad.
-------------------------------------------------------------
Aaron Wright
From:
Brad King <brad.king at kitware.com>
To:
Aaron_Wright at selinc.com
Cc:
cmake at cmake.org, Michael Wild <themiwi at gmail.com>
Date:
04/23/2010 11:59 AM
Subject:
Re: [CMake] Why is this custom command run twice?
Sent by:
cmake-bounces at cmake.org
Aaron_Wright at selinc.com wrote:
> This builds ok the first time, but then change the "generated.txt.in"
> and run the build twice and the second time you'll see "Using
> generated.txt" again, which I don't want to see. I've tried VS 2008 and
> NMake, using CMake 2.8 and 2.8.1.
I was able to reproduce this. There is nothing wrong with the project
that CMake generates in VS. The problem seems to be with the windows
filesystem timestamp granularity. The code below changes the touch
into a copy, and the problem goes away.
The code can actually be simpler, too. CMake 2.8 (and 2.6 I think)
automatically handles relative output files with respect to the
build tree.
-Brad
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(quick_test)
ADD_CUSTOM_COMMAND(
OUTPUT generated.txt
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/generated.txt.in
${PROJECT_BINARY_DIR}/generated.txt
DEPENDS generated.txt.in
)
ADD_CUSTOM_COMMAND(
OUTPUT generated_used.stamp
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_BINARY_DIR}/generated.txt
${PROJECT_BINARY_DIR}/generated_used.stamp
DEPENDS generated.txt
COMMENT "Using generated.txt"
)
ADD_CUSTOM_TARGET(${PROJECT_NAME} DEPENDS generated_used.stamp)
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100426/d649ba90/attachment-0001.htm>
More information about the CMake
mailing list