[CMake] Custom command not honoured

Matthew Smith indigojo at blogistan.co.uk
Sat Oct 6 08:25:02 EDT 2007


Hi everyone,

I'm having problems getting a shell script I've written to generate a
freedesktop.org desktop entry file during the build process.  I've tried
using execute_process and add_custom_command, and neither seem to have
any effect.  Here is the code snippet:

if( UNIX AND NOT APPLE )
  if( NOT DESKTOP_ENTRY ) # i.e. if a filename isn't specified
    set( DESKTOP_ENTRY qtm.desktop )
  endif( NOT DESKTOP_ENTRY )
#  execute_process(
#    COMMAND touch ${CMAKE_CURRENT_BUILD_DIR}/${DESKTOP_ENTRY}
#    COMMAND ${CMAKE_CURRENT_BUILD_DIR}/qtm-desktop.sh
${CMAKE_INSTALL_PREFIX} >${CMAKE_CURRENT_BUILD_DIR}/${DESKTOP_ENTRY}
#    OUTPUT_FILE ${CMAKE_CURRENT_BUILD_DIR}/${DESKTOP_ENTRY}
#  )
  add_custom_command(
    OUTPUT ${CMAKE_CURRENT_BUILD_DIR}/${DESKTOP_ENTRY}
    COMMAND touch ${CMAKE_CURRENT_BUILD_DIR}/${DESKTOP_ENTRY}
    COMMAND ${CMAKE_CURRENT_BUILD_DIR}/qtm-desktop.sh
${CMAKE_INSTALL_PREFIX} >${CMAKE_CURRENT_BUILD_DIR}/${DESKTOP_ENTRY}
    COMMENT Generating desktop entry file
  )

(It passes CMAKE_INSTALL_PREFIX to the script so that the correct
location for the executable can be written to the .desktop file.)

The full file can be viewed here:

http://catkin.svn.sourceforge.net/viewvc/catkin/branches/qtm-0.5.5/CMakeLists.txt?revision=164&view=markup&pathrev=164

The custom command simply isn't being run, and the Makefile shows no
target relating to this custom command.  Does the output file have to be
added to a target to be run?  Otherwise, what am I doing wrong here?

Regards,

Matt Smith

-- 

http://qtm.blogistan.co.uk/


More information about the CMake mailing list