[CMake] user defined search path for find_package

Andreas Pakulat apaku at gmx.de
Tue Jul 31 13:09:14 EDT 2012


Hi,

On Tue, Jul 31, 2012 at 6:25 PM, rainman110.de
<rainman110.de at googlemail.com> wrote:
> Hello together,
>
> this is my first post to this mailing list as I am a new cmake user and
> trying to learn it. I already posted the message but somehow it was not
> accepted by nabble...
>
> I have a multiplatform project which requires the CURL package. On Linux the
> package is found by cmake as it is located in standard paths. On windows it
> cannot be found as the headers are in d:\local\include and the libs are in
> e.g. d:\local\some-lib-folder. As find_package fails, I want the user to
> specify additional lib and include directories in the cmake-gui or in ccmake
> (it should not be hardcoded in the CMakeLists.txt).

How to help find_path and find_library to find the include or library
is described in the cmake manual under the corresponding functions. If
you use the standard FindCURL.cmake module that ships with CMake this
should be enough to have curl found on windows as well. The
corresponding sections in the online manual are:
http://cmake.org/cmake/help/v2.8.8/cmake.html#command:find_path
http://cmake.org/cmake/help/v2.8.8/cmake.html#command:find_library

The FindCURL.cmake module does not use any special arguments (like
HINTS, PATHS or NO_...), so in theory using CMAKE_PREFIX_PATH=d:\local
might already suffice (if some-lib-folder is called lib or lib32 or
so).

Andreas


More information about the CMake mailing list