| Index: CMakeLists.txt |
| =================================================================== |
| diff --git a/CMakeLists.txt b/CMakeLists.txt |
| --- a/CMakeLists.txt (revision 9965) |
| +++ b/CMakeLists.txt (working copy) |
| @@ -138,6 +139,7 @@ |
| ####################################################################### |
| # libraries |
| find_library(LIB_CAIRO cairo) |
| +find_library(LIB_dl dl) |
| find_library(LIB_fontconfig fontconfig) |
| find_library(LIB_freetype freetype) |
| find_library(LIB_GL GL) |
| @@ -146,7 +148,7 @@ |
| find_library(LIB_png png) |
| find_library(LIB_zlib z) |
| |
| -mark_as_advanced(LIB_CAIRO LIB_fontconfig LIB_freetype) |
| +mark_as_advanced(LIB_CAIRO LIB_dl LIB_fontconfig LIB_freetype) |
| mark_as_advanced(LIB_GL LIB_MesaGL) |
| mark_as_advanced(LIB_jpeg LIB_png LIB_zlib) |
| |
| Index: src/CMakeLists.txt |
| =================================================================== |
| diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt |
| --- a/src/CMakeLists.txt (revision 9965) |
| +++ b/src/CMakeLists.txt (working copy) |
| @@ -220,7 +220,7 @@ |
| endif(MSVC) |
| |
| if(USE_THREADS) |
| - target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT}) |
| + target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl}) |
| endif(USE_THREADS) |
| |
| if(USE_X11) |
| @@ -334,7 +334,7 @@ |
| endif(MSVC) |
| |
| if(USE_THREADS) |
| - target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT}) |
| + target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl}) |
| endif(USE_THREADS) |
| |
| if(USE_X11) |
| @@ -384,11 +384,11 @@ |
| endif(MSVC) |
| |
| if(USE_THREADS) |
| - target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT}) |
| + target_link_libraries(fltk_forms_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl}) |
| endif(USE_THREADS) |
| |
| if(USE_X11) |
| - target_link_libraries(fltk_SHARED ${X11_LIBRARIES}) |
| + target_link_libraries(fltk_forms_SHARED ${X11_LIBRARIES}) |
| endif(USE_X11) |
| |
| ####################################################################### |
| diff -Naur a/CMake/FindDL.cmake b/CMake/FindDL.cmake |
| --- a/CMake/FindDL.cmake 1969-12-31 19:00:00.000000000 -0500 |
| +++ b/CMake/FindDL.cmake 2014-10-29 23:00:18.000000000 -0400 |
| @@ -0,0 +1,37 @@ |
| +# - Find dl functions |
| +# This module finds dl libraries. |
| +# |
| +# It sets the following variables: |
| +# DL_FOUND - Set to false, or undefined, if dl libraries aren't found. |
| +# DL_INCLUDE_DIR - The dl include directory. |
| +# DL_LIBRARY - The dl library to link against. |
| + |
| +INCLUDE(CheckFunctionExists) |
| + |
| +FIND_PATH(DL_INCLUDE_DIR NAMES dlfcn.h) |
| +FIND_LIBRARY(DL_LIBRARY NAMES dl) |
| + |
| +IF (DL_LIBRARY) |
| + SET(DL_FOUND TRUE) |
| +ELSE (DL_LIBRARY) |
| + # if dlopen can be found without linking in dl then, |
| + # dlopen is part of libc, so don't need to link extra libs. |
| + CHECK_FUNCTION_EXISTS(dlopen DL_FOUND) |
| + SET(DL_LIBRARY "") |
| +ENDIF (DL_LIBRARY) |
| + |
| +IF (DL_FOUND) |
| + |
| + # show which dl was found only if not quiet |
| + IF (NOT DL_FIND_QUIETLY) |
| + MESSAGE(STATUS "Found dl: ${DL_LIBRARY}") |
| + ENDIF (NOT DL_FIND_QUIETLY) |
| + |
| +ELSE (DL_FOUND) |
| + |
| + # fatal error if dl is required but not found |
| + IF (DL_FIND_REQUIRED) |
| + MESSAGE(FATAL_ERROR "Could not find dl") |
| + ENDIF (DL_FIND_REQUIRED) |
| + |
| +ENDIF (DL_FOUND) |