[CMake] Hint on usage of ExternalProject_Add

Luigi Calori l.calori at cineca.it
Fri Feb 5 06:41:34 EST 2010


Hi everybody, first sorry for the long intro,

<SKIP>

I' m trying to build up a project that assembles different components, 
all open source and portable.
The main component is OpenSceneGraph that heavily relies on FindXXX to 
do configure time inspection and conditionally build plug ins.
I am trying to build up an application (browser plug in) that bundles my 
code,  OSG, and other plugins and their deps.
I have to pack it as a package that has as few external deps as 
possible, so i would like either to build static or to provide most of 
the dll/so I would also provide a transparent and easy way to build the 
package from original upstream sources of components: sou would like to 
restrict at minimum inclusion of externally build binary components.
For these reasons I have started to look at recently added  
ExternalProject_Add macro
As the deps are quite few and change in versions, way of building, etc 
etc, I was thinking to organize them in separate folders, specific for 
dep and version, placing each ExternalProject_Add into an individual 
CMakeLists.txt, alongside with Patch files and so on.
All the installation step of ExternalProject_Add should put stuff in a 
common place that should be searched first by FindXXX or configure
Any comment or hint for the whole task really welcome, I' ve also used 
and borrowed code  from cmakeports project on google code, that seem on 
hold now and somehow superseded by ExternalProject approach
Now some specific questions

<SKIP>

some examples of ExternalProject_Add usage

Hints on deal with download-unpack-patch to separate the source 
assembling phase to the build phase,
 (currently, visual studio projects issues re-download,unpack and patch 
when switching from Release to Debug)

How to force FindXXX commands to search FIRST in my install place and 
AFTER on system places:
i have added
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_PREFIX_PATH:PATH=<INSTALL_DIR>
to CMAKE_ARGS, it is working on windows but on Linux, for example, 
find_package(ZLIB )
get include from <INSTALL_DIR> and ZLIB_LIBRARY from /usr/lib64

Thanks a lot in advance

Luigi




More information about the CMake mailing list