File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ option(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occ
76
76
option (JSONCPP_WITH_STRICT_ISO "Issue all the warnings demanded by strict ISO C and ISO C++" ON )
77
77
option (JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON )
78
78
option (JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" ON )
79
+ option (JSONCPP_VISIBILITY_HIDDEN "Build with default hidden visibility" ON )
79
80
option (BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF )
80
81
81
82
# Enable runtime search path support for dynamic libraries on OSX
@@ -148,6 +149,16 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
148
149
endif ()
149
150
endif ()
150
151
152
+ include (CheckCXXCompilerFlag )
153
+
154
+ # Set default symbol visibility to 'hidden'
155
+ if (JSONCPP_VISIBILITY_HIDDEN )
156
+ check_cxx_compiler_flag ("-fvisibility=hidden" VISIBILITY_HIDDEN_SUPPORTED )
157
+ if (VISIBILITY_HIDDEN_SUPPORTED )
158
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
159
+ endif ()
160
+ endif ()
161
+
151
162
find_program (CCACHE_FOUND ccache )
152
163
if (CCACHE_FOUND )
153
164
set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache )
You can’t perform that action at this time.
0 commit comments