Hello, 

I try to wrote a function DownloadThenInstall which calls the 
ExternalProject_Add function after havind defined useful variables like prefix, 
download_dir, etc. 

I would like to call it like this 
DownloadThenInstall(Eigen) 
to download and install the Eigen library (for example). 

But it doesn't work unless I change the call to 
DownloadThenInstall(${Eigen}) 

Below is the core of the function. 
In the first call of DownloadThenInstall, name and url are empty. 
In the second call of DownloadThenInstall, name and url have the right values. 

How could I modify my script in order to make the first call, 
DownloadThenInstall(Eigen), work? 

Thank you very much! 

Cédric 

-------------------- 



function(DownloadThenInstall LIBRARY_NAME) 




string(TOLOWER ${LIBRARY_NAME} LIBRARY_LOWERNAME) 
string(TOUPPER ${LIBRARY_NAME} LIBRARY_UPPERNAME) 




#=================================== 

# define useful variables for ExternalProject_Add 

#=================================== 

set(${LIBRARY_UPPERNAME}_PREFIX ${EXTERNAL_DIR}/${LIBRARY_LOWERNAME} ) 
set(${LIBRARY_UPPERNAME}_DOWNLOAD_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/download) 
set(${LIBRARY_UPPERNAME}_SOURCE_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/src) 
set(${LIBRARY_UPPERNAME}_BINARY_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/build) 
set(${LIBRARY_UPPERNAME}_TMP_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/tmp) 
set(${LIBRARY_UPPERNAME}_STAMP_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/stamp) 
set(${LIBRARY_UPPERNAME}_INSTALL_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/install) 



#==================================== 

# messages for debugging purpose (to be removed) 

#==================================== 

message(STATUS "name: ${LIBRARY_NAME}") 
message(STATUS "url: ${${LIBRARY_NAME}_URL}") 




#===================== 

# call to ExternalProject_Add 

#===================== 




endfunction(DownloadThenInstall) 

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to