Skip to content

Commit 369cf59

Browse files
committed
feature: [header only] fix CMake compile feature
1 parent d42798a commit 369cf59

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

CMakeLists.txt

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,15 @@ else()
560560
# to uncomment this, finally
561561
# add_library(hwy INTERFACE)
562562
# target_compile_definitions(hwy INTERFACE -DHWY_HEADER_ONLY)
563-
# target_include_directories(hwy INTERFACE
564-
# $<NOT HWY_WARNINGS_ARE_ERRORS:SYSTEM>
565-
# $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
566-
# $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
563+
# if (HWY_WARNINGS_ARE_ERRORS)
564+
# target_include_directories(hwy INTERFACE
565+
# $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
566+
# $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
567+
# else()
568+
# target_include_directories(hwy SYSTEM INTERFACE
569+
# $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
570+
# $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
571+
# endif ()
567572
# target_link_libraries(hwy INTERFACE ${ATOMICS_LIBRARIES})
568573

569574
add_library(hwy STATIC)
@@ -572,10 +577,15 @@ else()
572577
target_compile_features(hwy PRIVATE ${HWY_CXX_STD_TGT_COMPILE_FEATURE})
573578
endif ()
574579
target_compile_definitions(hwy PUBLIC -DHWY_HEADER_ONLY)
575-
target_include_directories(hwy PUBLIC
576-
$<NOT HWY_WARNINGS_ARE_ERRORS:SYSTEM>
577-
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
578-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
580+
if (HWY_WARNINGS_ARE_ERRORS)
581+
target_include_directories(hwy PUBLIC
582+
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
583+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
584+
else ()
585+
target_include_directories(hwy SYSTEM PUBLIC
586+
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
587+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
588+
endif ()
579589
target_link_libraries(hwy PRIVATE ${ATOMICS_LIBRARIES})
580590
target_sources(hwy PRIVATE
581591
# hwy/abort.cc

0 commit comments

Comments
 (0)