[CMake] DESTDIR and ExternalProject

Magnus Therning magnus at therning.org
Fri Oct 9 07:42:34 EDT 2015


How can I refer to an environment variable in a generator-agnostic way?


I'm struggling with constructing a functioning install command when
using ExternalProject.  I want to allow the following sequence of
commands:

    % cmake ..
    % make
    % make DESTDIR=foo install

The issue I run into is that I somehow have to pass DESTDIR from the
environment into the install command of my ExternalProject, but how do I
do that?

$ENV{DESTDIR} gets expanded at generation time, which is too early.  I
can use $(DESTDIR), CMake happily passes that through and it works with
GNU make.  However, it doesn't work with e.g. Ninja (to pick just one).

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus

Don't worry about other people stealing your ideas. If your ideas are
any good, you’ll have to ram them down people's throats.
     -- Howard Aiken, IBM Engineer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151009/033ba6c1/attachment.sig>


More information about the CMake mailing list