File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -150,13 +150,18 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
150
150
endif ()
151
151
152
152
include (CheckCXXCompilerFlag )
153
+ function (CxxAppendCompilerFlag flagstr )
154
+ string (TOUPPER "${flagstr} " auto_flag_var )
155
+ string (REGEX REPLACE "[^A-Z0-9]" "_" auto_flag_var "${auto_flag_var} " )
156
+ check_cxx_compiler_flag ("${flagstr} " CXX_${auto_flag_var} )
157
+ if (CXX_${auto_flag_var} )
158
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flagstr} " PARENT_SCOPE )
159
+ endif ()
160
+ endfunction ()
153
161
154
162
# Set default symbol visibility to 'hidden'
155
163
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 ()
164
+ CxxAppendCompilerFlag ("-fvisibility=hidden" )
160
165
endif ()
161
166
162
167
find_program (CCACHE_FOUND ccache )
You can’t perform that action at this time.
0 commit comments