From 6bcdb10eeec725a0b3513fc5c8f9b8590acaf209 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sat, 3 Jan 2015 13:17:57 +0100 Subject: [PATCH] CMake: simplify some expressions --- CMakeLists.txt | 43 ++++++++++---------- Externals/miniupnpc/CMakeLists.txt | 2 +- Externals/wxWidgets3/CMakeLists.txt | 4 +- Source/Core/AudioCommon/CMakeLists.txt | 4 +- Source/Core/Common/CMakeLists.txt | 2 +- Source/Core/Core/CMakeLists.txt | 4 +- Source/Core/DolphinQt/CMakeLists.txt | 4 +- Source/Core/DolphinWX/CMakeLists.txt | 6 +-- Source/Core/InputCommon/CMakeLists.txt | 8 ++-- Source/Core/VideoBackends/OGL/CMakeLists.txt | 5 +-- Source/Core/VideoCommon/CMakeLists.txt | 2 +- Source/DSPTool/CMakeLists.txt | 2 +- Source/UnitTests/CMakeLists.txt | 2 +- 13 files changed, 42 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6df8a5bcb0..528b1cbb17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ option(FASTLOG "Enable all logs" OFF) option(OPROFILING "Enable profiling" OFF) option(GDBSTUB "Enable gdb stub for remote debugging." OFF) -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(APPLE) option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF) endif() ######################################## @@ -52,7 +52,7 @@ set(DOLPHIN_IS_STABLE FALSE) set(LIBS) # Set up paths -if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) +if(APPLE) # The gettext module will install the translations unconditionally. # Redirect the installation to a build directory where it does no harm. set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install-dummy) @@ -145,7 +145,7 @@ endif() if(NOT ENABLE_GENERIC) if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR - ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + APPLE) if(_ARCH_64) set(_M_X86 1) set(_M_X86_64 1) @@ -159,7 +159,7 @@ if(NOT ENABLE_GENERIC) set(_M_ARM_32 1) add_definitions(-D_M_ARM=1 -D_M_ARM_32=1) add_definitions(-marm -march=armv7-a) - elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") + elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") # This option only applies to 64bit ARM set(_M_ARM 1) set(_M_ARM_64 1) @@ -531,7 +531,7 @@ else(ZLIB_FOUND) include_directories(Externals/zlib) endif(ZLIB_FOUND) -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) +if(NOT APPLE AND NOT ANDROID) check_lib(LZO lzo2 lzo/lzo1x.h QUIET) endif() if(LZO_FOUND) @@ -544,7 +544,7 @@ else() endif() list(APPEND LIBS ${LZO}) -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) +if(NOT APPLE AND NOT ANDROID) check_lib(PNG png png.h QUIET) endif() if (PNG_FOUND) @@ -557,7 +557,7 @@ else() endif() if(OPENAL_FOUND) - if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(NOT APPLE) check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h QUIET) endif() if (SOUNDTOUCH_FOUND) @@ -570,7 +570,7 @@ if(OPENAL_FOUND) endif() if(NOT ANDROID) - if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(NOT APPLE) include(FindSDL2 OPTIONAL) endif() if(SDL2_FOUND) @@ -579,7 +579,7 @@ if(NOT ANDROID) include_directories(${SDL2_INCLUDE_DIR}) else(SDL2_FOUND) # SDL2 not found, try SDL - if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(NOT APPLE) include(FindSDL OPTIONAL) endif() if(SDL_FOUND) @@ -601,7 +601,7 @@ if(LIBUSB_FOUND) endif(LIBUSB_FOUND) set(SFML_REQD_VERSION 2.1) -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) +if(NOT APPLE AND NOT ANDROID) find_package(SFML ${SFML_REQD_VERSION} COMPONENTS network system) endif() if(SFML_FOUND) @@ -614,7 +614,7 @@ else() endif() if(USE_UPNP) - if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) + if(NOT APPLE AND NOT ANDROID) include(FindMiniupnpc) endif() if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER) @@ -629,7 +629,7 @@ if(USE_UPNP) list(APPEND LIBS miniupnpc) endif() -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) +if(NOT APPLE AND NOT ANDROID) include(FindPolarSSL) endif() if(POLARSSL_FOUND AND POLARSSL_WORKS) @@ -642,7 +642,7 @@ else() include_directories(Externals/polarssl/include) endif() -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) +if(NOT APPLE AND NOT ANDROID) check_lib(SOIL SOIL SOIL/SOIL.h QUIET) endif() if(SOIL_FOUND) @@ -724,15 +724,15 @@ if(NOT DISABLE_WX AND NOT ANDROID) # These definitions and includes are used when building dolphin against wx, # not when building wx itself (see wxw3 CMakeLists.txt for that) - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(APPLE) add_definitions(-D__WXOSX_COCOA__) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 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) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + elseif(WIN32) add_definitions(-D__WXMSW__) else() message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform") @@ -748,12 +748,11 @@ if(NOT DISABLE_WX AND NOT ANDROID) add_definitions(-DHAVE_WX=1) endif(NOT DISABLE_WX AND NOT ANDROID) -if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR - ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") +if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD") set(LIBS ${LIBS} usbhid) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(APPLE) # Link against OS X system frameworks. list(APPEND LIBS ${APPKIT_LIBRARY} @@ -809,13 +808,13 @@ add_subdirectory(Source) ######################################## # Install shared data files # -if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) +if(NOT APPLE) install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN) endif() -if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")) +if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin") install(FILES Data/license.txt DESTINATION ${datadir}) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") # Install the application icon and menu item install(FILES Installer/dolphin-emu.xpm DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps) diff --git a/Externals/miniupnpc/CMakeLists.txt b/Externals/miniupnpc/CMakeLists.txt index 404ef65b94..334488bd48 100644 --- a/Externals/miniupnpc/CMakeLists.txt +++ b/Externals/miniupnpc/CMakeLists.txt @@ -14,7 +14,7 @@ elseif(WIN32) set(LDLIBS ${WINSOCK2_LIBRARY} ${IPHLPAPI_LIBRARY} ${LDLIBS}) endif() -if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") +if(APPLE) add_definitions(-DMACOSX -D_DARWIN_C_SOURCE) endif() diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 68e35ae54a..617a5266c9 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -861,7 +861,7 @@ set(SRCS ${SRCS_COMMON} ${SRCS_GENERIC}) -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98") add_definitions(-D__WXOSX_COCOA__) set(SRCS @@ -882,7 +882,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ${IOK_LIBRARY} ${OPENGL_LIBRARY} ${QUICKTIME_LIBRARY}) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") add_definitions(-D__WXGTK__) set(SRCS diff --git a/Source/Core/AudioCommon/CMakeLists.txt b/Source/Core/AudioCommon/CMakeLists.txt index 8423164226..c36300b198 100644 --- a/Source/Core/AudioCommon/CMakeLists.txt +++ b/Source/Core/AudioCommon/CMakeLists.txt @@ -33,9 +33,7 @@ endif(PULSEAUDIO_FOUND) if(WIN32) set(SRCS ${SRCS} XAudio2Stream.cpp) -endif(WIN32) - -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +elseif(APPLE) set(SRCS ${SRCS} CoreAudioSoundStream.cpp) endif() diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index 63d903ddfb..d827d389aa 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -61,7 +61,7 @@ if(WIN32) endif(WIN32) set(LIBS "${CMAKE_THREAD_LIBS_INIT}") -if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND (NOT ANDROID)) +if(NOT APPLE AND NOT ANDROID) set(LIBS ${LIBS} rt) endif() diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index c241a1c7ba..3af53428ac 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -256,13 +256,13 @@ set(LIBS ${LIBS} ${POLARSSL_LIBRARY}) if(WIN32) set(SRCS ${SRCS} HW/BBA-TAP/TAP_Win32.cpp HW/WiimoteReal/IOWin.cpp) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +elseif(APPLE) set(SRCS ${SRCS} HW/BBA-TAP/TAP_Apple.cpp HW/WiimoteReal/IOdarwin.mm) set(LIBS ${LIBS} ${IOB_LIBRARY}) elseif(UNIX) set(SRCS ${SRCS} HW/BBA-TAP/TAP_Unix.cpp) - if((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND BLUEZ_FOUND) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND BLUEZ_FOUND) set(SRCS ${SRCS} HW/WiimoteReal/IONix.cpp) set(LIBS ${LIBS} bluetooth) else() diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 6f25f894b4..8d12e4d5f4 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -31,7 +31,7 @@ set(UIS list(APPEND LIBS core uicommon) -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(APPLE) set(DOLPHINQT_BINARY DolphinQt) else() set(DOLPHINQT_BINARY dolphin-emu-qt) @@ -42,7 +42,7 @@ add_executable(${DOLPHINQT_BINARY} ${SRCS} ${UI_HEADERS}) target_link_libraries(${DOLPHINQT_BINARY} ${LIBS}) qt5_use_modules(${DOLPHINQT_BINARY} Widgets) -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(APPLE) # Note: This is based on the DolphinWX version. include(BundleUtilities) diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index cdc503b8fc..48e637e54a 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -66,7 +66,7 @@ endif() set(ANDROID_SRCS Android/ButtonManager.cpp MainAndroid.cpp) -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(APPLE) if(wxWidgets_FOUND) list(APPEND WXLIBS ${APPSERV_LIBRARY} @@ -80,7 +80,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") MACOSX_PACKAGE_LOCATION Resources) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(APPLE) set(DOLPHIN_EXE_BASE Dolphin) else() set(DOLPHIN_EXE_BASE dolphin-emu) @@ -123,7 +123,7 @@ if(ANDROID) elseif(wxWidgets_FOUND) add_executable(${DOLPHIN_EXE} ${SRCS} ${GUI_SRCS}) target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS}) - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(APPLE) include(BundleUtilities) set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index a305bb5b2a..75679b6a9f 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -14,10 +14,10 @@ if(WIN32) ControllerInterface/DInput/DInputKeyboardMouse.cpp ControllerInterface/XInput/XInput.cpp ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) - FIND_LIBRARY(CARBON_LIBRARY Carbon) - FIND_LIBRARY(COCOA_LIBRARY Cocoa) +elseif(APPLE) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + find_library(CARBON_LIBRARY Carbon) + find_library(COCOA_LIBRARY Cocoa) set(SRCS ${SRCS} ControllerInterface/OSX/OSX.mm ControllerInterface/OSX/OSXKeyboard.mm diff --git a/Source/Core/VideoBackends/OGL/CMakeLists.txt b/Source/Core/VideoBackends/OGL/CMakeLists.txt index 6d972e538c..85964a3185 100644 --- a/Source/Core/VideoBackends/OGL/CMakeLists.txt +++ b/Source/Core/VideoBackends/OGL/CMakeLists.txt @@ -26,7 +26,7 @@ endif() if(WIN32) set(SRCS ${SRCS} GLInterface/WGL.cpp) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +elseif(APPLE) set(SRCS ${SRCS} GLInterface/AGL.cpp) elseif(USE_X11) if (NOT USE_EGL) @@ -51,8 +51,7 @@ if(USE_EGL) set(LIBS ${LIBS} EGL) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR - ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") +if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD") set(LIBS ${LIBS} usbhid) endif() diff --git a/Source/Core/VideoCommon/CMakeLists.txt b/Source/Core/VideoCommon/CMakeLists.txt index a450a8e379..2101a719c2 100644 --- a/Source/Core/VideoCommon/CMakeLists.txt +++ b/Source/Core/VideoCommon/CMakeLists.txt @@ -59,7 +59,7 @@ endif() add_dolphin_library(videocommon "${SRCS}" "${LIBS}") -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(LIBAV_FOUND) target_link_libraries(videocommon ${LIBS} ${LIBAV_LIBRARIES}) endif() diff --git a/Source/DSPTool/CMakeLists.txt b/Source/DSPTool/CMakeLists.txt index 11953842e8..d18ed8def0 100644 --- a/Source/DSPTool/CMakeLists.txt +++ b/Source/DSPTool/CMakeLists.txt @@ -1,5 +1,5 @@ add_executable(dsptool DSPTool.cpp) target_link_libraries(dsptool core) -if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) +if(NOT APPLE) install(TARGETS dsptool RUNTIME DESTINATION ${bindir}) endif() diff --git a/Source/UnitTests/CMakeLists.txt b/Source/UnitTests/CMakeLists.txt index bfe197fcfb..2ec996ce46 100644 --- a/Source/UnitTests/CMakeLists.txt +++ b/Source/UnitTests/CMakeLists.txt @@ -1,5 +1,5 @@ set(LIBS core gtest) -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(APPLE) list(APPEND LIBS ${FOUNDATION_LIBRARY} ${CORESERV_LIBRARY}) endif() macro(add_dolphin_test target srcs)