summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Hawicz <erh+git@nimenees.com>2021-05-01 15:21:31 -0400
committerGitHub <noreply@github.com>2021-05-01 15:21:31 -0400
commitcd7109f767a6d9f20caa9d10fbf4eab9c5262e7a (patch)
tree8d304f648b53bf7c81d2b087f03952f89c8babb2
parent78e390a26155e5c6d71cc5b742b3c4cb2d4b3fe6 (diff)
parentba181548bca566d320899f7b78e5b753c0dba611 (diff)
downloadjson-c-cd7109f767a6d9f20caa9d10fbf4eab9c5262e7a.tar.gz
Merge pull request #696 from ssrlive/master
To avoid target exe file export JSON functions.
-rw-r--r--CMakeLists.txt4
-rw-r--r--debug.h2
-rw-r--r--json_c_version.h2
-rw-r--r--json_types.h2
-rw-r--r--printbuf.h2
5 files changed, 8 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 887b4d5..e870cca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,6 +79,10 @@ include(CMakePackageConfigHelpers)
option(BUILD_SHARED_LIBS "Default to building shared libraries" ON)
option(BUILD_STATIC_LIBS "Default to building static libraries" ON)
+if (BUILD_SHARED_LIBS)
+ add_definitions(-D JSON_C_DLL)
+endif()
+
# Generate a release merge and test it to verify the correctness of republishing the package.
ADD_CUSTOM_TARGET(distcheck
COMMAND make package_source
diff --git a/debug.h b/debug.h
index a24136b..7463f86 100644
--- a/debug.h
+++ b/debug.h
@@ -24,7 +24,7 @@ extern "C" {
#endif
#ifndef JSON_EXPORT
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && defined(JSON_C_DLL)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern
diff --git a/json_c_version.h b/json_c_version.h
index 00de4b3..d15ad64 100644
--- a/json_c_version.h
+++ b/json_c_version.h
@@ -24,7 +24,7 @@ extern "C" {
#define JSON_C_VERSION "0.15.99"
#ifndef JSON_EXPORT
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && defined(JSON_C_DLL)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern
diff --git a/json_types.h b/json_types.h
index 67f4497..b7e55ad 100644
--- a/json_types.h
+++ b/json_types.h
@@ -18,7 +18,7 @@ extern "C" {
#endif
#ifndef JSON_EXPORT
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && defined(JSON_C_DLL)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern
diff --git a/printbuf.h b/printbuf.h
index bfcbd2b..a0da668 100644
--- a/printbuf.h
+++ b/printbuf.h
@@ -24,7 +24,7 @@
#define _printbuf_h_
#ifndef JSON_EXPORT
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && defined(JSON_C_DLL)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern