diff options
author | Peter Wu <peter@lekensteyn.nl> | 2016-06-01 22:24:35 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2016-09-11 13:13:19 +0200 |
commit | 2f3feda273d7d31362c20b24602241fa0fcd0492 (patch) | |
tree | b55a1d5c5f9b2f7e3c5ef17e3ce72b6d22d323ba /CMakeLists.txt | |
parent | a8e751a51a53c59e832c8351a1356763fa5766c4 (diff) | |
download | curl-2f3feda273d7d31362c20b24602241fa0fcd0492.tar.gz |
cmake: fix curl-config --static-libs
The `curl-config --static-libs` command should not output paths like
-l/usr/lib/libssl.so, instead print the absolute path without `-l`.
This also removes the confusing message "Static linking is broken" which
was printed because curl-config --static-libs was disfunctional even
though the static libcurl.a library works properly.
Fixes https://github.com/curl/curl/issues/841
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4571cdb9f..a0f42133e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1141,9 +1141,7 @@ set(CURL_CA_BUNDLE "") set(CURLVERSION "${CURL_VERSION}") set(ENABLE_SHARED "yes") if(CURL_STATICLIB) - # Broken: LIBCURL_LIBS below; .a lib is not built - message(WARNING "Static linking is broken!") - set(ENABLE_STATIC "no") + set(ENABLE_STATIC "yes") else() set(ENABLE_STATIC "no") endif() @@ -1152,9 +1150,12 @@ set(includedir "\${prefix}/include") set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}") set(LIBCURL_LIBS "") set(libdir "${CMAKE_INSTALL_PREFIX}/lib") -# TODO CURL_LIBS also contains absolute paths which don't work with static -l... foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS}) - set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_lib}") + if(_lib MATCHES ".*/.*") + set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}") + else() + set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_lib}") + endif() endforeach() # "a" (Linux) or "lib" (Windows) string(REPLACE "." "" libext "${CMAKE_STATIC_LIBRARY_SUFFIX}") |