Skip to content

Commit d2b6992

Browse files
Fix build issues related to Solaris and older GCC
Fixed two build issues: - JsonCPP currently doesn’t compile for Solaris due to platform differences with ‘isfinite’ function. Fixed by adding proper include and define for Solaris. - JsonCPP currently doesn’t compile for GCC version 4.1.2 and earlier due to use of ‘-Werror=*’ compile flag, which was introduced in a later version. Fixed by adding version check to only add this flag on supported versions of GCC.
1 parent 54764dd commit d2b6992

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib_json/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ ELSE(JSONCPP_LIB_BUILD_SHARED)
1111
ENDIF(JSONCPP_LIB_BUILD_SHARED)
1212

1313
if( CMAKE_COMPILER_IS_GNUCXX )
14-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
14+
#Get compiler version.
15+
execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
16+
OUTPUT_VARIABLE GNUCXX_VERSION )
17+
18+
#-Werror=* was introduced -after- GCC 4.1.2
19+
if( GNUCXX_VERSION VERSION_GREATER 4.1.2 )
20+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
21+
endif()
1522
endif( CMAKE_COMPILER_IS_GNUCXX )
1623

1724
SET( JSONCPP_INCLUDE_DIR ../../include )

0 commit comments

Comments
 (0)