cmake: fix building out of the tree
authorPetr Štetiar <ynezz@true.cz>
Tue, 8 Dec 2020 15:37:42 +0000 (16:37 +0100)
committerPetr Štetiar <ynezz@true.cz>
Wed, 9 Dec 2020 07:03:11 +0000 (08:03 +0100)
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>
CMakeLists.txt

index 86e1b07886139c90f3e8b3f5cc4059a27bb8ed28..315aeb87c80b5a61f78e28564d9c5f61992f7504 100644 (file)
@@ -34,9 +34,10 @@ ENDIF()
 
 FIND_PATH(ubox_include_dir libubox/ustream.h)
 INCLUDE_DIRECTORIES(${ubox_include_dir})
+FIND_LIBRARY(ubox_library NAMES ubox)
 
 ADD_LIBRARY(ustream-ssl SHARED ustream-ssl.c ${SSL_SRC})
-TARGET_LINK_LIBRARIES(ustream-ssl ubox ${SSL_LIB})
+TARGET_LINK_LIBRARIES(ustream-ssl ${ubox_library} ${SSL_LIB})
 
 ADD_EXECUTABLE(ustream-example-server ustream-example-server.c)
 TARGET_LINK_LIBRARIES(ustream-example-server ustream-ssl)