[CMake] Add search paths for FIND_PACKAGE ?

Dizzy dizzy at roedu.net
Tue Nov 20 04:34:56 EST 2007


On Monday 19 November 2007 21:39:45 Stephen Collyer wrote:
>
> FIND_PATH(CURL_INCLUDE_DIR NAMES curl/curl.h)
>
> i.e. it hard-codes the assumption that curl.h lives in
> a directory called curl. In my case, it doesn't: it lives
> in a directory called include and no amount of adding to
> or subtracting from the default directories that FIND_PATH
> search from will fix this problem. Hence your hack: tell
> cmake explicitly where to look and all is well.

Yes, that is bad practice IMO. FIND_PATH() should look just for the file in 
some default locations it is known to be on many platforms (including 
registry settings on Windows if there are install packages that installs and 
registers locations) but should not assume there is always the "curl" 
directory. Because of that bad FIND_PATH() not even setting (according to the 
documentation) the following variables before calling on FIND_PACAKGE() 
helps:
                 CMAKE_FRAMEWORK_PATH
                 CMAKE_APPBUNDLE_PATH
                 CMAKE_INCLUDE_PATH

AFAIK that is the standard procedure to have your project specify additional 
lookup paths for includes and libraries without having to modify the original 
Find package code.

-- 
Mihai RUSU					Email: dizzy at roedu.net
			"Linux is obsolete" -- AST


More information about the CMake mailing list