diff --git a/cmake/Modules/FindTIRPC.cmake b/cmake/Modules/FindTIRPC.cmake index 8afdc175..816a82ca 100644 --- a/cmake/Modules/FindTIRPC.cmake +++ b/cmake/Modules/FindTIRPC.cmake @@ -55,7 +55,7 @@ if( NOT TARGET TIRPC::TIRPC ) add_library( TIRPC::TIRPC INTERFACE IMPORTED ) set_target_properties( TIRPC::TIRPC PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "-D__TIRPC__" + INTERFACE_COMPILE_DEFINITIONS "__TIRPC__" INTERFACE_INCLUDE_DIRECTORIES "${TIRPC_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${TIRPC_LIBRARIES}" ) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c22780f7..fe418b81 100755 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -8,7 +8,9 @@ include_directories( SYSTEM ${Boost_INCLUDE_DIR} ) # Hack to build on GCC/12.2.0 if( NOT WIN32 OR MINGW ) if ( NOT APPLE ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-use-after-free -Wno-mismatched-new-delete" ) + if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 11.0 ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-use-after-free -Wno-mismatched-new-delete" ) + endif() endif() endif() @@ -21,7 +23,7 @@ else() add_compile_options( -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers ) if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 5.0 ) add_compile_options( -Wno-format-truncation -Wno-format-overflow ) - if( NOT MINGW ) + if( NOT MINGW AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 11.0 ) add_compile_options( -Wno-use-after-free ) endif() endif()