Explicitly specify .pc names, since the previous guess in CheckLib.cmake wasn't always right.

This fixes detection of at least libenet via pkg-config, and I think
libpng via pkg-config pulseaudio via direct detection.

Also remove the NOT APPLE from the shared libenet check, because there's
no reason for it.
This commit is contained in:
comex 2015-06-02 18:00:50 -04:00
parent 3243a21573
commit fd855758cc
2 changed files with 18 additions and 19 deletions

View File

@ -389,7 +389,7 @@ if(NOT ANDROID)
message("ALSA NOT found, disabling ALSA sound backend")
endif(ALSA_FOUND)
check_lib(AO ao QUIET)
check_lib(AO ao ao QUIET)
if(AO_FOUND)
add_definitions(-DHAVE_AO=1)
message("ao found, enabling ao sound backend")
@ -398,7 +398,7 @@ if(NOT ANDROID)
message("ao NOT found, disabling ao sound backend")
endif(AO_FOUND)
check_lib(BLUEZ bluez QUIET)
check_lib(BLUEZ bluez bluez QUIET)
if(BLUEZ_FOUND)
add_definitions(-DHAVE_BLUEZ=1)
message("bluez found, enabling bluetooth support")
@ -407,7 +407,7 @@ if(NOT ANDROID)
message("bluez NOT found, disabling bluetooth support")
endif(BLUEZ_FOUND)
check_lib(PULSEAUDIO libpulse QUIET)
check_lib(PULSEAUDIO libpulse pulse QUIET)
if(PULSEAUDIO_FOUND)
add_definitions(-DHAVE_PULSEAUDIO=1)
message("PulseAudio found, enabling PulseAudio sound backend")
@ -461,7 +461,7 @@ if(NOT ANDROID)
endif()
if(USE_X11)
check_lib(XRANDR Xrandr)
check_lib(XRANDR xrandr Xrandr)
if(XRANDR_FOUND)
add_definitions(-DHAVE_XRANDR=1)
else()
@ -501,8 +501,8 @@ if(NOT ANDROID)
endif(PORTAUDIO)
if(OPROFILING)
check_lib(OPROFILE opagent opagent.h)
check_lib(BFD bfd bfd.h)
check_lib(OPROFILE "(no .pc for opagent)" opagent opagent.h)
check_lib(BFD "(no .pc for bfd)" bfd bfd.h)
if(OPROFILE_FOUND AND BFD_FOUND)
message("oprofile found, enabling profiling support")
add_definitions(-DUSE_OPROFILE=1)
@ -535,11 +535,11 @@ include_directories(Source/Core)
add_subdirectory(Externals/Bochs_disasm)
include_directories(Externals/Bochs_disasm)
if(NOT APPLE AND NOT ANDROID)
check_lib(ENET enet enet/enet.h QUIET)
if(NOT ANDROID)
check_lib(ENET libenet enet enet/enet.h QUIET)
endif()
if (ENET_FOUND)
message("Using shared enet")
message("Using shared enet")
else()
message("Using static enet from Externals")
include_directories(Externals/enet/include)
@ -570,7 +570,7 @@ else(ZLIB_FOUND)
endif(ZLIB_FOUND)
if(NOT APPLE AND NOT ANDROID)
check_lib(LZO lzo2 lzo/lzo1x.h QUIET)
check_lib(LZO "(no .pc for lzo2)" lzo2 lzo/lzo1x.h QUIET)
endif()
if(LZO_FOUND)
message("Using shared lzo")
@ -583,7 +583,7 @@ endif()
list(APPEND LIBS ${LZO})
if(NOT APPLE AND NOT ANDROID)
check_lib(PNG png png.h QUIET)
check_lib(PNG libpng png png.h QUIET)
endif()
if (PNG_FOUND)
message("Using shared libpng")
@ -596,7 +596,7 @@ endif()
if(OPENAL_FOUND)
if(NOT APPLE)
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h QUIET)
check_lib(SOUNDTOUCH soundtouch SoundTouch soundtouch/SoundTouch.h QUIET)
endif()
if (SOUNDTOUCH_FOUND)
message("Using shared soundtouch")
@ -681,7 +681,7 @@ else()
endif()
if(NOT APPLE AND NOT ANDROID)
check_lib(SOIL SOIL SOIL/SOIL.h QUIET)
check_lib(SOIL "(no .pc for SOIL)" SOIL SOIL/SOIL.h QUIET)
endif()
if(SOIL_FOUND)
message("Using shared SOIL")
@ -740,7 +740,7 @@ if(NOT DISABLE_WX AND NOT ANDROID)
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}
VERSION_EQUAL 2.8.2 OR "${DIST_NAME}" STREQUAL "natty")
check_lib(GTK2 gtk+-2.0 gtk.h REQUIRED)
check_lib(GTK2 gtk+-2.0 gtk+-2.0 gtk.h REQUIRED)
else()
include(FindGTK2)
if(GTK2_FOUND)
@ -766,8 +766,8 @@ if(NOT DISABLE_WX AND NOT ANDROID)
add_definitions(-D__WXGTK__)
# Check for required libs
check_lib(GTHREAD2 gthread-2.0 glib/gthread.h REQUIRED)
check_lib(PANGOCAIRO pangocairo pango/pangocairo.h REQUIRED)
check_lib(GTHREAD2 gthread-2.0 gthread-2.0 glib/gthread.h REQUIRED)
check_lib(PANGOCAIRO pangocairo pangocairo pango/pangocairo.h REQUIRED)
elseif(WIN32)
add_definitions(-D__WXMSW__)
else()

View File

@ -6,7 +6,7 @@ macro(_internal_message msg)
endif()
endmacro()
macro(check_lib var lib)
macro(check_lib var pc lib)
set(_is_required 0)
set(_is_quiet 0)
set(_arg_list ${ARGN})
@ -22,8 +22,7 @@ macro(check_lib var lib)
endforeach()
if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND)
string(TOLOWER ${lib} lower_lib)
pkg_search_module(${var} QUIET ${lower_lib})
pkg_search_module(${var} QUIET ${pc})
endif()
if(${var}_FOUND)