Skip to content

Commit c86a9e4

Browse files
authored
Minimize warnings when not the top-level project (#1124)
Minimize warnings when not the top-level project Should fix #970 and #764 when trying to add yaml-cpp to other project
1 parent 255bf1f commit c86a9e4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,15 @@ if (NOT DEFINED CMAKE_CXX_STANDARD)
106106
CXX_STANDARD 11)
107107
endif()
108108

109+
if(YAML_CPP_MAIN_PROJECT)
110+
target_compile_options(yaml-cpp
111+
PRIVATE
112+
$<${not-msvc}:-Wall -Wextra -Wshadow -Weffc++ -Wno-long-long>
113+
$<${not-msvc}:-pedantic -pedantic-errors>)
114+
endif()
115+
109116
target_compile_options(yaml-cpp
110117
PRIVATE
111-
$<${not-msvc}:-Wall -Wextra -Wshadow -Weffc++ -Wno-long-long>
112-
$<${not-msvc}:-pedantic -pedantic-errors>
113-
114118
$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-static}>:-MTd>
115119
$<$<AND:${backport-msvc-runtime},${msvc-rt-mt-static}>:-MT>
116120
$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-dll}>:-MDd>

0 commit comments

Comments
 (0)