Skip to content

Commit 250bd9a

Browse files
dominicpezzutocdunn2001
authored andcommitted
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 abd1bb0 commit 250bd9a

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
@@ -7,7 +7,14 @@ ELSE(JSONCPP_LIB_BUILD_SHARED)
77
ENDIF(JSONCPP_LIB_BUILD_SHARED)
88

99
if( CMAKE_COMPILER_IS_GNUCXX )
10-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
10+
#Get compiler version.
11+
execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
12+
OUTPUT_VARIABLE GNUCXX_VERSION )
13+
14+
#-Werror=* was introduced -after- GCC 4.1.2
15+
if( GNUCXX_VERSION VERSION_GREATER 4.1.2 )
16+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
17+
endif()
1118
endif( CMAKE_COMPILER_IS_GNUCXX )
1219

1320
SET( JSONCPP_INCLUDE_DIR ../../include )

0 commit comments

Comments
 (0)