[CMake] ExternalProject: how to avoid reinstalling after 'make clean'?

Cedric Doucet cedric.doucet at inria.fr
Fri Apr 24 05:35:54 EDT 2015


Hello, 

I use the ExternalProjet_Add function to download and install third-party libraries. 
Here is an example of a CMakeLists file containing such a call: 

===================================== 
cmake_minimum_required (VERSION 2.6) 

project (example CXX) 

set(CMAKE_VERBOSE_MAKEFILE ON) 

include(ProcessorCount) 
ProcessorCount(N) 
if(NOT N EQUAL 0) 
set(CMAKE_BUILD_FLAGS -j${N}) 
endif() 

include(ExternalProject) 
set(EXTERNAL_DIR ${CMAKE_CURRENT_BINARY_DIR}) 
ExternalProject_Add(eigen 
PREFIX ${EXTERNAL_DIR}/eigen 
DOWNLOAD_DIR ${EXTERNAL_DIR}/eigen/download 
SOURCE_DIR ${EXTERNAL_DIR}/eigen/src 
BINARY_DIR ${EXTERNAL_DIR}/eigen/build 
STAMP_DIR ${EXTERNAL_DIR}/eigen/stamp 
INSTALL_DIR ${EXTERNAL_DIR}/eigen/install 
URL http://bitbucket.org/eigen/eigen/get/3.2.4.tar.gz 
URL_MD5 4d0d77e06fef87b4fcd2c9b72cc8dc55 
CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=<INSTALL_DIR> 
) 

===================================== 

Everything works fine, except after calling "make clean". 
Thanks to URL_MD5, the third-party library is not downloaded again. 
However, configuration, build and install steps are performed again whereas the library has not been uninstalled during cleaning. 

How could I tell to ExternalProject_Add not to configure/build/install my library unless this library has been removed from my computer? 

Thank you very much for your help! 

Cédric 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150424/a8a0722c/attachment.html>


More information about the CMake mailing list