[CMake] Why is this custom command run twice?

David Cole david.cole at kitware.com
Fri Apr 30 09:50:06 EDT 2010


Actually.... I've just talked with Brad about this. This might be an issue
with Visual Studio 10 itself rather than cmake or with whether or not you
use full paths...

The generated project should have the same contents regardless of whether
you use the full paths or not. If you could try both ways and then do a diff
on the *.vcxproj files and let us know the results, that would be great. We
expect them to be the same generated custom commands in full path and in
non-full path cases.


On Fri, Apr 30, 2010 at 9:37 AM, David Cole <david.cole at kitware.com> wrote:

> Use full paths for all OUTPUT and DEPENDS args and try again.
>
> i.e.
>  OUTPUT ${PROJECT_BINARY_DIR}/generated.txt
>  DEPENDS ${PROJECT_SOURCE_DIR}/generated.txt.in
> ADD_CUSTOM_TARGET(${PROJECT_NAME} DEPENDS
> ${PROJECT_BINARY_DIR}/generated.txt)
>
>
> Does it work then?
>
>
> On Fri, Apr 30, 2010 at 5:28 AM, elizabeta petreska <
> elizabeta.petreska at gmail.com> wrote:
>
>> Hello
>>
>>
>> >>Can you create a VS project manually through the IDE in which
>> >>this works correctly?
>>
>> I add custom build step manually through VS10 dialog for the following
>> cmake code , and it works as it should. But if I run this through cmake (
>> not manually ) it does not work:
>>
>>
>> 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_TARGET(${PROJECT_NAME} DEPENDS generated.txt)
>>
>> What it seems odd is this :
>> If I change the name of the input file or the name od the output file ,
>> then it does work with cmake too.
>>
>> Maybe this just my imagination can not tell for sure. My guess is maybe
>> this has to do something that the output file ( generated.txt) is substring
>> of the input file ( generated.txt.in ).
>>
>> Thank you
>>
>>
>>
>>
>>
>>
>>
>> On Wed, Apr 28, 2010 at 6:52 PM, Brad King <brad.king at kitware.com> wrote:
>>
>>> elizabeta petreska wrote:
>>> >  I am using Visual Studio 2010 generator and cmake 2.8.1
>>> > The example code you show, does work with Visual Studio 2005 generator
>>> > and visual studio 2008 generator , but does not work with  Visual
>>> Studio
>>> > 2010 generator, i.e
>>> > If I touch the ${PROJECT_BINARY_DIR}/generated.txt, the target is not
>>> > built anew.
>>>
>>> Can you create a VS project manually through the IDE in which
>>> this works correctly?
>>>
>>> -Brad
>>>
>>
>>
>> _______________________________________________
>> 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/20100430/60dcf423/attachment.htm>


More information about the CMake mailing list