1# Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2# file Copyright.txt or https://cmake.org/licensing for details. 3 4#[=======================================================================[.rst: 5CheckOBJCCompilerFlag 6--------------------- 7 8.. versionadded:: 3.16 9 10Check whether the Objective-C compiler supports a given flag. 11 12.. command:: check_objc_compiler_flag 13 14 .. code-block:: cmake 15 16 check_objc_compiler_flag(<flag> <var>) 17 18 Check that the ``<flag>`` is accepted by the compiler without 19 a diagnostic. Stores the result in an internal cache entry 20 named ``<var>``. 21 22This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable 23and calls the ``check_objc_source_compiles`` macro from the 24:module:`CheckOBJCSourceCompiles` module. See documentation of that 25module for a listing of variables that can otherwise modify the build. 26 27A positive result from this check indicates only that the compiler did not 28issue a diagnostic message when given the flag. Whether the flag has any 29effect or even a specific one is beyond the scope of this module. 30 31.. note:: 32 Since the :command:`try_compile` command forwards flags from variables 33 like :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags 34 in such variables may cause a false negative for this check. 35#]=======================================================================] 36 37include_guard(GLOBAL) 38include(CheckOBJCSourceCompiles) 39include(Internal/CheckCompilerFlag) 40 41macro (CHECK_OBJC_COMPILER_FLAG _FLAG _RESULT) 42 cmake_check_compiler_flag(OBJC "${_FLAG}" ${_RESULT}) 43endmacro () 44