Skip to content

Commit

Permalink
Add missing -ldl to unix-style OS:es (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
doocman authored Jul 1, 2024
1 parent 5334ecc commit c8ca27a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,39 @@ if (DYNLOAD_IMPORT)
add_library(dynl::dynl_headers ALIAS dynl_headers)
target_include_directories(dynl_headers INTERFACE
include
)
)
target_compile_features(dynl_headers INTERFACE cxx_std_20)

if (DYNLOAD_USE_EXCEPTIONS)
else ()
target_compile_definitions(dynl_shared PRIVATE
"DYNLOAD_NO_EXCEPTIONS=1"
)
)
endif ()

if (DYNLOAD_HEADERONLY)
set(DYNLOAD_LIB_TYPE INTERFACE)
set(DYNLOAD_PUBLIC_LINK_TYPE INTERFACE)
set(DYNLOAD_LIB_TYPE INTERFACE)
set(DYNLOAD_PUBLIC_LINK_TYPE INTERFACE)
else ()
set(DYNLOAD_LIB_TYPE "")
set(DYNLOAD_PUBLIC_LINK_TYPE PUBLIC)
set(DYNLOAD_LIB_TYPE "")
set(DYNLOAD_PUBLIC_LINK_TYPE PUBLIC)
endif ()

add_library(dynl ${DYNLOAD_LIB_TYPE})
add_library(dynl::dynl ALIAS dynl)
target_link_libraries(dynl ${DYNLOAD_PUBLIC_LINK_TYPE}
dynl::dynl_headers
${DYNLOAD_DEV_LINK}
)
)
if (DYNLOAD_COMPILE_PLATFORM)
if (WIN32)
set(DYNL_SRC src/dynl_win32.cpp)
set(DYNL_PLATFORM DYNL_WINDOWS=1)
set(DYNL_EXTRA_LINK "")
elseif (UNIX)
set(DYNL_SRC src/dynl_unix.cpp)
set(DYNL_PLATFORM DYNL_UNIX=1)
set(DYNL_EXTRA_LINK dl)
else ()
message(SEND_ERROR "Dynload: no automatic backend available! Use custom defined source file")
endif ()
Expand All @@ -66,16 +68,18 @@ if (DYNLOAD_IMPORT)
set(DYNL_SRC "")
set(DYNL_PLATFORM "")
endif ()
if(DYNLOAD_HEADERONLY)
if (DYNLOAD_HEADERONLY)
target_compile_definitions(dynl INTERFACE DYNLOAD_HEADERONLY=1 ${DYNL_PLATFORM})
target_link_libraries(dynl INTERFACE ${DYNL_EXTRA_LINK})
else ()
target_sources(dynl PRIVATE ${DYNL_SRC})
target_link_libraries(dynl PRIVATE ${DYNL_EXTRA_LINK})
endif ()
endif ()
if (DYNLOAD_EXPORT)
add_library(dynl_export INTERFACE)
add_library(dynl::dynl_export ALIAS dynl_export)
target_include_directories(dynl_export INTERFACE
export_include
)
)
endif ()

0 comments on commit c8ca27a

Please sign in to comment.