[CMake] CMake 2.1 CUSTOM_COMMAND and CUSTOM_TARGET

Marco PETRONE m.petrone at cineca.it
Fri Apr 22 06:08:15 EDT 2005


Daer developers, I'm facing problems with CMake 2.1 and a custom command/target
I'm using to automatized libraries compilation in our project. The commands
having problems are the following:

ADD_CUSTOM_COMMAND(OUTPUT
"${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}vtkCommon${CMAKE_STATIC_LIBRARY_SUFFIX}"
                     COMMAND ${CMAKE_COMMAND}
                     ARGS 
                     -DMY_BUILD_PATH:STRING=${CMAKE_CFG_INTDIR} 
                     -P ${VTK_BINARY_DIR}/build.cmake 
                     MAIN_DEPENDENCY ${VTK_BINARY_DIR}/build.cmake
                     COMMENT "Custom command used to build VTK library")
      ADD_CUSTOM_TARGET(BUILD_VTK_LIBRARY ALL DEPENDS
"${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}vtkCommon${CMAKE_STATIC_LIBRARY_SUFFIX}"
)

This was used to automatize compilation of VTK library coming within the project
distribution. The custom target is then linked to project's targets requiring
VTK with an ADD_DEPENDENCIES(). This syntax is working perfectly under win and
linux until CMake 2.0.6. Under linux, to take advantage of KDevelop generators,
we  are experimenting CMake 2.1, but after a recent update this is not working
any more: when compiling "make" complains it does not know how to build
"libvtkCommon.a" required by given custom target.
I tracked last update after which it's not working any more to 4-4-05. Is this a
change in the supported syntax of CMake? or could this be a bug?

By the way I noticed the following systax which was not working properly in the
(long) past seems to work ok now:

ADD_CUSTOM_TARGET(BUILD_VTK_LIBRARY ALL COMMAND ${CMAKE_COMMAND}
-DMY_BUILD_PATH:STRING=${CMAKE_CFG_INTDIR} -P ${VTK_BINARY_DIR}/build.cmake )

but this tries to compile anytime, even if the library is already present.

Thanks for any help,

Marco



More information about the CMake mailing list