aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--CMakeLists.txt27
-rw-r--r--vmime/export.hpp36
3 files changed, 57 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 1c3c6d3d..9c529554 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,7 +25,8 @@ doc/html/*
/libvmime.a
/vmime.pc
/vmime/config.hpp
-/vmime/export.hpp
+/vmime/export-static.hpp
+/vmime/export-shared.hpp
/COPYING.txt
/build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96787c22..792ebc28 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,13 +78,15 @@ FILE(
vmime/*
)
-LIST(APPEND VMIME_LIBRARY_GENERATED_INCLUDE_FILES "vmime/config.hpp")
-LIST(APPEND VMIME_LIBRARY_GENERATED_INCLUDE_FILES "vmime/export.hpp")
+LIST(APPEND VMIME_LIBRARY_INCLUDE_FILES "vmime/config.hpp")
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
)
+INCLUDE(GenerateExportHeader)
+ADD_COMPILER_EXPORT_FLAGS()
+
# Shared library
OPTION(
VMIME_BUILD_SHARED_LIBRARY
@@ -94,10 +96,6 @@ OPTION(
IF(VMIME_BUILD_SHARED_LIBRARY)
- INCLUDE(GenerateExportHeader)
-
- ADD_COMPILER_EXPORT_FLAGS()
-
ADD_LIBRARY(
${VMIME_LIBRARY_NAME}
SHARED
@@ -108,14 +106,18 @@ IF(VMIME_BUILD_SHARED_LIBRARY)
GENERATE_EXPORT_HEADER(
${VMIME_LIBRARY_NAME}
BASE_NAME VMIME
- EXPORT_FILE_NAME ${CMAKE_SOURCE_DIR}/vmime/export.hpp
+ STATIC_DEFINE VMIME_STATIC
+ EXPORT_FILE_NAME ${CMAKE_SOURCE_DIR}/vmime/export-shared.hpp
)
+ LIST(APPEND VMIME_LIBRARY_INCLUDE_FILES "vmime/export-shared.hpp")
+
SET_TARGET_PROPERTIES(
${VMIME_LIBRARY_NAME}
PROPERTIES
VERSION "${VMIME_API_VERSION}"
SOVERSION "${VMIME_API_VERSION_CURRENT}"
+ COMPILE_FLAGS -DVMIME_SHARED
)
ENDIF()
@@ -139,11 +141,20 @@ IF(VMIME_BUILD_STATIC_LIBRARY)
${VMIME_LIBRARY_INCLUDE_FILES}
)
+ GENERATE_EXPORT_HEADER(
+ ${VMIME_LIBRARY_NAME}-static
+ BASE_NAME VMIME
+ STATIC_DEFINE VMIME_STATIC
+ EXPORT_FILE_NAME ${CMAKE_SOURCE_DIR}/vmime/export-static.hpp
+ )
+
+ LIST(APPEND VMIME_LIBRARY_INCLUDE_FILES "vmime/export-static.hpp")
+
SET_TARGET_PROPERTIES(
${VMIME_LIBRARY_NAME}-static
PROPERTIES
OUTPUT_NAME ${VMIME_LIBRARY_NAME}
- COMPILE_FLAGS -DVMIME_STATIC_DEFINE
+ COMPILE_FLAGS -DVMIME_STATIC
)
ENDIF()
diff --git a/vmime/export.hpp b/vmime/export.hpp
new file mode 100644
index 00000000..90f0cc3a
--- /dev/null
+++ b/vmime/export.hpp
@@ -0,0 +1,36 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2013 Vincent Richard <[email protected]>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 3 of
+// the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// Linking this library statically or dynamically with other modules is making
+// a combined work based on this library. Thus, the terms and conditions of
+// the GNU General Public License cover the whole combination.
+//
+
+#ifndef VMIME_EXPORT_HPP_INCLUDED
+#define VMIME_EXPORT_HPP_INCLUDED
+
+
+// Define VMIME_STATIC if you are linking with the static library
+#ifdef VMIME_STATIC
+# include "vmime/export-static.hpp"
+#else
+# include "vmime/export-shared.hpp"
+#endif
+
+
+#endif // VMIME_EXPORT_HPP_INCLUDED