[CMake] How to skip steps and use default values in ExternalProject_Add command?

Cedric Doucet cedric.doucet at inria.fr
Thu May 21 07:10:04 EDT 2015


Hello, 

I would like to loop on a list of libraries to download and install, by calling the ExternalProject_Add command for each of these libraries. 
To do that, I need to define some commands for each library, like CONFIGURE_COMMAND, BUILD_COMMAND and INSTALL_COMMAND. 
These commands may differ from one library to another; for example, some of them may be based on make, or autoconfig, or cmake, etc. 
Furthermore, some of these libraries may not need to be built. 

What is the good way to skip some steps? 
Is it possible to use default values for some commands? 

The problem in my situation is that I have to fill in each command since I want to design way of downloading and installing third party libraries. 
To be clear, I wrote a loop which looks like this: 

========================================================================== 
foreach(LIBRARY IN LISTS NOT_FOUND_LIBRARIES) 
ExternalProject_Add(${${LIBRARY}_LOWERNAME} 
PREFIX ${${LIBRARY}_PREFIX} 
URL ${${LIBRARY}_URL} 
CONFIGURE_COMMAND ${${LIBRARY}_CONFIGURE_COMMAND} 
BUILD_COMMAND ${${LIBRARY}_BUILD_COMMAND} 
INSTALL_COMMAND ${${LIBRARY}_INSTALL_COMMAND} 
) 
endforeach(LIBRARY) 
========================================================================== 

However, if a library is based on cmake, I do not need to specify commands for configuration and building. 
Is it possible to say that the default value of CONFIGURE_COMMAND will be used for example? 
The only way I know to do that is to suppress the line defining CONFIGURE_COMMAND but I can't do that since other libraries may need to define it. 

To skip steps, I replace the corresponding command by 'ls' but it's not very clean. 
That is to say, the value of ${LIBRARY}_CONFIGURE_COMMAND is 'ls' when I want to skip the configuration step. 

Thank you very much for your help. 

Cédric 

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


More information about the CMake mailing list