[CMake] ADD_CUSTOM_TARGET not behaving as advertized?

Chris Green chissg at comcast.net
Tue Aug 2 18:46:33 EDT 2005


Hi,

I'm using CMake out of CVS (as of today: I updated to make sure).

In a subdirectory under my build tree, I have an included fragment that
says:

ADD_CUSTOM_TARGET ( bin all )

This includes another fragment that says:

MACRO ( SCRIPTS )
   FOREACH ( script ${ARGV} )
     GET_FILENAME_COMPONENT ( script_name
       ${script}
       NAME
       )
     ADD_CUSTOM_COMMAND (
       OUTPUT ${EXECUTABLE_OUTPUT_PATH}/${script_name}
       MAIN_DEPENDENCY ${script}
       COMMAND ${CMAKE_COMMAND} -E copy
       ${script}
       ${EXECUTABLE_OUTPUT_PATH}/${script_name}
       COMMENT Installing ${script_name} in binary area
       )
     ADD_DEPENDENCIES ( bin
       ${EXECUTABLE_OUTPUT_PATH}/${script_name}
       )
     IF ( RELEASE_BUILD )
       INSTALL_PROGRAMS ( /bin FILES ${ARGV} )
     ENDIF ( RELEASE_BUILD )
   ENDFOREACH ( script ${ARGV} )
ENDMACRO ( SCRIPTS )

... and then I use it, viz:

VLAND_SCRIPTS ( ${CMAKE_CURRENT_SOURCE_DIR}/newpkg )

I expect this, when I type "cmake ; make", to install the script newpkg
in ${EXECUTABLE_PATH}. Yes yes, I know there's an "INSTALL_PROGRAMS",
but in my build system there's a distinction between the developer's
area where he may have one or more packages checked out, and the release
area (see RELEASE_BUILD) which only gets done by the build manager. I
want the scripts to be put into the build area's bin directory for the
developer, as distinct from whatever the "make install" operation might do.

So, what happens?

cmake ; make

blithely ignores newpkg and never attempts to make it, but make clean
(as evidenced by a verbose build) attempts to remove it.

What am I doing wrong, please? Why isn't the newpkg script being
installed as a dependency of the dummy bin target, which should always
be made as part of all?

Many thanks,
Chris.

-- 
Chris Green, MiniBooNE / LANL. Email greenc at fnal.gov
Tel: (630) 840-2167. Fax: (630) 840-3867


More information about the CMake mailing list