2012-04-06 15:01:58 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
project(qtkeychain)
|
|
|
|
|
2012-05-02 00:34:44 +00:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2012-04-06 15:01:58 +00:00
|
|
|
find_package(Qt4 COMPONENTS QtCore REQUIRED)
|
|
|
|
include_directories(${QT_INCLUDES})
|
|
|
|
|
2012-04-30 13:03:36 +00:00
|
|
|
list(APPEND qtkeychain_LIBRARIES ${QT_QTCORE_LIBRARY})
|
2012-04-06 15:01:58 +00:00
|
|
|
set(qtkeychain_SOURCES
|
|
|
|
keychain.cpp
|
|
|
|
)
|
|
|
|
|
2012-04-30 13:03:36 +00:00
|
|
|
|
2012-04-06 15:01:58 +00:00
|
|
|
if(WIN32)
|
|
|
|
list(APPEND qtkeychain_SOURCES keychain_win.cpp)
|
2012-04-30 13:03:36 +00:00
|
|
|
list(APPEND qtkeychain_LIBRARIES crypt32)
|
2012-05-05 06:54:06 +00:00
|
|
|
#FIXME: mingw bug; otherwise getting undefined refs to RtlSecureZeroMemory there
|
|
|
|
if(MINGW)
|
|
|
|
add_definitions( -O2 )
|
|
|
|
endif()
|
2012-04-06 15:01:58 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
list(APPEND qtkeychain_SOURCES keychain_mac.cpp)
|
2012-04-30 13:03:36 +00:00
|
|
|
|
|
|
|
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
|
|
|
list(APPEND qtkeychain_LIBRARIES ${COREFOUNDATION_LIBRARY})
|
|
|
|
|
|
|
|
find_library(SECURITY_LIBRARY Security)
|
|
|
|
list(APPEND qtkeychain_LIBRARIES ${SECURITY_LIBRARY})
|
2012-04-06 15:01:58 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
list(APPEND qtkeychain_SOURCES keychain_dbus.cpp)
|
|
|
|
endif()
|
|
|
|
|
2012-05-05 08:37:48 +00:00
|
|
|
QT4_WRAP_CPP(qtkeychain_MOC_OUTFILES keychain.h keychain_p.h)
|
|
|
|
|
2012-04-06 15:01:58 +00:00
|
|
|
if(NOT QTKEYCHAIN_STATIC)
|
2012-05-05 08:37:48 +00:00
|
|
|
add_library(qtkeychain SHARED ${qtkeychain_SOURCES} ${qtkeychain_MOC_OUTFILES})
|
2012-04-06 15:01:58 +00:00
|
|
|
set_target_properties(qtkeychain PROPERTIES COMPILE_DEFINITIONS QKEYCHAIN_BUILD_QKEYCHAIN_LIB)
|
2012-05-01 23:55:31 +00:00
|
|
|
target_link_libraries(qtkeychain ${qtkeychain_LIBRARIES})
|
2012-04-06 15:01:58 +00:00
|
|
|
else()
|
2012-05-05 08:37:48 +00:00
|
|
|
add_library(qtkeychain STATIC ${qtkeychain_SOURCES} ${qtkeychain_MOC_OUTFILES})
|
2012-05-01 23:55:31 +00:00
|
|
|
set_target_properties(qtkeychain PROPERTIES COMPILE_DEFINITIONS QKEYCHAIN_STATICLIB)
|
|
|
|
endif()
|
2012-05-02 00:34:44 +00:00
|
|
|
|
|
|
|
set_target_properties(qtkeychain PROPERTIES
|
|
|
|
VERSION 0
|
|
|
|
SOVERSION 0
|
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES keychain.h
|
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qtkeychain/
|
|
|
|
)
|
|
|
|
|
|
|
|
install(TARGETS qtkeychain
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
)
|
2012-05-07 14:44:55 +00:00
|
|
|
|
|
|
|
add_executable( testclient testclient.cpp )
|
|
|
|
target_link_libraries( testclient qtkeychain)
|