MantisBT - CMake
View Issue Details
0011713CMakeCMakepublic2011-01-17 10:262011-01-17 10:56
Galeazzi 
Brad King 
normalmajoralways
closedno change required 
PCWindows XP
CMake 2.8.3 
 
0011713: add_custom_command is not invoked
I use the add_custom_command function in order to increment the build number. It seems that add_custom_command is never invoked in the build process.
You just unzip the attached file and generate a mingw makefiles or VS solution. You can also change the following line in order to fit them with your paths:
add_custom_command(OUTPUT ./BuildNumber.h COMMAND "java" ARGS "-jar"
                                        "c:\\Tools\\Updater\\BuildNumberUpdater.jar"
                                        "M:\\ProvaCMake\\HelloExec\\BuildNumber.h"
                                        DEPENDS ${SOURCES}
                                        COMMENT "Changing the build number")
No tags attached.
rar CMakeBug.rar (3,965) 2011-01-17 10:26
https://public.kitware.com/Bug/file/3636/CMakeBug.rar
zip add_custom_ok.zip (5,301) 2011-01-17 10:44
https://public.kitware.com/Bug/file/3637/add_custom_ok.zip
Issue History
2011-01-17 10:26GaleazziNew Issue
2011-01-17 10:26GaleazziFile Added: CMakeBug.rar
2011-01-17 10:31GaleazziNote Added: 0024752
2011-01-17 10:44Eric NOULARDFile Added: add_custom_ok.zip
2011-01-17 10:50Eric NOULARDNote Added: 0024754
2011-01-17 10:56Brad KingNote Added: 0024755
2011-01-17 10:56Brad KingStatusnew => closed
2011-01-17 10:56Brad KingAssigned To => Brad King
2011-01-17 10:56Brad KingResolutionopen => no change required

Notes
(0024752)
Galeazzi   
2011-01-17 10:31   
You can also take a look at:
http://www.mail-archive.com/cmake@cmake.org/msg33903.html [^]
(0024754)
Eric NOULARD   
2011-01-17 10:50   
I think this is not a bug.
I did just upload "add_custom_ok.zip" which contains an updated project
which should work, the fix are the following:

0) Use absolute PATH for GENERATED files
   Use relative PATH (with no extra "./" in the beginning)
       for other files.
   
1) separate SOURCES from GENERATED_SOURCES in order to
   avoid the circular dependency

The updated project works for me on Linux.
The project still have the weird
add_subdirectory(../myLib "${Lib_OutPut_Dir}/BuildFiles")

this if off course OK but I would expect either myLib to be a
subdir of HelloExec or a sibling which is built by some
mother CMakeLists.txt.
(0024755)
Brad King   
2011-01-17 10:56   
As Eric stated in 0011713:0024754 this is not a bug. Please post the the cmake@cmake.org mailing list:

  http://www.cmake.org/mailman/listinfo/cmake [^]

for further help in writing your CMake code.

Thanks.