[CMake] Why is this custom command run twice?
Aaron_Wright at selinc.com
Aaron_Wright at selinc.com
Fri Apr 23 11:03:11 EDT 2010
Is there no interest in this differing behavior between Linux and Windows?
I'm a little worried that CMake doesn't produce the same results in both
situations. Aren't those kind of things bugs?
If no one knows the answer off the top of their head, are there some
debugging tips or avenues of investigation anyone could share?
-------------------------------------------------------------
Aaron Wright
From:
Aaron_Wright at selinc.com
To:
Michael Wild <themiwi at gmail.com>
Cc:
CMake List <cmake at cmake.org>
Date:
04/22/2010 01:38 PM
Subject:
Re: [CMake] Why is this custom command run twice?
Sent by:
cmake-bounces at cmake.org
Well, Michael is right, it does work right in Linux. I guess the nature of
the question changes slightly then to become, what I'm I not doing right
for Visual Studio 9 2008, but that works in Linux?
-------------------------------------------------------------
Aaron Wright
From:
Michael Wild <themiwi at gmail.com>
To:
Aaron_Wright at selinc.com
Cc:
CMake List <cmake at cmake.org>
Date:
04/22/2010 01:29 PM
Subject:
Re: [CMake] Why is this custom command run twice?
Works fine for me, sorry to say ;-)
Michael
On 22. Apr, 2010, at 17:49 , Aaron_Wright at selinc.com wrote:
> Interesting. I had a little typo in the first example, here's another
one.
> You only need a file called "generated.txt.in" next to the
CMakeLists.txt
> file.
>
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
>
> PROJECT(quick_test)
>
> ADD_CUSTOM_COMMAND(
> OUTPUT "${PROJECT_BINARY_DIR}/generated.txt"
> COMMAND ${CMAKE_COMMAND} -E copy
> "${PROJECT_SOURCE_DIR}/generated.txt.in"
> "${PROJECT_BINARY_DIR}/generated.txt"
> DEPENDS "${PROJECT_SOURCE_DIR}/generated.txt.in")
>
> ADD_CUSTOM_COMMAND(
> OUTPUT "${PROJECT_BINARY_DIR}/generated_used.stamp"
> COMMAND ${CMAKE_COMMAND} -E touch
> "${PROJECT_BINARY_DIR}/generated_used.stamp"
> DEPENDS "${PROJECT_BINARY_DIR}/generated.txt"
> COMMENT "Using generated.txt")
>
> ADD_CUSTOM_TARGET(
> ${PROJECT_NAME}
> DEPENDS "${PROJECT_BINARY_DIR}/generated_used.stamp")
>
>
> 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.
> -------------------------------------------------------------
> Aaron Wright
>
>
>
>
> From:
> Michael Wild <themiwi at gmail.com>
> To:
> Aaron_Wright at selinc.com
> Cc:
> cmake at cmake.org
> Date:
> 04/21/2010 11:41 PM
> Subject:
> Re: [CMake] Why is this custom command run twice?
> Sent by:
> cmake-bounces at cmake.org
>
>
>
>
> On 22. Apr, 2010, at 5:12 , Aaron_Wright at selinc.com wrote:
>
>> I'm trying to do something a little weird, and I'm almost there but not
>> quite. I'm trying to generate a file and then run a command based on
> that
>> file. I only want the command to run when the file changes and thus the
>> generated file changes. Instead the first build I get both custom
> commands
>> run, and then on a second build, the second custom command runs again,
>> which is not what I want.
>>
>> This is what I got (just an example):
>>
>>
>> ADD_CUSTOM_COMMAND(
>> OUTPUT "${PROJECT_BINARY_DIR}/generated.txt"
>> COMMAND ${CMAKE_COMMAND} -E touch
> "${PROJECT_BINARY_DIR}/generated.txt"
>> DEPENDS "${PROJECT_SOURCE_DIR}/generated.txt")
>>
>> ADD_CUSTOM_COMMAND(
>> OUTPUT "${PROJECT_BINARY_DIR}/generated_used.stamp"
>> COMMAND ${CMAKE_COMMAND} -E touch
>> "${PROJECT_BINARY_DIR}/generated_used.stamp"
>> DEPENDS "${PROJECT_BINARY_DIR}/generated.txt"
>> COMMENT "Using generated.txt")
>>
>> ADD_CUSTOM_TARGET(
>> ${PROJECT_NAME}
>> DEPENDS "${PROJECT_BINARY_DIR}/generated_used.stamp")
>>
>>
>> What I'm I missing? Thanks
>
> Your example works fine for me (using CMake 2.8.1 and Unix Makefiles
> generator on Mac OS X 10.6.2).
>
> Michael
>
> _______________________________________________
> 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
>
_______________________________________________
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/20100423/3a1cf0fa/attachment-0001.htm>
More information about the CMake
mailing list