[cmake-developers] Possible feature request concerning conditional linking support by generator expressions
Alan W. Irwin
Alan.W.Irwin1234 at gmail.com
Wed Sep 25 02:15:24 EDT 2019
On 2019-09-24 14:02-0700 Alan W. Irwin wrote:
[...]
> I. Possible feature request
>
> After reading through the generator-expression documentation at
> <https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html>
> it appears for my use case (see below) I need generator expressions of
> the form
>
> $<$<NOT:$<LINK_LANGUAGE:D>>:-pthread>
> $<$<LINK_LANG_AND_ID:D,gdc>:-pthread>
> $<$<LINK_LANG_AND_ID:D,ldc2>:-Xcc-pthread>
> $<$<LINK_LANG_AND_ID:D,dmd>:libbasename> (where libbasename is likely
> pthread)
>
To follow up, I have just been informed on one of the dmd mailing
lists that the dmd developers have implemented an option in a
pre-release version of dmd 2.088.0 that will change the semantics of
-L so that dmd with that option (-preview=noXlinker) will interpret
-L-pthread as a request to pass that -pthread option on to the C
compiler used internally by dmd for linking. So when I implement this
fixed -preview=noXlinker option in PLplot's fork of the cmake-d dmd D
language support it appears the above dmd example of my possible
feature request above would change to
$<$<LINK_LANG_AND_ID:D,dmd>:-L-pthread>
And similarly I would use -L-pthread for dmd in my proposed workaround for
the lack of such generator-expressions right now.
In sum, some substantial uncertainty about how to handle the -pthread
option for the dmd case is now gone, but the question still persists
about whether I will always have to use the proposed messy workaround
(which requires building an extra variant of the PLplot library) or
whether I can look forward to someone implementing the above generator
expressions which would provide a neat solution to the -pthread
linking issue I have described.
Alan
__________________________
Alan W. Irwin
Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.org); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the cmake-developers
mailing list