Debian Codegraph @

cmake/tribits/core/package_arch/TribitsIncludeDirectories.cmake

raw
1 # @HEADER
2 # *****************************************************************************
3 # TriBITS: Tribal Build, Integrate, and Test System
4 #
5 # Copyright 2013-2016 NTESS and the TriBITS contributors.
6 # SPDX-License-Identifier: BSD-3-Clause
7 # *****************************************************************************
8 # @HEADER
9
10 include(CMakeParseArguments)
11 include(TribitsDeprecatedHelpers)
12
13
14 # @MACRO: tribits_include_directories()
15 #
16 # This function overrides the standard behavior of the built-in CMake
17 # ``include_directories()`` command for special behavior for installation
18 # testing.
19 #
20 # Usage::
21 #
22 # tribits_include_directories(
23 # [REQUIRED_DURING_INSTALLATION_TESTING] <dir0> <dir1> ... )
24 #
25 # If specified, ``REQUIRED_DURING_INSTALLATION_TESTING`` can appear anywhere
26 # in the argument list.
27 #
28 # This function allows overriding the default behavior of
29 # ``include_directories()`` for installation testing, to ensure that include
30 # directories will not be inadvertently added to the build lines for tests
31 # during installation testing (see `Installation and Backward Compatibility
32 # Testing`_). Normally we want the include directories to be handled as cmake
33 # usually does. However during TriBITS installation testing we do not want
34 # most of the include directories to be used as the majority of the files
35 # should come from the installation we are building against. The exception is
36 # when there are test only headers that are needed. For that case
37 # ``REQUIRED_DURING_INSTALLATION_TESTING`` must be passed in to ensure the
38 # include paths are added for installation testing.
39 #
40 macro(tribits_include_directories)
41
42 cmake_parse_arguments(
43 #prefix
44 PARSE
45 #options
46 "REQUIRED_DURING_INSTALLATION_TESTING"
47 #one_value_keywords
48 ""
49 #mulit_value_keywords
50 ""
51 ${ARGN}
52 )
53
54 if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING
55 OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING
56 )
57 if (TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE)
58 include_directories(${PARSE_UNPARSED_ARGUMENTS})
59 else()
60 _include_directories(${PARSE_UNPARSED_ARGUMENTS})
61 endif()
62 endif()
63 endmacro()
64
65
66 if (NOT TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE)
67
68 # Deprecated. Use tribits_include_directories() instead!
69 #
70 # To hide this macro from even being defined, set
71 # ``TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE=TRUE``.
72 #
73 macro(include_directories)
74
75 tribits_deprecated_command(include_directories
76 MESSAGE "Use tribits_include_directories() instead."
77 )
78
79 cmake_parse_arguments(
80 #prefix
81 PARSE
82 #options
83 "REQUIRED_DURING_INSTALLATION_TESTING"
84 #one_value_keywords
85 ""
86 #mulit_value_keywords
87 ""
88 ${ARGN}
89 )
90
91 if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING
92 OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING
93 )
94 _include_directories(${PARSE_UNPARSED_ARGUMENTS})
95 endif()
96 endmacro()
97
98 endif (NOT TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE)