Skip to content

Commit 89c3732

Browse files
committed
Fix compilation flags to build with GCC 15+Boost 1.89
1 parent aef4ec9 commit 89c3732

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

cmake/Dependencies.cmake

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ if (ENABLE_PYTHON)
142142

143143
endif()
144144

145+
145146
# =========================================================================================
146147
# Boost
147148
# =========================================================================================
148-
149149
ecbuild_info( "Locating Boost" )
150150

151151
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.30.0")
@@ -227,11 +227,25 @@ if (ENABLE_PYTHON)
227227
ecbuild_info( "Found Boost.Python at ${Boost_PYTHON${_python_base_version}_LIBRARY_RELEASE}" )
228228
endif()
229229

230+
if ( Boost_VERSION_STRING VERSION_GREATER_EQUAL "1.89.0" AND Boost_VERSION_STRING VERSION_LESS "1.90.0" )
231+
if ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0 )
232+
ecbuild_add_cxx_flags("-fno-strict-aliasing")
233+
if(CMAKE_BUILD_TYPE MATCHES "[Rr][Ee][Ll][Ee][Aa][Ss][Ee]")
234+
ecbuild_add_cxx_flags("-Wno-error=strict-aliasing")
235+
endif()
236+
add_definitions(-DBOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
237+
238+
ecbuild_warn( "You are using Boost ${Boost_VERSION_STRING} with GCC ${CMAKE_CXX_COMPILER_VERSION}" )
239+
ecbuild_warn( "This combination is known to have issues with ASIO socket operations" )
240+
ecbuild_warn( "It is STRONGLY RECOMMENDED to upgrade Boost to 1.90.0 or later" )
241+
242+
endif()
243+
endif()
244+
230245

231246
# =========================================================================================
232247
# OpenSSL
233248
# =========================================================================================
234-
235249
if (ENABLE_SSL)
236250
ecbuild_info( "Locating OpenSSL" )
237251

@@ -267,7 +281,6 @@ ecbuild_info( "Found Crypt at ${Crypt_INCLUDE_DIRS}" )
267281
# =========================================================================================
268282
# Dependency: Qt
269283
# =========================================================================================
270-
271284
if(ENABLE_UI)
272285

273286
# Qt is used for ecFlowUI only.
@@ -361,6 +374,7 @@ if(ENABLE_UI)
361374

362375
endif()
363376

377+
364378
# =========================================================================================
365379
# Doxygen
366380
# =========================================================================================
@@ -392,6 +406,7 @@ else ()
392406
ecbuild_info( "Doxygen need to be installed to generate the doxygen documentation" )
393407
endif()
394408

409+
395410
# =========================================================================================
396411
# Clang-format
397412
# =========================================================================================

0 commit comments

Comments
 (0)