From: myd7349 Date: Tue, 13 Aug 2019 12:11:58 +0000 (+0800) Subject: fix static build X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c84a028f15715f0c79b36af6f1dbd84daccffceb;p=onig fix static build --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c59bfe3..12d0ec9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,9 @@ target_include_directories(onig PUBLIC $ $) +target_compile_definitions(onig PUBLIC + $<$>:ONIG_STATIC>) + if(MSVC) target_compile_options(onig PRIVATE #/W4 @@ -75,7 +78,6 @@ if(MSVC) $<$:/MT> $<$:/MTd> ) - target_compile_definitions(onig PUBLIC -DONIG_STATIC) endif() elseif(CMAKE_COMPILER_IS_GNUCC) target_compile_options(onig PRIVATE diff --git a/src/onigposix.h b/src/onigposix.h index 324069c..5ff779f 100644 --- a/src/onigposix.h +++ b/src/onigposix.h @@ -95,6 +95,7 @@ typedef struct { #endif #endif +#ifndef ONIG_STATIC #ifndef ONIG_EXTERN #if defined(_WIN32) && !defined(__GNUC__) #if defined(ONIGURUMA_EXPORT) @@ -108,6 +109,9 @@ typedef struct { #ifndef ONIG_EXTERN #define ONIG_EXTERN extern #endif +#else +#define ONIG_EXTERN extern +#endif #ifndef ONIGURUMA_H typedef unsigned int OnigOptionType;