[CMake] Pass PATH to ExternalProject_Add

Joke de Buhr joke at seiken.de
Tue Nov 30 09:04:10 EST 2010


Hi,

I added some ExternalProject_Add directives to my project. Each of them runs 
the sequence of configure, make all, make install. Later projects need run 
commands generated in early projects during their build phases.

Each project installs generated files at the place ${BUILD_DIR} which is set 
at the top of the cmake file and passed down to the configure command. I tried 
setting ENV{PATH} to include the directory ${BUILD_DIR}/bin but cmake doesn't 
pass the changed environment variable down to the ExternalProject_Add 
directives. Since the changed environment isn't passed down later projects 
don't look for generated commands in ${BUILD_DIR}/bin.

How can I pass down the PATH environment to ExternalProject_Add?


CMakeLists.txt:


set(BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/build")
set(ENV{PATH} "${CMAKE_CURRENT_BINARY_DIR}/build/bin")

ExternalProject_Add(project0
    CONFIGURE_COMMAND ./configure --prefix=${BUILD_DIR}
    BUILD_IN_SOURCE 1
)

ExternalProject_Add(project1
    DEPENDS project0
    CONFIGURE_COMMAND ./configure --prefix=${BUILD_DIR}
    BUILD_IN_SOURCE 1
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 706 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101130/65f9b102/attachment.pgp>


More information about the CMake mailing list