[CMake] How to link against libraries in subdirectory (windows workaround)

Renato Utsch renatoutsch at gmail.com
Sat Oct 29 13:36:36 EDT 2011


Hello!

Well, I am currently using cURL for a project of mine, but on windows I
can't find the cURL library only using the find_package(CURL) provided with
CMake, although it works fine with linux.

So, I created a directory named "deps" in my source directory. How can I
make the find_package to look at this directory before looking at the
default directories? Like:

# Look firstly at the /deps directory, if finds the libcurl.a and the
include/curl folder set the CURL_FOUND macro and the other ones that the
find_package() automatically provides...

if( NOT CURL_FOUND )
    # Then looks at the default paths.
    find_package(CURL REQUIRED)
endif()


So, how can I make it to do that? It is better to look first at the /deps
directory because of that even linux users can provide a build different
than the one installed in its system, making the build more flexible. And on
Windows the users can put the lib files there to be found by CMake.

If there is any better solution with this problem with Windows, I am open to
suggestions.


Thanks!

Renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111029/e625b484/attachment.htm>


More information about the CMake mailing list