[CMake] INCLUDE_DIRECTORIES and UNIX style separated environment variables

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Sep 18 12:03:14 EDT 2007


On 2007-09-18 17:35+0200 BlinkEye wrote:

> Hi guys
>
> I'm not able to convince cmake to properly use an environment variable which
> consists of more than one entry for the INCLUDE_DIRECTORIES directive. It always
> takes the value as it is:
>
> Passing
>
> MY_SPECIAL_INCLUDE32=/foo/bar/32bit/include:/foo/bar/include
>
> to INCLUDE_DIRECTORIES like
>
> INCLUDE_DIRECTORIES( "$ENV{MY_SPECIAL_INCLUDE32}" )
>
> results in
>
> /usr/bin/c++ -I/foo/bar/32bit/include:/foo/bar/include ...
>
> instead of
>
> /usr/bin/c++ -I/foo/bar/32bit/include -I/foo/bar/include ...
>

What happens if you use the correct CMake list delimiter ";" rather than ":"
to separate the two include directories?  IOW, as a test try

INCLUDE_DIRECTORIES("/foo/bar/32bit/include;/foo/bar/include")

I haven't tried that, but it may work.

If that works, then you could (a) ask your users to use a
semicolon-separated list of directories (which is probably a little
confusing and unnatural for them) or (b) continue with a colon-separated
environment variable, but transform it in CMake with STRING to replace ":" by
";" before using it as a list.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.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 mailing list