From 613a41ce8589222c407ace0b2fe84ab7b6ed038c Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 17 Jul 2016 19:05:32 -0700 Subject: [PATCH] All: Fix CMake install path handling some --- CMakeLists.txt | 6 +++--- src/platform/qt/CMakeLists.txt | 16 +++++++++------- src/platform/qt/GBAApp.cpp | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 977dace92..3d84c135f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,14 +56,14 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (e.g. Release or Debug)" FORCE) endif() -set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}") - include(GNUInstallDirs) if (NOT DEFINED LIBDIR) - set(LIBDIR "lib") + set(LIBDIR "${CMAKE_INSTALL_LIBDIR}") endif() +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}") + if (NOT DEFINED MANDIR) set(MANDIR ${CMAKE_INSTALL_MANDIR}) endif() diff --git a/src/platform/qt/CMakeLists.txt b/src/platform/qt/CMakeLists.txt index 74e01d72a..877a77ab4 100644 --- a/src/platform/qt/CMakeLists.txt +++ b/src/platform/qt/CMakeLists.txt @@ -165,15 +165,17 @@ if(WIN32) list(APPEND QT_LIBRARIES qwindows imm32) endif() endif() -if(APPLE) - set(DATA_DIR Applications/${PROJECT_NAME}.app/Contents/Resources) -else() - set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) +if(NOT DEFINED DATADIR) + if(APPLE) + set(DATADIR Applications/${PROJECT_NAME}.app/Contents/Resources) + else() + set(DATADIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) + endif() endif() -install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/shaders DESTINATION ${DATA_DIR} COMPONENT ${BINARY_NAME}-qt) -install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATA_DIR} COMPONENT ${BINARY_NAME}-qt) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/shaders DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt) +install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt) if(NOT WIN32 AND NOT APPLE) - list(APPEND QT_DEFINES DATA_DIR="${DATA_DIR}") + list(APPEND QT_DEFINES DATADIR="${DATADIR}") endif() add_executable(${BINARY_NAME}-qt WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES} ${PLATFORM_SRC} ${UI_FILES} ${AUDIO_SRC} ${RESOURCES}) diff --git a/src/platform/qt/GBAApp.cpp b/src/platform/qt/GBAApp.cpp index 7e6da3bdf..25ec364cb 100644 --- a/src/platform/qt/GBAApp.cpp +++ b/src/platform/qt/GBAApp.cpp @@ -186,8 +186,8 @@ QFileDialog* GBAApp::getSaveFileDialog(QWidget* owner, const QString& title, con } QString GBAApp::dataDir() { -#ifdef DATA_DIR - QString path = QString::fromUtf8(DATA_DIR); +#ifdef DATADIR + QString path = QString::fromUtf8(DATADIR); #else QString path = QCoreApplication::applicationDirPath(); #ifdef Q_OS_MAC