[Cmake] directory search order in .cmake files

Wheeler, Frederick W (Research) wheeler at crd.ge.com
Thu May 15 09:49:48 EDT 2003


Modules/FindZLIB.cmake contains these commands:

FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
  /usr/local/include
  /usr/include
)

FIND_LIBRARY(ZLIB_LIBRARY z
  /usr/lib
  /usr/local/lib
)

Shouldn't the FIND_LIBRARY command be changed to this?

FIND_LIBRARY(ZLIB_LIBRARY z
  /usr/local/lib
  /usr/lib
)

Seems to me that one should first check /usr/local and then /usr so that
libraries in /usr/local override whatever comes with the OS.  Also, the
FIND_PATH for the includes and the FIND_LIBRARY should be consistent,
otherwise you risk version mismatch between the headers and libraries.

Fred Wheeler



More information about the CMake mailing list