[CMake] to_cmake_path/to_native_path oddities

Axel Roebel Axel.Roebel at ircam.fr
Wed May 28 04:23:45 EDT 2008


Hi,

I just switched from 2.4.8 to 2.6 and found a very strange behavior in one of my existing cmake 
projects. I am trying to find the include files (and libraries) of Intels  mkl libraries with the following
cmake code

FIND_PATH(MKL_INCLUDE_PATH_TMP mkl_dfti.h PATHS /usr/include  /usr/local/include  /u/formes/share/include  /cygdrive/c/Program 
Files/Intel/MKL/10.0.1.014/include)

Now in cmake 2.4.8 this returned 

/cygdrive/c/Program Files/Intel/MKL/10.0.1.014/include

while in cmake 2.6.0 it creates

c:\Program Files\Intel\MKL\10.0.1.014\include

a path that it found in the environment variable INCLUDE

This seems already somewhat buggy tpo me because I would have expected that in a unix makefile generator the variable should be automatically
converted to unix path style.

Then I thought to use the to_cmake_path/to_native_path facilities to convert the path
to unix flavor. (BTW I am not quite sure what native means in cygwin compiled cmake on windows).
Neither of these two did anything useful though. Both ended up with something like

"c"  "/Program Files/Intel/MKL/10.0.1.014/include"

which after looking in the source code is obviously due to the fact that 
the fist thing both TO_*_PATH commands do is

 #if defined(_WIN32) && !defined(__CYGWIN__)
  char pathSep = ';';
#else
  char pathSep = ':';
#endif
  std::vector<cmsys::String> path = cmSystemTools::SplitString(i->c_str(),    pathSep);

this means for CYGWIN it will always use ":" as path separator splitting the c from the 
rest and then converting to unix style path. So in short the path conversion for cygwin
is working only in one (completely useless) case: 

unix style path -> unix style path 

While I submitted this as a bug report I wonder if there are any workarounds that
I might use to get the unix style path with the current cmake 2.6.0


Kind regards,


-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540


More information about the CMake mailing list