74 lines
1.9 KiB
CMake
74 lines
1.9 KiB
CMake
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
|
||
|
|
||
|
FIND_PACKAGE(Qt4 REQUIRED)
|
||
|
FIND_PACKAGE(Boost REQUIRED)
|
||
|
|
||
|
SET(KEYCHAIN-SOURCES
|
||
|
keychain.cpp
|
||
|
default_keychain.cpp)
|
||
|
|
||
|
INCLUDE(${QT_USE_FILE})
|
||
|
|
||
|
IF(APPLE)
|
||
|
FIND_LIBRARY(SECURITY Security)
|
||
|
LIST(APPEND KEYCHAIN-SOURCES mac_keychain.cpp)
|
||
|
ELSEIF(UNIX)
|
||
|
# Find Gnome Keyring
|
||
|
FIND_PACKAGE(PkgConfig REQUIRED)
|
||
|
pkg_check_modules(GNOME_KEYRING gnome-keyring-1>=0.8)
|
||
|
IF(NOT GNOME_KEYRING_FOUND)
|
||
|
MESSAGE("Gnome keyring not found")
|
||
|
ADD_DEFINITIONS(-DNO_GNOME_KEYRING)
|
||
|
ELSE(NOT GNOME_KEYRING_FOUND)
|
||
|
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
|
||
|
LIST(APPEND KEYCHAIN-SOURCES gnome_keychain.cpp)
|
||
|
ENDIF(NOT GNOME_KEYRING_FOUND)
|
||
|
|
||
|
# Find KDE4 KWallet dbus interface
|
||
|
FIND_FILE(KWALLET_INTERFACE
|
||
|
org.kde.KWallet.xml
|
||
|
PATHS /usr/share/dbus-1/interfaces)
|
||
|
|
||
|
IF(${KWALLET_INTERFACE} MATCHES "KWALLET_INTERFACE-NOTFOUND")
|
||
|
SET(KWALLET_INTERFACE_NOTFOUND TRUE)
|
||
|
ENDIF(${KWALLET_INTERFACE} MATCHES "KWALLET_INTERFACE-NOTFOUND")
|
||
|
|
||
|
IF(KWALLET_INTERFACE_NOTFOUND)
|
||
|
MESSAGE("KWallet interface not found")
|
||
|
ADD_DEFINITIONS(-DNO_KWALLET)
|
||
|
ELSE(KWALLET_INTERFACE_NOTFOUND)
|
||
|
LIST(APPEND KEYCHAIN-SOURCES kwallet_keychain.cpp)
|
||
|
SET(QT_USE_QTDBUS 1)
|
||
|
QT4_ADD_DBUS_INTERFACE(KWALLET_INTERFACE-SOURCES ${KWALLET_INTERFACE} kwallet)
|
||
|
ENDIF(KWALLET_INTERFACE_NOTFOUND)
|
||
|
ENDIF(APPLE)
|
||
|
|
||
|
INCLUDE_DIRECTORIES(
|
||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||
|
${GNOME_KEYRING_INCLUDE_DIRS}
|
||
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||
|
${CMAKE_CURRENT_BINARY_DIR}/..
|
||
|
)
|
||
|
|
||
|
ADD_LIBRARY(keychain STATIC
|
||
|
${KEYCHAIN-SOURCES}
|
||
|
${KWALLET_INTERFACE-SOURCES})
|
||
|
|
||
|
TARGET_LINK_LIBRARIES(keychain
|
||
|
${QT_LIBRARIES}
|
||
|
${SECURITY}
|
||
|
${GNOME_KEYRING_LIBRARIES}
|
||
|
)
|
||
|
|
||
|
IF(NOT KWALLET_INTERFACE_NOTFOUND)
|
||
|
TARGET_LINK_LIBRARIES(keychain
|
||
|
${QT_DBUS_LIBRARY}
|
||
|
${QT_QTDBUS_LIBRARY}
|
||
|
)
|
||
|
|
||
|
INCLUDE_DIRECTORIES(${QT_QTDBUS_INCLUDE_DIR})
|
||
|
ENDIF(NOT KWALLET_INTERFACE_NOTFOUND)
|
||
|
|
||
|
LINK_DIRECTORIES(${GNOME_KEYRING_LIBRARY_DIRS})
|