[CMake] Unexpected find_path() result

Pere Mato Vila Pere.Mato at cern.ch
Mon Jun 20 12:47:43 EDT 2011


> If I remember correctly, in -P mode the basic system files, e.g. 
> CMakeDetermineSystem.cmake etc. are not executed, so cmake doesn't execute 
> UnixPaths.cmake, which sets all the default search paths, so in your try with 
> -P only the path you gave to find_path() was searched, the default search path 
> was empty.

I tried to look at all variables that I know CMAKE_PREFIX_PATH , CMAKE_INCLUDE_PATH, CMAKE_FRAMEWORK_PATH , CMAKE_SYSTEM_INCLUDE_PATH, CMAKE_SYSTEM_FRAMEWORK_PATH, CMAKE_FIND_ROOT_PATH and /usr/include is not there. It only appears in CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES and CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES, which the documentation does not mention are being used for find_path().

> 
> Why don't you like the /usr/include result ?
> The necessary files must be existing there, otherwise cmake wouldn't have 
> returned that result.

I do not like it because the libraries are found under the other structure 

-- X11_Xft_INCLUDE_PATH: /usr/include
-- X11_Xft_LIB: /usr/X11R6/lib/libXft.dylib

and later fails looking for some header that exists under /usr/X11R6/include and not under /usr/include

> 
> You can influence the search oder e.g. by using "HINTS" instead of "PATHS", 
> HINTS are searched *before* the default dirs, "PATHS" are searched after them.

The problem is that I cannon modify find_path() because I use the standard FindX11.cmake module. 
> 
> You can also set CMAKE_PREFIX_PATH to a set of root search dirs, which will be 
> used before the default dirs.

Yes, this is probably a solution but would probably be very specific to my installation. 




More information about the CMake mailing list