summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2020-12-08 10:06:29 +0100
committerPetr Štetiar <ynezz@true.cz>2020-12-08 12:37:27 +0100
commitb6e34845124ff8042526afbc7e0d66b016be8771 (patch)
tree44c1b92d09edda4ec7294d5f277fedd2e2ca7152
parentc66098611f16806a936a3a3f92113a16382fc4d9 (diff)
downloaduclient-b6e34845124ff8042526afbc7e0d66b016be8771.tar.gz
cmake: fix building out of the tree
When building out of the tree, linker is unable to find the ubox library so fix it by using find_library CMake command. Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r--CMakeLists.txt8
1 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 072afef..841bc0f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,8 +10,14 @@ SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
FIND_PATH(ubox_include_dir libubox/ustream-ssl.h)
INCLUDE_DIRECTORIES(${ubox_include_dir})
+IF(BUILD_STATIC)
+ FIND_LIBRARY(ubox_library NAMES ubox.a)
+ELSE(BUILD_STATIC)
+ FIND_LIBRARY(ubox_library NAMES ubox)
+ENDIF(BUILD_STATIC)
+
ADD_LIBRARY(uclient SHARED uclient.c uclient-http.c uclient-utils.c)
-TARGET_LINK_LIBRARIES(uclient ubox dl)
+TARGET_LINK_LIBRARIES(uclient ${ubox_library} dl)
ADD_EXECUTABLE(uclient-fetch uclient-fetch.c progress.c)
TARGET_LINK_LIBRARIES(uclient-fetch uclient)