[CMake] FIND_XXX problem with symlinks when using ENV

Marcel Loose loose at astron.nl
Fri Feb 19 10:42:09 EST 2010


Hi all,

I've noticed a problematic behaviour with the FIND_XXX macros when using
ENV in either PATHS or HINTS: symbolic links get converted to the real
paths. This happens with cmake 2.6.x and 2.8.0. Is this a bug?

Here's an example:

$ ls -l /opt/hdf5
lrwxrwxrwx 1 root root 18 2009-09-21 10:08 /opt/hdf5 ->
/data/sys/opt/hdf5

$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(MyHDF5)
set(ENV{HDF5_ROOT} /opt/hdf5)
find_path(HDF5_INCLUDE_DIR hdf5.h
  HINTS ENV HDF5_ROOT
  PATH_SUFFIXES include)

$ grep HDF5_INCLUDE_DIR CMakeCache.txt
HDF5_INCLUDE_DIR:PATH=/data/sys/opt/hdf5/include

Replacing 'ENV HDF5_ROOT' in find_path() with the literal string
'/opt/hdf5' gives me:

$ grep HDF5_INCLUDE_DIR CMakeCache.txt
HDF5_INCLUDE_DIR:PATH=/opt/hdf5/include

Best regards,
Marcel Loose.




More information about the CMake mailing list