[CMake] Possible bug in environment variable expansion?

Chris Volpe ARA/SED cvolpe at ara.com
Tue Aug 12 15:37:47 EDT 2014


As it turns out, something weirder is going on, and it's not cmake's fault, so I won't look for a solution here, but I'll describe the problem in case anyone's interested. *Windows* is not expanding those environment variables. First, I hacked up the installed version of FindBoost.cmake to spit out some debugging information, with the following, circa line 860:

  message(DEBUG "_ENV_BOOST_LIBRARYDIR has value <${_ENV_BOOST_LIBRARYDIR}>")

and then I ran configure in debug mode, which gave me the following from my extra hacked debugging output:

DEBUG_ENV_BOOST_LIBRARYDIR has value <%BOOST_ROOT%/lib64-msvc-12.0>

So, when cmake asked the OS for the BOOST_LIBRARYDIR environment variable, the OS gave it the string without expanding BOOST_ROOT. I have verified this OS behavior by opening up a command window and using the set command: It's not getting expanded. I've verified (with RapidEE) that the environment variables in question are of type "expandable string", not "string".

While playing with the variables in RapidEE (a wonderful tool, BTW), I noticed two other strange things. First, I do have a couple of env vars that do have other env var references in them, and they *do* get expanded in cmd.exe. Second, my PATH env var used to have embedded env vars for various things, but somewhere along the way they all got replaced in the PATH *definition* with their expanded versions, so now everything in my path is now "hard coded", so to speak. Ugh.

So, basically, something is messed up in my system.


From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Chris Volpe ARA/SED
Sent: Tuesday, August 12, 2014 12:44 PM
To: Lucas.Pettey at engilitycorp.com; cmake at cmake.org
Subject: Re: [CMake] Possible bug in environment variable expansion?

That's a good thought, but unfortunately it didn't pan out. I tried both styles, and I even tried explicitly mixing styles like this:

BOOST_LIBRARYDIR=C:/local/boost_1_55_0\lib64-msvc-12.0

Or this:

BOOST_LIBRARYDIR=C:\local\boost_1_55_0/lib64-msvc-12.0

And those worked fine.

From: Lucas.Pettey at engilitycorp.com [mailto:Lucas.Pettey at engilitycorp.com]
Sent: Monday, August 11, 2014 11:03 PM
To: Chris Volpe ARA/SED; cmake at cmake.org
Subject: RE: Possible bug in environment variable expansion?

Could it be something as simple as UNIX (slash /) vs Windows (backslash \) in the directory expression?

When this environment variable is expanded BOOST_LIBRARYDIR=%BOOST_ROOT%\lib64-msvc-12.0, it looks like it is converting the %BOOST_ROOT% in UNIX style and then the "\lib-msvc-12.0" is Windows. This mixture of styles may be causing a "no such directory" system error. I know on Windows systems I need to be consistent with directory styles or it fails.

Lucas Pettey, PhD
HPCMP PETTT EQM CTA Lead
ERDC-DSRC OnSite
Vicksburg, MS
512-297-9833 Mobile (preferred)
601-634-2980 Office
lucas.pettey at engilitycorp.com<mailto:lucas.pettey at engilitycorp.com>
________________________________
From: CMake [cmake-bounces at cmake.org] on behalf of Chris Volpe ARA/SED [cvolpe at ara.com]
Sent: Monday, August 11, 2014 6:25 PM
To: cmake at cmake.org
Subject: [CMake] Possible bug in environment variable expansion?
I am trying to build an Open Source project called PCL which uses Boost, and CMake's ability to find the Boost libraries seems dependent on whether the BOOST_LIBRARYDIR contains a literal path string, or whether it contains a string that incorporates the expansion of BOOST_ROOT. Here are the details:

Boost is installed from a pre-built installer in the folder C:\local\boost_1_55_0. This folder contains, among other things, a subfolder called "boost", which contains the headers, and a subfolder called "lib64-msvc-12.0", which contains 64-bit libraries built with MS Visual Studio 2013. Ordinarily, CMake would like that folder to be called simply "lib", but that's not what the installer created, so I'm trying to override the default with environment variables. I have the following three environment variables defined, all of which are of type "Expandable string":

BOOST_ROOT=C:\local\boost_1_55_0
BOOST_INCLUDEDIR=%BOOST_ROOT%
BOOST_LIBRARYDIR=%BOOST_ROOT%\lib64-msvc-12.0

With these settings, CMake reports an error during the configuration process, as follows:

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.0/Modules/FindBoost.cmake:1179 (message):
Unable to find the requested Boost libraries.

Boost version: 1.55.0

Boost include path: C:/local/boost_1_55_0

Could not find the following Boost libraries:

boost_system
boost_filesystem
boost_thread
boost_date_time
boost_iostreams
boost_chrono

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
cmake/pcl_find_boost.cmake:38 (find_package)
CMakeLists.txt:230 (include)

But if change the definition of BOOST_LIBRARYDIR by replacing "%BOOST_ROOT%" with the value assigned to BOOST_ROOT, resulting in this:
BOOST_LIBRARYDIR=C:\local\boost_1_55_0\lib64-msvc-12.0
the configuration succeeds. The only difference seems to be whether the "C:\local\boost_1_55_0" part of the path is specified explicitly, or obtained implicitly with %BOOST_ROOT%. It would surprise me if this behavior were by design. Does anyone have an explanation for this?

Thanks,
Chris


Christopher R. Volpe, Ph.D.
Senior Scientist, Remote Sensing & Decision Analytics

[Description: Description: Description: cid:image003.png at 01CE888B.0167BAD0]
NATIONAL SECURITY  |  INFRASTRUCTURE  |  ENERGY & ENVIRONMENT  |  HEALTH SOLUTIONS
Applied Research Associates, Inc.
8537 Six Forks Road, Suite 600, Raleigh, NC 27615  |  T 919.582.3380  |  F 919.582.3301

Find Us Online
www.ara.com<http://www.ara.com>
Facebook: Applied Research Associates<https://www.facebook.com/#!/AppliedResearchAssociates>
LinkedIn: Company Page<http://www.linkedin.com/company/8853?trk=tyah>
LinkedIn Group<http://www.linkedin.com/groups/ARA-Employees-Group-4854334?trk=myg_ugrp_ovr>
Twitter: ARA News<https://twitter.com/ARA_News_Events>
YouTube:  Applied Research Associates<http://www.youtube.com/user/AppliedResearch1?feature=mhee>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140812/4343cdf3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 9687 bytes
Desc: image001.png
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140812/4343cdf3/attachment-0001.png>


More information about the CMake mailing list