1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 #[=======================================================================[.rst:
5 CheckOBJCXXCompilerFlag
6 -----------------------
10 Check whether the Objective-C++ compiler supports a given flag.
12 .. command:: check_objcxx_compiler_flag
16 check_objcxx_compiler_flag(<flag> <resultVar>)
18 Check that the ``<flag>`` is accepted by the compiler without
19 a diagnostic. Stores the result in an internal cache entry
20 named ``<resultVar>``.
22 A positive result from this check indicates only that the compiler did not
23 issue a diagnostic message when given the flag. Whether the flag has any
24 effect or even a specific one is beyond the scope of this module.
26 The check is only performed once, with the result cached in the variable named
27 by ``<resultVar>``. Every subsequent CMake run will reuse this cached value
28 rather than performing the check again, even if the ``<code>`` changes. In
29 order to force the check to be re-evaluated, the variable named by
30 ``<resultVar>`` must be manually removed from the cache.
32 The compile and link commands can be influenced by setting any of the
33 following variables prior to calling ``check_objcxx_compiler_flag()``
35 .. include:: /module/CMAKE_REQUIRED_FLAGS.txt
37 .. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
39 .. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
41 .. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
43 .. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
45 .. include:: /module/CMAKE_REQUIRED_QUIET.txt
47 #]=======================================================================]
50 include(Internal/CheckCompilerFlag)
52 macro (CHECK_OBJCXX_COMPILER_FLAG _FLAG _RESULT)
53 cmake_check_compiler_flag(OBJCXX "${_FLAG}" ${_RESULT})
56 # FIXME(#24994): The following module is included only for compatibility
57 # with projects that accidentally relied on it with CMake 3.26 and below.
58 include(CheckOBJCXXSourceCompiles)