From 7ee4db8bc37516de120dc5825ede71891064008a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Wed, 22 Jul 2020 01:02:34 +0200 Subject: [PATCH] Remove Windows warnings (#151) Signed-off-by: Carlos Aguero Signed-off-by: Juan Oxoby --- log/src/CMakeLists.txt | 9 +++++++++ src/CMakeLists.txt | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/log/src/CMakeLists.txt b/log/src/CMakeLists.txt index b42b8f142..e167185fc 100644 --- a/log/src/CMakeLists.txt +++ b/log/src/CMakeLists.txt @@ -7,6 +7,15 @@ ign_add_component(log SOURCES ${sources} GET_TARGET_NAME log_lib_target) target_link_libraries(${log_lib_target} PRIVATE SQLite3::SQLite3) +if (MSVC) + # Warning #4251 is the "dll-interface" warning that tells you when types used + # by a class are not being exported. These generated source files have private + # members that don't get exported, so they trigger this warning. However, the + # warning is not important since those members do not need to be interfaced + # with. + set_source_files_properties(${sources} ${gtest_sources} COMPILE_FLAGS "/wd4251 /wd4146") +endif() + # Unit tests ign_build_tests( TYPE "UNIT" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7d3d64c90..f9f50c26f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,15 @@ if (MSVC) list(REMOVE_ITEM gtest_sources ign_TEST.cc) endif() +if (MSVC) + # Warning #4251 is the "dll-interface" warning that tells you when types used + # by a class are not being exported. These generated source files have private + # members that don't get exported, so they trigger this warning. However, the + # warning is not important since those members do not need to be interfaced + # with. + set_source_files_properties(${sources} ${gtest_sources} COMPILE_FLAGS "/wd4251 /wd4146") +endif() + # Create the library target. ign_create_core_library(SOURCES ${sources} CXX_STANDARD 17)