According to documentation, ExternalProject_Add
sets unset directory variables itself.
If any of the above ..._DIR options are not specified, their defaults are computed as follows. If the PREFIX option is given or the EP_PREFIX directory property is set, then an external project is built and installed under the specified prefix:
TMP_DIR = <prefix>/tmp STAMP_DIR = <prefix>/src/<name>-stamp DOWNLOAD_DIR = <prefix>/src SOURCE_DIR = <prefix>/src/<name> BINARY_DIR = <prefix>/src/<name>-build INSTALL_DIR = <prefix>
In the following example I want to add COIN-OR-CLP as an external project with a custom CONFIGURE_COMMAND
because CLP uses Autotools. This works.
include(ExternalProject)
ExternalProject_Add(${EXT_PROJ}
PREFIX ${EXT_PROJ}
SVN_REPOSITORY https://projects.coin-or.org/svn/Clp/stable/1.16/
UPDATE_COMMAND svn cleanup # Beause otherwise svn will fail on consecutive runs
CONFIGURE_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${EXT_PROJ}/${EXT_PROJ}/src/${EXT_PROJ}/configure
)
However I think it'd be cleaner to use the generated paths instead manually passing it.
Is there a way to use ${SOUCRE_DIR}
in ExternalProject_Add
without setting it explicitly?
All directories you refer to can be used in
ExternalProject_Add
COMMAND's with<...>
notation:For some reason, this feature is described at the end of
ExternalProject_Add_Step
function's description, not in the functionExternalProject_Add
.