[CMake] What does `cross-platform' mean?

Jed Brown jed at 59A2.org
Mon Nov 10 06:19:45 EST 2008


Thanks Michael, it's good to hear I'm not alone :-)

On Sun 2008-11-09 20:16, Michael Jackson wrote:
> So basically if you don't have the HDF5_INSTALL env variable set then my 
> module probably will not find it, which is good in that instead of  
> getting a wrong version of HDF5 you just don't get any at all.

I also use NO_DEFAULT_PATH in my modules to help prevent an inconsistent
configuration.  I think the optimal semantic is usually that if
HDF5_INSTALL is not set, it tries default paths, but if HDF5_INSTALL is
set, even if incorrectly, it will never fall back on default paths.
Something like this, all guarded by clearing all advanced HDF5_* entries
if HDF5_INSTALL is changed so the user can change versions without
manually deleting the cache.

  IF(HDF5_INSTALL)
    # Look for the library only under the specified directory
    FIND_LIBRARY(HDF5_LIBRARY_DEBUG
     NAMES ${HDF5_SEARCH_DEBUG_NAMES}
     HINTS ${HDF5_INSTALL}
     PATH_SUFFIXES lib64 lib
     NO_DEFAULT_PATH
     )
  ELSE(HDF5_INSTALL)
    # Look for the library in default paths
    FIND_LIBRARY(HDF5_LIBRARY_DEBUG
     NAMES ${HDF5_SEARCH_DEBUG_NAMES}
     )
  ENDIF(HDF5_INSTALL)

Maybe it could look something like

  FIND_LIBRARY(HDF5_LIBRARY_DEBUG
   NAMES ${HDF5_SEARCH_DEBUG_NAMES}
   HINTS ${HDF5_INSTALL}
   PATH_SUFFIXES lib64 lib
   EXCLUSIVE_HINTS)

where the semantic (if EXCLUSIVE_HINTS is given) is that if the
arguments of HINTS is set (i.e. HDF5_INSTALL was set, either as an
environment variable or in the cache), then only directories under
HINTS/PATH_SUFFIXES are searched, otherwise (i.e. HDF5_INSTALL was not
set) the normal semantics of FIND_LIBRARY are used.

Jed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081110/bc28efb6/attachment.pgp>


More information about the CMake mailing list