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

Conversation

rsjbailey
Copy link
Contributor

…tom exceptions

Currently, on MSVC builds, we have a lot of warnings about the custom adm extensions being derived from std::exception, despite this being listed as a 'best practice' in the msvc documentation.

As these exceptions are defined in a header, this will not be an issue for direct consumers of libadm. We think this would only be an issue for transitive dependants if the direct dependent allows the exception definition to propogate out, and the ABI for std::exception changes, and the consumer is using a different version of the compiler than that with which is was built (or debug/release mismatch) - a combination which is fairly unlikely.

To err on the side of caution, this PR leaves the warnings enabled by default, but provides a cmake option that disables these warnings for this specific case. It also enables this option for CI builds, to avoid noise that might obscure more pertinent issues.

@rsjbailey rsjbailey force-pushed the optionally_silence_msvc_warnings branch from 550a077 to 1c5a4ad Compare September 13, 2022 12:11
@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants