[CMake] Question about overriding Find modules in cmake

Andreas Pakulat apaku at gmx.de
Tue Mar 31 02:14:18 EDT 2009


On 30.03.09 17:10:10, Allen Gooch wrote:
> 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:
> 
> # BEGIN FindExpat.cmake
> message (STATUS "Finding Expat in global dir: ${GlobalExternalDir}")
> 
> find_path (Expat_INCLUDE_DIR
>   NAMES expat.h
>   PATHS ${GlobalExternalDir}/expat/expat-2.0.1/lib

The reason is that you're using PATHS. If you look at the documentation of
find_path and find_library you'll notice that the order is:

1. dirs listed via the HINTS option
2. system directories (in /usr, /usr/local, C:\Program Files etc)
3. dirs listed via the PATHS option

(I think there's a 4. but can't recall it right now).

So change PATHS to HINTS and then your local version should be preferred.

Andreas

-- 
You will be the last person to buy a Chrysler.


More information about the CMake mailing list