From cc799db47094514c87b19c91626703ef823bb5ef Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 18 Nov 2013 12:54:43 +0100 Subject: [PATCH] CMake: Fix target name when compiling with Qt4 This way it picks up the correct target name when no command line parameters are specified and only Qt4 is installed. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a18ad83..f4ec3eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,14 +15,12 @@ option(BUILD_WITH_QT4 "Build qtkeychain with Qt4 no matter if Qt5 was found" OFF if( NOT BUILD_WITH_QT4 ) - set(QTKEYCHAIN_VERSION_INFIX 5) # try Qt5 first, and prefer that if found find_package(Qt5Core QUIET) endif() -set(QTKEYCHAIN_TARGET_NAME qt${QTKEYCHAIN_VERSION_INFIX}keychain) - if (Qt5Core_FOUND) + set(QTKEYCHAIN_VERSION_INFIX 5) if(UNIX AND NOT APPLE) find_package(Qt5DBus REQUIRED) include_directories(${Qt5DBus_INCLUDE_DIRS}) @@ -53,6 +51,7 @@ if (Qt5Core_FOUND) endif() endif() else() + set(QTKEYCHAIN_VERSION_INFIX "") if(UNIX AND NOT APPLE) find_package(Qt4 COMPONENTS QtCore QtDBus REQUIRED) set(QTDBUS_LIBRARIES ${QT_QTDBUS_LIBRARY}) @@ -123,6 +122,7 @@ add_custom_target(translations DEPENDS ${qtkeychain_QM_FILES}) #install(FILES ${qtkeychain_QM_FILES} # DESTINATION ${QT_TRANSLATIONS_DIR}) +set(QTKEYCHAIN_TARGET_NAME qt${QTKEYCHAIN_VERSION_INFIX}keychain) if(NOT QTKEYCHAIN_STATIC) add_library(${QTKEYCHAIN_TARGET_NAME} SHARED ${qtkeychain_SOURCES} ${qtkeychain_MOC_OUTFILES} ${qtkeychain_QM_FILES}) set_target_properties(${QTKEYCHAIN_TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS QKEYCHAIN_BUILD_QKEYCHAIN_LIB)