Skip to content

Commit d040682

Browse files
authored
Simplify libdl handling
CMake has builtin variable CMAKE_DL_LIBS which contains correct dynamic linker library (-ldl for linux, empty for *BSD etc.)
1 parent 3e82286 commit d040682

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

tests/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,7 @@ if(BUILD_TESTS)
4141

4242

4343
find_package(Threads)
44-
set(TARGET_LINK_LIB ${TARGET_LINK_LIB} ${CMAKE_THREAD_LIBS_INIT} ${TARGET_LINK})
45-
46-
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
47-
find_library(DL_LIB dl)
48-
set(TARGET_LINK_LIB ${TARGET_LINK_LIB} ${DL_LIB})
49-
endif()
44+
set(TARGET_LINK_LIB ${TARGET_LINK_LIB} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} ${TARGET_LINK})
5045

5146
find_library(M_LIB m)
5247
set(TARGET_LINK_LIB ${TARGET_LINK_LIB} ${M_LIB})

0 commit comments

Comments
 (0)