Skip to content

Commit

Permalink
Suppress warnings from thirdparty dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
KerstinKeller committed Apr 4, 2024
1 parent bfebb30 commit 66fe6a4
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cmake/helper_functions/ecal_helper_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,23 @@ function(ecal_set_subsystem_console TARGET_NAME)
LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:CONSOLE")
endif()
endfunction()


macro(ecal_disable_all_warnings)
if(MSVC)
message(STATUS "supress thirdparty warnings for windows platform ..")
set(CMAKE_CXX_FLAGS_OLD "${CMAKE_CXX_FLAGS}")
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
endif()
endif()
endmacro()

macro(ecal_restore_warning_level)
if(MSVC)
message(STATUS "reset thirdparty warnings for windows platform ..")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_OLD}")
endif()
endmacro()
2 changes: 2 additions & 0 deletions thirdparty/curl/build-curl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ endif()
set(BUILD_CURL_EXE OFF CACHE BOOL "Don't build the curl executable" FORCE)
set(ENABLE_MANUAL OFF CACHE BOOL "Disable built-in manual" FORCE)

ecal_disable_all_warnings()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/curl thirdparty/curl EXCLUDE_FROM_ALL SYSTEM)
ecal_restore_warning_level()
set_property(TARGET libcurl PROPERTY FOLDER thirdparty/curl)

if (NOT TARGET CURL::libcurl)
Expand Down
13 changes: 13 additions & 0 deletions thirdparty/protobuf/build-protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "My option" FORCE)
if(UNIX)
set(protobuf_BUILD_SHARED_LIBS ON CACHE BOOL "My option" FORCE)
endif()

if(MSVC)
message(STATUS "supress thirdparty warnings for windows platform ..")
set(CMAKE_CXX_FLAGS_OLD "${CMAKE_CXX_FLAGS}")
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
endif()
endif()

ecal_disable_all_warnings()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/protobuf/cmake thirdparty/protobuf SYSTEM)
ecal_restore_warning_level()

if (NOT TARGET protobuf::libprotobuf)
add_library(protobuf::libprotobuf ALIAS libprotobuf)
Expand Down
4 changes: 4 additions & 0 deletions thirdparty/qwt/build-qwt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ include_guard(GLOBAL)
if(NOT DEFINED QWT_LIBRARY_TYPE OR QWT_LIBRARY_TYPE STREQUAL "")
set(QWT_LIBRARY_TYPE "STATIC")
endif()

ecal_disable_all_warnings()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR} thirdparty/qwt EXCLUDE_FROM_ALL SYSTEM)
ecal_restore_warning_level()

set_property(TARGET qwt PROPERTY FOLDER thirdparty/qwt)

0 comments on commit 66fe6a4

Please sign in to comment.