cmake: fix some linking issue with gold linker (AFAIK only fedora use it for the moment)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4913 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2011-09-06 19:07:55 +00:00
parent 337153c9a6
commit b19e31a1be
4 changed files with 29 additions and 5 deletions

View File

@ -388,16 +388,11 @@ set(SDL_sources
#include_directories( ${SDL_ROOT}/include /usr/include/kde/artsc /usr/include/directfb)
# Hiden option. It is only a temporary workaround of issue 1003. The purpose is to LD_PRELOAD
# the library so it avoid any conflict with previous SDL1.2 symbol
if (DEFINED SHARED_SDL)
add_library(${Output} SHARED ${SDL_sources} )
# Seem to be needed when pre-loading on Fedora
target_link_libraries(${Output} dl)
target_link_libraries(${Output} m)
# Install the library with others plugins
if(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR})
@ -410,6 +405,9 @@ else (DEFINED SHARED_SDL)
add_library(${Output} STATIC ${SDL_sources} )
endif (DEFINED SHARED_SDL)
# Gold (new linux linker) does not get automatically dependency of dependency so you must add
# them manually.
target_link_libraries(${Output} ${LIBC_LIBRARIES})
# User flags options
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")

21
cmake/FindLibc.cmake Normal file
View File

@ -0,0 +1,21 @@
# Once done, this will define
#
# LIBC_FOUND - system has libc
# LIBC_LIBRARIES - link these to use libc
if(LIBC_LIBRARIES)
set(LIBC_FIND_QUIETLY TRUE)
endif(LIBC_LIBRARIES)
find_library(librt NAMES rt)
find_library(libdl NAMES dl)
find_library(libm NAMES m)
set(LIBC_LIBRARIES ${librt} ${libdl} ${libm})
# handle the QUIETLY and REQUIRED arguments and set LIBC_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libc DEFAULT_MSG LIBC_LIBRARIES)
mark_as_advanced(LIBC_LIBRARIES)

View File

@ -55,6 +55,7 @@ endif(NOT FORCE_INTERNAL_ZLIB)
## Use pcsx2 package to find module
include(FindCg)
include(FindGlew)
include(FindLibc)
include(FindPortAudio)
if(NOT FORCE_INTERNAL_SOUNDTOUCH)
include(FindSoundTouch)

View File

@ -179,6 +179,10 @@ add_library(${Output} STATIC ${UtilitiesSources} ${UtilitiesHeaders} ${Utilities
# link target with wx
target_link_libraries(${Output} ${wxWidgets_LIBRARIES})
# Gold (new linux linker) does not get automatically dependency of dependency so you must add
# them manually.
target_link_libraries(${Output} ${LIBC_LIBRARIES})
# User flags options
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Output} "${USER_CMAKE_LD_FLAGS}")