Skip to content

Commit e3ca623

Browse files
committed
fix(utils): handle warning flags in header-only mode
2 parents 92b219a + f7afae3 commit e3ca623

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,21 @@ endif()
181181
if (TARGET vix_warnings)
182182
target_link_libraries(vix_utils ${_VIX_UTILS_SCOPE} vix_warnings)
183183
else()
184+
set(_VIX_UTILS_WARN_SCOPE PRIVATE)
185+
if (VIX_HEADER_ONLY)
186+
set(_VIX_UTILS_WARN_SCOPE INTERFACE)
187+
endif()
188+
184189
if (NOT MSVC)
185-
target_compile_options(vix_utils PRIVATE
190+
target_compile_options(vix_utils ${_VIX_UTILS_WARN_SCOPE}
186191
-Wall -Wextra -Wpedantic
187192
-Wno-array-bounds
188193
-Wno-stringop-overflow
189194
)
190195
endif()
191196

192197
if (VIX_STRICT AND NOT MSVC)
193-
target_compile_options(vix_utils PRIVATE -Werror)
198+
target_compile_options(vix_utils ${_VIX_UTILS_WARN_SCOPE} -Werror)
194199
endif()
195200
endif()
196201

0 commit comments

Comments
 (0)