From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Tue, 2 Mar 2021 06:27:40 +0000 (+0800) Subject: To avoid target exe file export JSON functions. X-Git-Tag: json-c-0.16-20220414~37^2~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F696%2Fhead;p=thirdparty%2Fjson-c.git To avoid target exe file export JSON functions. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 79038aa3..60fa7e10 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 a24136b8..7463f863 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 00de4b3f..d15ad64c 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 67f4497f..b7e55ada 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 bfcbd2b2..a0da668e 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