Using cmake-2.7 out of CVS, I'm trying to override the Find modules which come with cmake install. In our src tree we have checked in versions of certain dependencies and I would like to set paths to point at those instead of any libraries which may be installed. In trying to override the behavior of FindExpat I've done the following:<br>
<br>0. added a cmake-modules directory to the top of my src tree<br>1. in my top-level CmakeLists.txt file define where we keep our third-party binary packages as ${GlobalExternalDir}<br>2. in my top-level CMakeLists.txt file, prepend this dirpath to CMAKE_MODULE_PATH with 'set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake-modules ${CMAKE_MODULE_PATH})'<br>
3. in my cmake-modules directory create a FindExpat.cmake which locates include dir and library in ${GlobalExternalDir} and uses message to report on the found locations<br><br>When I run it, the messages indicate that my FindExpat is being used, instead of the one installed by cmake in /usr/local/share/cmake-2.7/Modules/FindEXPAT.cmake, however my logging out of the Expat_INCLUDE_DIR and Expat_LIBRARY values indicate that sytem libraries are being found instead of the ones in our src tree. Below is my FindExpat.cmake file contents:<br>
<br># BEGIN FindExpat.cmake<br>message (STATUS "Finding Expat in global dir: ${GlobalExternalDir}")<br><br>find_path (Expat_INCLUDE_DIR<br> NAMES expat.h<br> PATHS ${GlobalExternalDir}/expat/expat-2.0.1/lib<br>
)<br>message (STATUS "Set Expat_INCLUDE_DIR: ${Expat_INCLUDE_DIR}")<br><br>find_library (Expat_LIBRARY<br> NAMES expat<br> PATHS ${GlobalExternalDir}/expat/expat-2.0.1/bin/linux-x32/release<br> )<br>message (STATUS "Set Expat_LIBRARY: ${Expat_LIBRARY}")<br>
<br>if (Expat_INCLUDE_DIR)<br> set (Expat_FOUND TRUE)<br> set (Expat_INCLUDE_DIRS ${Expat_INCLUDE_DIR})<br> set (Expat_LIBRARIES ${Expat_LIBRARY})<br> message (STATUS "Found Expat")<br>endif ()<br># END FindExpat.cmake<br>
<br>Any ideas on why this cannot use my local install of expat versus that of the system?<br><br>Many thanks in advance,<br>-allen<br><br>