cmake: integrate iwyu, if/when present
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-01-07 06:20:26 +01:00
parent 51c0b1fc56
commit 5ad8e610a4
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -227,6 +227,22 @@ add_executable(fortuna ${FORTUNA_SOURCES} ${FORTUNA_HEADERS})
target_include_directories(fortuna PRIVATE .)
target_compile_features(fortuna PUBLIC cxx_std_20)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
message(STATUS "Looking for iwyu...")
find_program(iwyu NAMES include-what-you-use iwyu)
if(iwyu)
message(STATUS "iwyu found at: ${iwyu}")
set(iwyu_and_options
${iwyu}
-Xiwyu
-p .
--verbose=3)
set_property(TARGET fortuna PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_and_options})
else()
message(STATUS "iwyu, not found")
endif()
endif()
# ref: https://cmake.org/pipermail/cmake/2016-May/063400.html
target_link_libraries(fortuna
PRIVATE cryptopp