MantisBT - CMake
View Issue Details
0011274CMakeCMakepublic2010-09-29 11:012010-11-09 22:57
Elizabeta 
Bill Hoffman 
normalmajoralways
closedfixed 
CMake-2-8 
CMake 2.8.3CMake 2.8.3 
0011274: add_custom_command does not work with VS2010 generator
when output of the add_custom_command is PROJECT_BINARY_DIR/Some_Subdir it does not work as it should i.e the command is always run. Example :

ADD_CUSTOM_COMMAND(
 OUTPUT "${PROJECT_BINARY_DIR}/$(ConfigurationName)/generated.txt"
 COMMAND ${CMAKE_COMMAND} -E copy
  "${PROJECT_SOURCE_DIR}/myfile.txt"
  "${PROJECT_BINARY_DIR}/$(ConfigurationName)/generated.txt"
 DEPENDS "${PROJECT_SOURCE_DIR}/myfile.txt"
 )

If I specify for
OUTPUT "${PROJECT_BINARY_DIR}/generated.txt"
instead of
OUTPUT "${PROJECT_BINARY_DIR}/$(ConfigurationName)/generated.txt" it works.
I tested with cmake 2.8.2 . I used out of source build.
No tags attached.
rar Test.rar (47,531) 2010-09-29 11:01
https://public.kitware.com/Bug/file/3416/Test.rar
zip Test2.zip (1,950) 2010-09-29 15:07
https://public.kitware.com/Bug/file/3418/Test2.zip
Issue History
2010-09-29 11:01ElizabetaNew Issue
2010-09-29 11:01ElizabetaFile Added: Test.rar
2010-09-29 11:12Bill HoffmanNote Added: 0022382
2010-09-29 11:12Bill HoffmanStatusnew => assigned
2010-09-29 11:12Bill HoffmanAssigned To => Bill Hoffman
2010-09-29 11:13Bill HoffmanNote Added: 0022383
2010-09-29 11:13Bill HoffmanNote Edited: 0022382
2010-09-29 11:13Bill HoffmanNote Deleted: 0022383
2010-09-29 15:07ElizabetaFile Added: Test2.zip
2010-09-29 15:08ElizabetaNote Added: 0022384
2010-09-29 17:05Bill HoffmanNote Added: 0022386
2010-10-06 13:38David ColeNote Added: 0022418
2010-10-06 13:38David ColeStatusassigned => resolved
2010-10-06 13:38David ColeFixed in Version => CMake 2.8.3
2010-10-06 13:38David ColeResolutionopen => fixed
2010-10-06 13:38David ColeTarget Version => CMake 2.8.3
2010-10-06 13:38David ColeAdditional Information Updated
2010-11-09 22:57Philip LowmanStatusresolved => closed

Notes
(0022382)
Bill Hoffman   
2010-09-29 11:12   
(edited on: 2010-09-29 11:13)
Can you use zip or tar? I don't have a rar reader. Also, not sure why the file is SO big. Should only be a CMakeLists.txt file with a minimal example. No object code please.

(0022384)
Elizabeta   
2010-09-29 15:08   
I added Test2.zip with the cmakelists.txt file and vs2010 generated project file.
(0022386)
Bill Hoffman   
2010-09-29 17:05   
OK, I reproduced it and have a fix that is in CMake next. As a work around for this issue if you use the MAIN_DEPENDENCY option like this:

 MAIN_DEPENDENCY "${PROJECT_SOURCE_DIR}/myfile.txt"

It will get around the problem.
(0022418)
David Cole   
2010-10-06 13:38   
In CMake 2.8.3-rc2