Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable warning on MSVC about symbol visibility for cus… #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DBUILD_SHARED_LIBS=${{ matrix.shared }}
-DADM_DISABLE_MSVC_EXCEPTION_DLL_BOUNDARY_WARNINGS=ON

- name: 'print ccache stats'
run: ccache -s
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ option(ADM_HIDE_INTERNAL_SYMBOLS "Hide symbols by default" TRUE)
option(ADM_UNIT_TESTS "Build units tests" ${IS_ROOT_PROJECT})
option(ADM_EXAMPLES "Build examples" ${IS_ROOT_PROJECT})
option(ADM_PACKAGE_AND_INSTALL "Package and install libadm" ${IS_ROOT_PROJECT})
option(ADM_DISABLE_MSVC_EXCEPTION_DLL_BOUNDARY_WARNINGS "Disable warnings C4275 and C4251 for exceptions derived
from std::exception in errors.hpp" OFF)
include(GNUInstallDirs)
set(ADM_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation directory for libraries")
set(ADM_INSTALL_BIN_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Installation directory for binaries")
Expand Down
8 changes: 8 additions & 0 deletions include/adm/errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include <adm/elements/audio_track_format_id.hpp>
#include "adm/export.h"

#ifdef ADM_DISABLE_MSVC_EXCEPTION_DLL_BOUNDARY_WARNINGS
#pragma warning(disable : 4275 4251)
#endif

namespace adm {
namespace error {

Expand Down Expand Up @@ -103,3 +107,7 @@ namespace adm {

} // namespace error
} // namespace adm

#ifdef ADM_DISABLE_MSVC_EXCEPTION_DLL_BOUNDARY_WARNINGS
#pragma warning(default : 4275 4251)
#endif
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ target_include_directories(adm
target_link_libraries(adm PUBLIC Boost::boost)
target_link_libraries(adm PRIVATE $<BUILD_INTERFACE:rapidxml>)

if(ADM_DISABLE_MSVC_EXCEPTION_DLL_BOUNDARY_WARNINGS)
target_compile_options(adm PUBLIC $<$<CXX_COMPILER_ID:MSVC>:/DADM_DISABLE_MSVC_EXCEPTION_DLL_BOUNDARY_WARNINGS=1>)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please indent this, and maybe use target_compile_definitions? looks good otherwise.

endif()

if (UNIX)
target_link_libraries(adm PUBLIC dl)
endif()
Expand Down