[CMake] Using ExternalProject_Add
Eric Noulard
eric.noulard at gmail.com
Thu Dec 29 14:12:21 EST 2011
2011/12/29 Ryan Lewis <me at ryanlewis.net>:
[...]
>
> Also I cannot get the ExternalProject_Add() module to work properly.
>
> include(ExternalProject)
> ExternalProject_Add( JPEG
> PREFIX ${CURRENT_SOURCE_DIR}
CURRENT_SOURCE_DIR is probably a typo:
you certainly mean:
CMAKE_CURRENT_SOURCE_DIR
[...]
> This command is also creating a folder structure called JPEG-prefix
> which does not seem to contain relevant/useful content..
>
> What am I doing wrong?
The typo, ${CURRENT_SOURCE_DIR} evaluate to empty string "".
try that:
include(ExternalProject)
ExternalProject_Add(MyZLib
PREFIX "/tmp/TestZlib/1.2.5"
URL "http://zlib.net/zlib-1.2.5.tar.bz2"
URL_MD5 "be1e89810e66150f5b0327984d8625a0"
PATCH_COMMAND ${CMAKE_COMMAND} -E remove -f
<SOURCE_DIR>/zconf.h
CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=/tmp/TestZlib/1.2.5/installed"
)
it should download and locally install zlib during the first build.
Note that you cannot use ExternalProject_Add in order to download & build
a local dependency of the currently built project because it will be invoked
**at build time** so that at CMake **first-time** (when you configure
your project for the first time)
the external project is not build yet.
I suggest you read at least some mailing threads about ExternalProject_Add usage
they should be enlightening:
http://www.cmake.org/pipermail/cmake/2011-September/046423.html
http://www.cmake.org/pipermail/cmake/2011-September/046233.html
http://www.cmake.org/pipermail/cmake/2011-September/046360.html
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list