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)