[CMake] ExternalProjects: How do ExternalProject_add and ExternalProject_Add_Step interact?
kent williams
nkwmailinglists at gmail.com
Fri Apr 23 12:44:21 EDT 2010
Answering my own question -- I think. This maybe is information that
could be added to the documentation for ExternalProjects.cmake!
ExternalProject_Add creates a project, e.g.
ExternalProject_Add(tcl
CVS_REPOSITORY ":pserver:anonymous:@tcl.cvs.sourceforge.net:/cvsroot/tcl"
CVS_TAG -r core-8-5-7
CVS_MODULE "tcl"
CONFIGURE_COMMAND
${BRAINSTracer_BINARY_DIR}/tcl-prefix/src/tcl/unix/configure
--prefix=${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}
UPDATE_COMMAND ""
)
When the generated makefiles actually build the project, there's a
directory named
${CMAKE_CURRENT_BINARY_DIR}/tcl-prefix/src/tcl-stamp
In which a 0-length file is created after each step of the external
project build is successfully finished. These files (and THIS is what
was undocumented, that I had to determine by poking around in the
build directories) are named
${proj}-mkdir ${proj}-download ${proj}-update ${proj}-patch
${proj}-configure ${proj}-build ${proj}-install ${proj}-done
Where 'proj' is the name you've given the ExternalProject. So in
order to add a step you have to list the steps your new custom step
depends on, after the DEPENDEES keyword. For example:
if(APPLE)
set(SHARED_LIB_EXT .dylib)
else(APPLE)
set(SHARED_LIB_EXT .so)
endif(APPLE)
ExternalProject_Add_Step(${proj} after_install
COMMAND chmod u+w ${BRAINSTracer_BINARY_DIR}/lib/libtcl8.5${SHARED_LIB_EXT}
COMMENT "----------------------
${BRAINSTracer_BINARY_DIR}/lib/libtcl8.5.so installed read-only!"
DEPENDEES mkdir update patch download configure build install
)
Now it appears that you have to list ALL the prerequisite steps, not
just the one after which your step should occur.
More information about the CMake
mailing list