cmake: include(Find…)->find_package(…)

This commit is contained in:
Florent Castelli 2017-01-17 21:32:55 +01:00
parent 63011f1402
commit 875563787f
3 changed files with 20 additions and 27 deletions

View File

@ -145,7 +145,7 @@ function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_FILE SOURCE_VARIAB
endfunction(enable_precompiled_headers) endfunction(enable_precompiled_headers)
# for revision info # for revision info
include(FindGit OPTIONAL) find_package(Git)
if(GIT_FOUND AND NOT DOLPHIN_WC_REVISION) if(GIT_FOUND AND NOT DOLPHIN_WC_REVISION)
# defines DOLPHIN_WC_REVISION # defines DOLPHIN_WC_REVISION
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
@ -471,13 +471,13 @@ add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
include(CheckLib) include(CheckLib)
include(CheckCXXSourceRuns) include(CheckCXXSourceRuns)
include(FindOpenGL) find_package(OpenGL)
if (OPENGL_GL) if (OPENGL_GL)
include_directories(${OPENGL_INCLUDE_DIR}) include_directories(${OPENGL_INCLUDE_DIR})
endif() endif()
if(ENABLE_ALSA) if(ENABLE_ALSA)
include(FindALSA OPTIONAL) find_package(ALSA)
if(ALSA_FOUND) if(ALSA_FOUND)
add_definitions(-DHAVE_ALSA=1) add_definitions(-DHAVE_ALSA=1)
message("ALSA found, enabling ALSA sound backend") message("ALSA found, enabling ALSA sound backend")
@ -529,7 +529,7 @@ else()
endif() endif()
if(ENABLE_OPENAL) if(ENABLE_OPENAL)
include(FindOpenAL OPTIONAL) find_package(OpenAL)
if(OPENAL_FOUND) if(OPENAL_FOUND)
add_definitions(-DHAVE_OPENAL=1) add_definitions(-DHAVE_OPENAL=1)
include_directories(${OPENAL_INCLUDE_DIR}) include_directories(${OPENAL_INCLUDE_DIR})
@ -543,7 +543,7 @@ else()
endif() endif()
if(ENABLE_LLVM) if(ENABLE_LLVM)
include(FindLLVM OPTIONAL) find_package(LLVM)
if (LLVM_FOUND) if (LLVM_FOUND)
add_definitions(-DHAS_LLVM=1) add_definitions(-DHAS_LLVM=1)
set(HAS_LLVM 1) set(HAS_LLVM 1)
@ -558,7 +558,7 @@ endif()
set(USE_X11 0) set(USE_X11 0)
if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT ENABLE_HEADLESS) if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT ENABLE_HEADLESS)
include(FindX11) find_package(X11)
if(TRY_X11 AND X11_FOUND) if(TRY_X11 AND X11_FOUND)
set(USE_X11 1) set(USE_X11 1)
add_definitions(-DHAVE_X11=1) add_definitions(-DHAVE_X11=1)
@ -620,7 +620,7 @@ if(NOT ANDROID)
endif() endif()
if(OPROFILING) if(OPROFILING)
include(FindOProfile) find_package(OProfile)
if(OPROFILE_FOUND) if(OPROFILE_FOUND)
message("OProfile found, enabling profiling support") message("OProfile found, enabling profiling support")
add_definitions(-DUSE_OPROFILE=1) add_definitions(-DUSE_OPROFILE=1)
@ -636,8 +636,8 @@ if(USE_EGL)
endif() endif()
if(ENABLE_EVDEV) if(ENABLE_EVDEV)
include(FindLibudev REQUIRED) find_package(Libudev REQUIRED)
include(FindLibevdev REQUIRED) find_package(Libevdev REQUIRED)
if(LIBUDEV_FOUND AND LIBEVDEV_FOUND) if(LIBUDEV_FOUND AND LIBEVDEV_FOUND)
message("libevdev/libudev found, enabling evdev controller backend") message("libevdev/libudev found, enabling evdev controller backend")
add_definitions(-DHAVE_LIBUDEV=1) add_definitions(-DHAVE_LIBUDEV=1)
@ -718,13 +718,8 @@ if(NOT XXHASH_FOUND)
endif() endif()
LIST(APPEND LIBS xxhash) LIST(APPEND LIBS xxhash)
# If zlib has already been found on a previous run of cmake don't check again find_package(ZLIB)
# as the check seems to take a long time.
if(NOT ZLIB_FOUND)
include(FindZLIB OPTIONAL)
endif()
if(ZLIB_FOUND) if(ZLIB_FOUND)
set(ZLIB_FOUND 1 CACHE INTERNAL "")
message("Using shared zlib") message("Using shared zlib")
include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(${ZLIB_INCLUDE_DIRS})
else(ZLIB_FOUND) else(ZLIB_FOUND)
@ -772,14 +767,14 @@ if(OPENAL_FOUND)
endif() endif()
if(ENABLE_SDL) if(ENABLE_SDL)
include(FindSDL2 OPTIONAL) find_package(SDL2)
if(SDL2_FOUND) if(SDL2_FOUND)
message("Using shared SDL2") message("Using shared SDL2")
add_definitions(-DHAVE_SDL=1) add_definitions(-DHAVE_SDL=1)
include_directories(${SDL2_INCLUDE_DIR}) include_directories(${SDL2_INCLUDE_DIR})
else(SDL2_FOUND) else(SDL2_FOUND)
# SDL2 not found, try SDL # SDL2 not found, try SDL
include(FindSDL OPTIONAL) find_package(SDL OPTIONAL)
if(SDL_FOUND) if(SDL_FOUND)
message("Using shared SDL") message("Using shared SDL")
add_definitions(-DHAVE_SDL=1) add_definitions(-DHAVE_SDL=1)
@ -821,7 +816,7 @@ endif()
if(USE_UPNP) if(USE_UPNP)
if(NOT APPLE) if(NOT APPLE)
include(FindMiniupnpc) find_package(Miniupnpc)
endif() endif()
if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8) if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8)
message("Using shared miniupnpc") message("Using shared miniupnpc")
@ -837,7 +832,7 @@ if(USE_UPNP)
endif() endif()
if(NOT APPLE) if(NOT APPLE)
include(FindMbedTLS) find_package(MbedTLS)
endif() endif()
if(MBEDTLS_FOUND) if(MBEDTLS_FOUND)
message("Using shared mbed TLS") message("Using shared mbed TLS")
@ -849,7 +844,7 @@ else()
include_directories(Externals/mbedtls/include) include_directories(Externals/mbedtls/include)
endif() endif()
include(FindCURL OPTIONAL) find_package(CURL)
if(CURL_FOUND) if(CURL_FOUND)
message("Using shared libcurl") message("Using shared libcurl")
include_directories(${CURL_INCLUDE_DIRS}) include_directories(${CURL_INCLUDE_DIRS})
@ -885,7 +880,6 @@ endif()
list(APPEND LIBS ${ICONV_LIBRARIES}) list(APPEND LIBS ${ICONV_LIBRARIES})
if(NOT ANDROID) if(NOT ANDROID)
include(FindHIDAPI OPTIONAL)
find_package(HIDAPI) find_package(HIDAPI)
if(HIDAPI_FOUND) if(HIDAPI_FOUND)
message("Using shared ${HIDAPI_LIBRARIES} ${HIDAPI_VERSION}") message("Using shared ${HIDAPI_LIBRARIES} ${HIDAPI_VERSION}")
@ -927,8 +921,7 @@ if(ENABLE_QT2)
endif() endif()
if(NOT DISABLE_WX) if(NOT DISABLE_WX)
include(FindwxWidgets OPTIONAL) find_package(wxWidgets COMPONENTS core aui adv)
FIND_PACKAGE(wxWidgets COMPONENTS core aui adv)
if(_ARCH_32) if(_ARCH_32)
add_definitions(-DwxSIZE_T_IS_UINT) add_definitions(-DwxSIZE_T_IS_UINT)
@ -964,7 +957,7 @@ if(NOT DISABLE_WX)
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+-2.0 gtk.h REQUIRED) check_lib(GTK2 gtk+-2.0 gtk+-2.0 gtk.h REQUIRED)
else() else()
include(FindGTK2) find_package(GTK2)
if(GTK2_FOUND) if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS}) include_directories(${GTK2_INCLUDE_DIRS})
list(APPEND LIBS ${GTK2_LIBRARIES}) list(APPEND LIBS ${GTK2_LIBRARIES})
@ -1047,7 +1040,7 @@ include_directories("${PROJECT_BINARY_DIR}/Source/Core")
######################################## ########################################
# Unit testing. # Unit testing.
# #
include(FindGTest) find_package(GTest)
if(GTEST_FOUND AND USE_SHARED_GTEST) if(GTEST_FOUND AND USE_SHARED_GTEST)
message("Using shared gtest") message("Using shared gtest")
include_directories(${GTEST_INCLUDE_DIRS}) include_directories(${GTEST_INCLUDE_DIRS})

View File

@ -1,4 +1,4 @@
include(FindPkgConfig OPTIONAL) find_package(PkgConfig)
macro(_internal_message msg) macro(_internal_message msg)
if(NOT ${_is_quiet}) if(NOT ${_is_quiet})

View File

@ -114,7 +114,7 @@ endif()
set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}) set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE})
include(FindGettext) find_package(Gettext)
if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE AND wxWidgets_FOUND) if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE AND wxWidgets_FOUND)
file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po) file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po)
add_custom_target(translations ALL) add_custom_target(translations ALL)