]> prime8.dev >> repos - ttyd.git/commitdiff
cmake: add check for util lib
authorShuanglei Tao <tsl0922@gmail.com>
Thu, 18 Aug 2022 06:37:55 +0000 (14:37 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Thu, 18 Aug 2022 06:37:55 +0000 (14:37 +0800)
CMakeLists.txt

index 919c983eccfcd9484a05ddf7e4b3b5660385c41e..ae540d6ed2ae9567e2b0ac4c376d983bf4b870e1 100644 (file)
@@ -82,8 +82,11 @@ if(WIN32)
     list(APPEND LINK_LIBS shell32 ws2_32)
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/app.rc.in ${CMAKE_CURRENT_BINARY_DIR}/app.rc @ONLY)
     list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/app.rc)
-elseif(NOT APPLE)
-    list(APPEND LINK_LIBS util)
+else()
+    find_library(LIBUTIL NAMES util)
+    if(LIBUTIL)
+        list(APPEND LINK_LIBS util)
+    endif()
 endif()
 
 add_executable(${PROJECT_NAME} ${SOURCE_FILES})