Fix building with the GNU Gold linker
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 24 Nov 2009 12:18:49 +0000 (13:18 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 24 Nov 2009 12:20:50 +0000 (13:20 +0100)
Thanks to Thomas Müller (DeepDiver) for providing the patch. Fixes #863.

src/common/CMakeLists.txt

index f36d00e..9d0af6e 100644 (file)
@@ -72,6 +72,16 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})  # for vers
 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES version.gen)
 
 add_library(mod_common STATIC ${SOURCES} ${MOC})
+
 if(APPLE)
   target_link_libraries(mod_common "-framework CoreServices" "-framework CoreFoundation")
-endif(APPLE)
\ No newline at end of file
+endif(APPLE)
+
+if(CMAKE_HOST_UNIX)
+    find_library(libdl dl)
+    if (libdl-NOTFOUND)
+        message(FATAL_ERROR "Cannot find required library: libdl")
+    endif (libdl-NOTFOUND)
+
+    target_link_libraries(mod_common ${libdl})
+endif(CMAKE_HOST_UNIX)