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

Conditionally disabled -Weffc++ and -Wshadow for compilers with broken implementations #945

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ set(build-shared $<BOOL:${YAML_BUILD_SHARED_LIBS}>)
set(build-windows-dll $<AND:$<BOOL:${CMAKE_HOST_WIN32}>,${build-shared}>)
set(not-msvc $<NOT:$<CXX_COMPILER_ID:MSVC>>)
set(msvc-shared_rt $<BOOL:${YAML_MSVC_SHARED_RT}>)
set(not-intel $<NOT:$<CXX_COMPILER_ID:Intel>>)
set(not-gnu $<NOT:$<CXX_COMPILER_ID:GNU>>)
# -Weffc++ does not work correctly for some compilers
set(weffcpp-compatible $<AND:${not-intel},${not-gnu},${not-msvc}>)
# -Wshadow does not work correctly for some compilers
set(wshadow-compatible $<AND:${not-intel},${not-msvc}>)

if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY
Expand Down Expand Up @@ -93,7 +99,9 @@ endif()

target_compile_options(yaml-cpp
PRIVATE
$<${not-msvc}:-Wall -Wextra -Wshadow -Weffc++ -Wno-long-long>
$<${not-msvc}:-Wall -Wextra -Wno-long-long>
$<${wshadow-compatible}:-Wshadow >
$<${weffcpp-compatible}:-Weffc++>
$<${not-msvc}:-pedantic -pedantic-errors>

$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-static}>:-MTd>
Expand Down