[CMake] Add search paths for FIND_PACKAGE ?
Stephen Collyer
scollyer at netspinner.co.uk
Mon Nov 19 14:39:45 EST 2007
David Cole wrote:
> So for the specific case you ask about, FindCURL.cmake, you would set the
> following advanced variables during ccmake / CMakeSetup configure through
> the cmake GUI:CURL_INCLUDE_DIR
> CURL_LIBRARY
>
> Then, with those set, the next FIND_PACKAGE(CURL) will "find" CURL because
> you've told it exactly where it is.
>
> If you do it all with cmake without a GUI, then you would specify those
> variables on the first cmake command line with -D.
>
>
> Does that help?
> David
I guess that solves the problem, but it seems like a hack,
rather than a solution. It seems to me that the problem
is that FindCURL.make does this:
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.
However, that's not efficient; if a thousand people download
the same curl development package, a thousand people have to
repeat the same hard-coding trick to build my tree. What I would
like to be able to do is to add to the path on the RHS of NAMES,
before I call FIND_PACKAGE e.g. with something like:
IF(WIN32)
SET(EXTRA_NAMES curl/include/curl.h)
ENDIF(WIN32)
FIND_PACKAGE(CURL REQUIRED)
then everyone who builds my tree benefits from my extra
3 lines of code automatically, and need do nothing themselves.
Is anything like that possible ?
--
Regards
Steve Collyer
Netspinner Ltd
More information about the CMake
mailing list