Saku
Saku

Reputation: 403

check_library_exists not works as it should

In CMakeLists.txt I write:

INCLUDE(CheckLibraryExists)
check_library_exists("libcurl" "" "" HAVE_CURL)

HAVE_CURL is always false, even if libcurl installed, and this function not causes fatal errors.

Upvotes: 2

Views: 1050

Answers (1)

To check why a a try-compile fails, you can run CMake with the --debug-trycompile option, which will leave behind the buildsystem for the last try_compile command (these are used internally by all the Check... modules).

I didn't run the check, but I looked at the code of CheckLibraryExists, and it is apparently mandatory to specify a function to look for in that library (the second argument to check_library_exists).

Upvotes: 2

Related Questions