[Pkg-owncloud-commits] [qtkeychain] 11/63: Fix export macro for static builds and export link libraries

Sandro Knauß hefee at debian.org
Sat Jun 10 14:39:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

hefee pushed a commit to branch master
in repository qtkeychain.

commit c6bcd56643f0a3e359d4880156280134b05aeb53
Author: Hannah von Reth <vonreth at kde.org>
Date:   Fri Aug 5 09:52:45 2016 +0200

    Fix export macro for static builds and export link libraries
---
 CMakeLists.txt     | 17 +++++++++++------
 qkeychain_export.h | 17 -----------------
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index acb4b98..b78910f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.11)
 project(qtkeychain)
 
 ###
@@ -10,6 +10,7 @@ set(QTKEYCHAIN_SOVERSION 1)
 
 set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
 include(GNUInstallDirs)
+include(GenerateExportHeader)
 
 option(BUILD_WITH_QT4 "Build qtkeychain with Qt4 no matter if Qt5 was found" OFF)
 option(BUILD_TRANSLATIONS "Build translations" ON)
@@ -160,13 +161,18 @@ endif( BUILD_TRANSLATIONS )
 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)
-    target_link_libraries(${QTKEYCHAIN_TARGET_NAME} ${qtkeychain_LIBRARIES})
 else()
     add_library(${QTKEYCHAIN_TARGET_NAME} STATIC ${qtkeychain_SOURCES} ${qtkeychain_MOC_OUTFILES} ${qtkeychain_QM_FILES})
-    set_target_properties(${QTKEYCHAIN_TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS QKEYCHAIN_STATICLIB )
 endif()
 
+target_link_libraries(${QTKEYCHAIN_TARGET_NAME} PUBLIC ${qtkeychain_LIBRARIES})
+
+
+generate_export_header(${QTKEYCHAIN_TARGET_NAME}
+  EXPORT_FILE_NAME qkeychain_export.h
+  EXPORT_MACRO_NAME QKEYCHAIN_EXPORT
+)
+
 set_target_properties(${QTKEYCHAIN_TARGET_NAME} PROPERTIES
     VERSION ${QTKEYCHAIN_VERSION}
     SOVERSION ${QTKEYCHAIN_SOVERSION}
@@ -174,7 +180,7 @@ set_target_properties(${QTKEYCHAIN_TARGET_NAME} PROPERTIES
     INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
 )
 
-install(FILES keychain.h qkeychain_export.h
+install(FILES keychain.h ${CMAKE_CURRENT_BINARY_DIR}/qkeychain_export.h
         DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qt${QTKEYCHAIN_VERSION_INFIX}keychain/
 )
 
@@ -187,7 +193,6 @@ install(TARGETS ${QTKEYCHAIN_TARGET_NAME}
 
 add_executable( testclient testclient.cpp )
 target_link_libraries( testclient ${QTKEYCHAIN_TARGET_NAME} ${qtkeychain_LIBRARIES})
-set_target_properties( testclient PROPERTIES COMPILE_DEFINITIONS QKEYCHAIN_STATICLIB )
 
 
 ###
diff --git a/qkeychain_export.h b/qkeychain_export.h
deleted file mode 100644
index 1bb1669..0000000
--- a/qkeychain_export.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef QKEYCHAIN_EXPORT_H
-#define QKEYCHAIN_EXPORT_H
-
-#include <qglobal.h>
-
-# ifdef QKEYCHAIN_STATICLIB
-#  undef QKEYCHAIN_SHAREDLIB
-#  define QKEYCHAIN_EXPORT
-# else
-#  ifdef QKEYCHAIN_BUILD_QKEYCHAIN_LIB
-#   define QKEYCHAIN_EXPORT Q_DECL_EXPORT
-#  else
-#   define QKEYCHAIN_EXPORT Q_DECL_IMPORT
-#  endif
-# endif
-
-#endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/qtkeychain.git



More information about the Pkg-owncloud-commits mailing list