瀏覽代碼

CTKCore: Generalize test checking if dl library is available.

This commit generalizes the fix integrated in 9684161(fix Core
linking: FreeBSD does not have a libdl)

FreeBSD documentation also confirms that there are no dl library on
that system. It means checking for the presence of the library is a valid
approach. See http://www.freebsd.org/cgi/man.cgi?query=dlopen
Jean-Christophe Fillion-Robin 9 年之前
父節點
當前提交
f8b31c3162
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      Libs/Core/CMakeLists.txt

+ 4 - 1
Libs/Core/CMakeLists.txt

@@ -142,7 +142,10 @@ ctkMacroBuildLib(
   )
 
 # Needed for ctkBackTrace
-if(UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+if(UNIX)
+  # FreeBSD: The same functionality that is in linux's libdl is provided in FreeBSD's libc
+  find_library(HAVE_LIBDL dl)
+  if(HAVE_LIBDL)
   target_link_libraries(${PROJECT_NAME} dl)
 elseif(WIN32 AND NOT MINGW)
   target_link_libraries(${PROJECT_NAME} dbghelp)