By setting the mode to ONLY cmake will look ONLY in the directories with the
CMAKE_FIND_ROOT_PATH prefix.

Yes, I do this. The problem is that those scripts hardwire some default paths to the native places where headers and libraries are found. When we cross-compile, those defaults should be changed. If the scripts didn't hardwire those default paths, they'd use the correct defaults set up by CMake.

For instance, look at what FindOpenAL does:

FIND_PATH(OPENAL_INCLUDE_DIR al.h
 PATHS
 $ENV{OPENALDIR}
 NO_DEFAULT_PATH
 PATH_SUFFIXES include/AL include/OpenAL include
)
FIND_PATH(OPENAL_INCLUDE_DIR al.h
 PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
 NO_DEFAULT_PATH
 PATH_SUFFIXES include/AL include/OpenAL include
)
FIND_PATH(OPENAL_INCLUDE_DIR al.h
 PATHS
 ~/Library/Frameworks
 /Library/Frameworks
 /usr/local
 /usr
 /sw # Fink
 /opt/local # DarwinPorts
 /opt/csw # Blastwave
 /opt
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
 PATH_SUFFIXES include include/lua51 include/lua5.1 include/lua
)

This could be changed to

FIND_PATH(OPENAL_INCLUDE_DIR al.h
   PATHS
   $ENV{OPENALDIR}
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
   PATH_SUFFIXES include/AL include/OpenAL include)

By not using NO_DEFAULT_PATH, FIND_PATH relies on the correctly default search locations set up by cmake. I'm don't know about Mac frameworks and stuff, but cross-compilation should always be in mind when writing those scripts. Other native locations (as /sw, /opt/local, /opt/csw) should only be searched if not cross-compiling.

Regards,
rod

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to