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:
10 See :module:`CheckCXXCompilerFlag`.
12 Check if the CXX compiler accepts a flag.
16 CHECK_CXX_ACCEPTS_FLAG(<flags> <variable>)
21 variable to store the result
22 #]=======================================================================]
24 macro(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE)
25 if(NOT DEFINED ${VARIABLE})
26 message(CHECK_START "Checking to see if CXX compiler accepts flag ${FLAGS}")
27 try_compile(${VARIABLE}
28 SOURCES ${CMAKE_ROOT}/Modules/DummyCXXFile.cxx
29 CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${FLAGS}
32 message(CHECK_PASS "yes")
34 message(CHECK_FAIL "no")