[CMake] evaluate a generator experssion

Biddiscombe, John A. biddisco at cscs.ch
Wed Jan 14 07:26:55 EST 2015


Nils

Marvellous. Just what I needed. Works like a charm. and only 5 minutes between posting my question and getting the answer.

Many thanks indeed

JB



From: Nils Gladitz [mailto:nilsgladitz at gmail.com]
Sent: 14 January 2015 13:17
To: Biddiscombe, John A.; cmake at cmake.org
Subject: Re: [CMake] evaluate a generator experssion

On 14.01.2015 13:11, Biddiscombe, John A. wrote:

file(WRITE "stuff containing above string")

the file is written with   "$<TARGET_FILE:hg_test_server<FILE:///\\hg_test_server>>" inside it, and not the full path/name of the target as I'd hoped.

Is there a way to force the evaluation of the generator expression so it is correctly written out into the launch script?


file(WRITE) is run at configuration time. Generator expressions are evaluated after configuration has finished (at generation time).
You can use file(GENERATE) to create files with generator expressions expanded at generation time.

Nils
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150114/4453ccfd/attachment-0001.html>


More information about the CMake mailing list