From e4f55032f27c0085c041c67a55af7ceec6d776f5 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 8 Mar 2021 22:05:01 +0800 Subject: fix CMakelist.txt. --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55bcd7d..d3ca6fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,9 +36,12 @@ set_target_properties(libyue PROPERTIES PREFIX "") set_target_properties(libyue PROPERTIES OUTPUT_NAME "yue") target_link_libraries(libyue ${LUA_LIBRARIES}) +find_package(Threads REQUIRED) add_executable(yue src/yuescript/ast.cpp src/yuescript/yue_compiler.cpp src/yuescript/yue_parser.cpp src/yuescript/yuescript.cpp src/yuescript/parser.cpp src/yue.cpp) -target_link_libraries(yue ${LUA_LIBRARIES}) -target_link_options(yue PRIVATE -ldl -lpthread) +target_link_libraries(yue ${LUA_LIBRARIES} Threads::Threads) +if(CMAKE_DL_LIBS) + target_link_libraries(yue ${CMAKE_DL_LIBS}) +endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_link_options(yue PRIVATE -lstdc++fs) endif() -- cgit v1.2.3-55-g6feb