diff --git a/cmake/helper_functions/ecal_helper_functions.cmake b/cmake/helper_functions/ecal_helper_functions.cmake index aad8ee8985..66fcb4835c 100644 --- a/cmake/helper_functions/ecal_helper_functions.cmake +++ b/cmake/helper_functions/ecal_helper_functions.cmake @@ -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() \ No newline at end of file diff --git a/thirdparty/curl/build-curl.cmake b/thirdparty/curl/build-curl.cmake index f335101717..c59ffac484 100644 --- a/thirdparty/curl/build-curl.cmake +++ b/thirdparty/curl/build-curl.cmake @@ -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) diff --git a/thirdparty/protobuf/build-protobuf.cmake b/thirdparty/protobuf/build-protobuf.cmake index beae509be7..ed26a4494d 100644 --- a/thirdparty/protobuf/build-protobuf.cmake +++ b/thirdparty/protobuf/build-protobuf.cmake @@ -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) diff --git a/thirdparty/qwt/build-qwt.cmake b/thirdparty/qwt/build-qwt.cmake index 8f8955adea..06a085698f 100644 --- a/thirdparty/qwt/build-qwt.cmake +++ b/thirdparty/qwt/build-qwt.cmake @@ -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) \ No newline at end of file