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

View File

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