Skip to content

Commit 9af4b29

Browse files
committed
Mark libassert as a SYSTEM library
1 parent 7588b19 commit 9af4b29

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2015-2025 Morwenn
1+
# Copyright (c) 2015-2026 Morwenn
22
# SPDX-License-Identifier: MIT
33

44
cmake_minimum_required(VERSION 3.8.0)
@@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
88
project(cpp-sort VERSION 1.17.1 LANGUAGES CXX)
99

1010
include(CMakePackageConfigHelpers)
11+
include(cpp-sort-utils)
1112
include(GNUInstallDirs)
1213

1314
# Project options
@@ -28,6 +29,7 @@ if (CPPSORT_USE_LIBASSERT)
2829
UPDATE_DISCONNECTED 1
2930
)
3031
add_subdirectory(${libassert_SOURCE_DIR} ${libassert_BINARY_DIR})
32+
mark_system_library(libassert-lib)
3133
endif()
3234

3335
# Create cpp-sort library and configure it

cmake/cpp-sort-utils.cmake

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019-2023 Morwenn
1+
# Copyright (c) 2019-2025 Morwenn
22
# SPDX-License-Identifier: MIT
33

44
# Add a selection of warnings to a target
@@ -15,3 +15,17 @@ macro(cppsort_add_warnings target)
1515
)
1616
endif()
1717
endmacro()
18+
19+
# Mark a target as a SYSTEM library
20+
function(mark_system_library target)
21+
get_target_property(
22+
TARGET_INCLUDE_DIR
23+
${target}
24+
INTERFACE_INCLUDE_DIRECTORIES
25+
)
26+
set_target_properties(
27+
${target}
28+
PROPERTIES
29+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${TARGET_INCLUDE_DIR}"
30+
)
31+
endfunction()

conanfile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright (c) 2018-2025 Morwenn
3+
# Copyright (c) 2018-2026 Morwenn
44
# SPDX-License-Identifier: MIT
55

66
import os.path
@@ -29,7 +29,8 @@ class CppSortConan(ConanFile):
2929
exports_sources = [
3030
"include/*",
3131
"CMakeLists.txt",
32-
"cmake/cpp-sort-config.cmake.in"
32+
"cmake/cpp-sort-config.cmake.in",
33+
"cmake/cpp-sort-utils.cmake",
3334
]
3435
settings = "os", "compiler", "build_type", "arch"
3536
package_type = "header-library"

tests/CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2015-2025 Morwenn
1+
# Copyright (c) 2015-2026 Morwenn
22
# SPDX-License-Identifier: MIT
33

44
include(cpp-sort-utils)
@@ -31,11 +31,9 @@ else()
3131
UPDATE_DISCONNECTED 1
3232
)
3333
add_subdirectory(${Catch2_SOURCE_DIR} ${Catch2_BINARY_DIR})
34+
mark_system_library(Catch2)
35+
mark_system_library(Catch2WithMain)
3436
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras)
35-
36-
# Make Catch2::Catch2 a SYSTEM target
37-
get_target_property(Catch2_INCLUDE_DIRECTORY Catch2 INTERFACE_INCLUDE_DIRECTORIES)
38-
set_target_properties(Catch2 PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIRECTORY}")
3937
endif()
4038
include(Catch)
4139

@@ -57,10 +55,8 @@ else()
5755

5856
set(RC_INSTALL_ALL_EXTRAS ON)
5957
add_subdirectory(${RapidCheck_SOURCE_DIR} ${RapidCheck_BINARY_DIR})
60-
61-
# Make rapidcheck a SYSTEM target
62-
get_target_property(rapidcheck_INCLUDE_DIRECTORY rapidcheck INTERFACE_INCLUDE_DIRECTORIES)
63-
set_target_properties(rapidcheck PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${rapidcheck_INCLUDE_DIRECTORY}")
58+
mark_system_library(rapidcheck)
59+
mark_system_library(rapidcheck_catch)
6460
endif()
6561

6662
########################################

0 commit comments

Comments
 (0)