[CMake] FIND_FILE won't find file if path is semi-colon delimited
William A. Hoffman
billlist at nycap.rr.com
Tue May 9 17:59:07 EDT 2006
At 05:22 PM 5/9/2006, Phillip Hellewell wrote:
>Hi,
>
>I'm trying to use FIND_FILE with cmake 2.4.1 to find a boost header file in my %INCLUDE% path using this line of code:
>
>FIND_FILE( MYVAR "boost/shared_ptr.hpp" PATHS "$ENV{INCLUDE}" )
>
>If my include environment variable is set to c:\dev\boost_vc71_1_33_1 then it works!
>
>But....
>
>If my include environment is set to any of the following, it does NOT work:
>
>C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\;c:\dev\boost_vc71_1_33_1
>"C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\";c:\dev\boost_vc71_1_33_1
>c:\dev\boost_vc71_1_33_1;C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\
>c:\dev\boost_vc71_1_33_1;"C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\"
>
>Shouldn't cmake be able to handle a semi-colon separated list of paths? This must be a bug, right?
>
>I haven't tried using the PATH environment variable, but I wonder if it has the same problem...
Try this:
cmake --help-command FIND_FILE
....
FIND_FILE(
<VAR>
name | NAMES name1 [name2 ...]
PATHS path1 [path2 ... ENV var]
[PATH_SUFFIXES suffix1 [suffix2 ...]]
[DOC "cache documentation string"]
[NO_DEFAULT_PATH]
[NO_CMAKE_ENVIRONMENT_PATH]
[NO_CMAKE_PATH]
[NO_SYSTEM_ENVIRONMENT_PATH]
[NO_CMAKE_SYSTEM_PATH]
)
...
specified after the PATHS argument. If ENV var is found in the PATHS
section the environment variable var will be read and converted from a
system environment variable to a cmake style list of paths. For
example ENV PATH would be a way to list the system path variable. The
...
You want:
FIND_FILE( MYVAR "boost/shared_ptr.hpp" PATHS ENV INCLUDE)
-Bill
More information about the CMake
mailing list