From f9fac58eb9837725e0a05a65e377eb98598226d1 Mon Sep 17 00:00:00 2001 From: Jan Schwers Date: Thu, 3 Sep 2020 12:32:35 +0200 Subject: [PATCH] cmake: treat public includes as system includes to avoid warning from headers Include directories for target fmt was splitted into INTERFACE and PRIVATE. INTERFACE includes was marked as SYSTEM to suppress warnings in targets that are linking fmt:fmt. PRIVATE includes are left as normal includes so that warnings still occur when building fmt. Includes for fmt-header-only are now marked as SYSTEM. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 881b2b22..93dc8c79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,7 +211,9 @@ endif () target_compile_features(fmt INTERFACE ${FMT_REQUIRED_FEATURES}) -target_include_directories(fmt PUBLIC +target_include_directories(fmt PRIVATE ${PROJECT_SOURCE_DIR}/include) + +target_include_directories(fmt SYSTEM INTERFACE $ $) @@ -246,7 +248,7 @@ add_library(fmt::fmt-header-only ALIAS fmt-header-only) target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1) target_compile_features(fmt-header-only INTERFACE ${FMT_REQUIRED_FEATURES}) -target_include_directories(fmt-header-only INTERFACE +target_include_directories(fmt-header-only SYSTEM INTERFACE $ $)