summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-11-10 19:56:10 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-11-13 23:42:35 +0100
commit5f3824a5aa7298c9a95c66fc13619df17fabd98e (patch)
treeabc7f44072569c15abddc62b46d9c3b7056bca40 /CMake
parent1ae06e002da6535593e988e1148ce001bb2abc2d (diff)
downloadcurl-5f3824a5aa7298c9a95c66fc13619df17fabd98e.tar.gz
CMake: Restore order-dependent library checks
Revert commit 2257deb502 (Cmake: Avoid cycle directory dependencies, 2014-08-22) and add a comment explaining the purpose of the original code. The check_library_exists_concat macro is intended to be called multiple times on a sequence of possibly dependent libraries. Later libraries may depend on earlier libraries when they are static. They cannot be safely linked in reverse order on some platforms. Signed-off-by: Brad King <brad.king@kitware.com>
Diffstat (limited to 'CMake')
-rw-r--r--CMake/Macros.cmake9
1 files changed, 6 insertions, 3 deletions
diff --git a/CMake/Macros.cmake b/CMake/Macros.cmake
index 9b9338e52..df15b7406 100644
--- a/CMake/Macros.cmake
+++ b/CMake/Macros.cmake
@@ -1,12 +1,15 @@
#File defines convenience macros for available feature testing
# This macro checks if the symbol exists in the library and if it
-# does, it appends library to the list.
+# does, it prepends library to the list. It is intended to be called
+# multiple times with a sequence of possibly dependent libraries in
+# order of least-to-most-dependent. Some libraries depend on others
+# to link correctly.
macro(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
- check_library_exists("${CURL_LIBS};${LIBRARY}" ${SYMBOL} "${CMAKE_LIBRARY_PATH}"
+ check_library_exists("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "${CMAKE_LIBRARY_PATH}"
${VARIABLE})
if(${VARIABLE})
- list(APPEND CURL_LIBS ${LIBRARY})
+ set(CURL_LIBS ${LIBRARY} ${CURL_LIBS})
endif(${VARIABLE})
endmacro(CHECK_LIBRARY_EXISTS_CONCAT)