[CMake] ExternalProject and hardwired "src" directory
Theodore Papadopoulo
Theodore.Papadopoulo at inria.fr
Mon Mar 11 08:29:24 EDT 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/11/2013 01:06 PM, Luc J. Bourhis wrote:
> Ansis Māliņš wrote
>
> The problem is that I have more than a dozen targets added with
> ExternalProject_Add. How would I factor out such a change in one
> place and one place only?
Use a function like:
function(SetExternalProjectsDirs prefix varname)
set(DIR_VAR_NAMES DOWNLOAD BINARY STAMP INSTALL TMP)
set(DIR_NAMES "" build stamp install tmp)
set(dirs PREFIX ${prefix})
foreach(i RANGE 4)
list(GET DIR_VAR_NAMES ${i} var)
list(GET DIR_NAMES ${i} dir)
set(dirs ${dirs} ${var}_DIR ${prefix}/${dir})
endforeach()
if (NOT ${USE_LOCAL_SOURCES})
set(dirs ${dirs} SOURCE_DIR ${prefix}/src)
endif()
set(${varname} ${dirs} PARENT_SCOPE)
endfunction()
SetExternalProjectsDirs(MyProject dirs)
ExternalProject_Add(MyProject
${dirs}
....)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlE9ziQACgkQEr8WrU8nPV0siwCguLmjyL9reMLCSZHDKNSb6+Mr
MfMAnRSXAM//M8wQBBwvRLH/cC0QOtUb
=UsMH
-----END PGP SIGNATURE-----
More information about the CMake
mailing list