blob: 78c8fd4c7bcb78b9ccbeee2bea73cb0bd996c382 [file] [log] [blame]
Brian P. Hinz7a925912014-11-04 19:45:32 -05001Index: CMakeLists.txt
2===================================================================
3diff --git a/CMakeLists.txt b/CMakeLists.txt
4--- a/CMakeLists.txt (revision 9965)
5+++ b/CMakeLists.txt (working copy)
Brian P. Hinz7a925912014-11-04 19:45:32 -05006@@ -138,6 +139,7 @@
7 #######################################################################
8 # libraries
9 find_library(LIB_CAIRO cairo)
10+find_library(LIB_dl dl)
11 find_library(LIB_fontconfig fontconfig)
12 find_library(LIB_freetype freetype)
13 find_library(LIB_GL GL)
14@@ -146,7 +148,7 @@
15 find_library(LIB_png png)
16 find_library(LIB_zlib z)
17
18-mark_as_advanced(LIB_CAIRO LIB_fontconfig LIB_freetype)
19+mark_as_advanced(LIB_CAIRO LIB_dl LIB_fontconfig LIB_freetype)
20 mark_as_advanced(LIB_GL LIB_MesaGL)
21 mark_as_advanced(LIB_jpeg LIB_png LIB_zlib)
22
23Index: src/CMakeLists.txt
24===================================================================
25diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
26--- a/src/CMakeLists.txt (revision 9965)
27+++ b/src/CMakeLists.txt (working copy)
28@@ -220,7 +220,7 @@
29 endif(MSVC)
30
31 if(USE_THREADS)
32- target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT})
33+ target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
34 endif(USE_THREADS)
35
36 if(USE_X11)
37@@ -334,7 +334,7 @@
38 endif(MSVC)
39
40 if(USE_THREADS)
41- target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT})
42+ target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
43 endif(USE_THREADS)
44
45 if(USE_X11)
46@@ -384,11 +384,11 @@
47 endif(MSVC)
48
49 if(USE_THREADS)
50- target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT})
51+ target_link_libraries(fltk_forms_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
52 endif(USE_THREADS)
53
54 if(USE_X11)
55- target_link_libraries(fltk_SHARED ${X11_LIBRARIES})
56+ target_link_libraries(fltk_forms_SHARED ${X11_LIBRARIES})
57 endif(USE_X11)
58
59 #######################################################################
60diff -Naur a/CMake/FindDL.cmake b/CMake/FindDL.cmake
61--- a/CMake/FindDL.cmake 1969-12-31 19:00:00.000000000 -0500
62+++ b/CMake/FindDL.cmake 2014-10-29 23:00:18.000000000 -0400
63@@ -0,0 +1,37 @@
64+# - Find dl functions
65+# This module finds dl libraries.
66+#
67+# It sets the following variables:
68+# DL_FOUND - Set to false, or undefined, if dl libraries aren't found.
69+# DL_INCLUDE_DIR - The dl include directory.
70+# DL_LIBRARY - The dl library to link against.
71+
72+INCLUDE(CheckFunctionExists)
73+
74+FIND_PATH(DL_INCLUDE_DIR NAMES dlfcn.h)
75+FIND_LIBRARY(DL_LIBRARY NAMES dl)
76+
77+IF (DL_LIBRARY)
78+ SET(DL_FOUND TRUE)
79+ELSE (DL_LIBRARY)
80+ # if dlopen can be found without linking in dl then,
81+ # dlopen is part of libc, so don't need to link extra libs.
82+ CHECK_FUNCTION_EXISTS(dlopen DL_FOUND)
83+ SET(DL_LIBRARY "")
84+ENDIF (DL_LIBRARY)
85+
86+IF (DL_FOUND)
87+
88+ # show which dl was found only if not quiet
89+ IF (NOT DL_FIND_QUIETLY)
90+ MESSAGE(STATUS "Found dl: ${DL_LIBRARY}")
91+ ENDIF (NOT DL_FIND_QUIETLY)
92+
93+ELSE (DL_FOUND)
94+
95+ # fatal error if dl is required but not found
96+ IF (DL_FIND_REQUIRED)
97+ MESSAGE(FATAL_ERROR "Could not find dl")
98+ ENDIF (DL_FIND_REQUIRED)
99+
100+ENDIF (DL_FOUND)