cmake_policy(SET CMP0068 NEW) # CMake 3.9+: `RPATH` settings on macOS do not affect `install_name`.
endif()
+if(POLICY CMP0075)
+ cmake_policy(SET CMP0075 NEW) # CMake 3.12+: Include file check macros honor `CMAKE_REQUIRED_LIBRARIES`
+endif()
+
#
# Configure OpenCV CMake hooks
endif()
endif()
endif()
+
+if((HAVE_CXX11
+ AND NOT MSVC
+ AND NOT (X86 OR X86_64)
+ AND NOT OPENCV_SKIP_LIBATOMIC_COMPILER_CHECK)
+ OR OPENCV_FORCE_LIBATOMIC_COMPILER_CHECK
+)
+ ocv_check_compiler_flag(CXX "" HAVE_CXX_ATOMICS_WITHOUT_LIB "${OpenCV_SOURCE_DIR}/cmake/checks/atomic_check.cpp")
+ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES atomic)
+ ocv_check_compiler_flag(CXX "" HAVE_CXX_ATOMICS_WITH_LIB "${OpenCV_SOURCE_DIR}/cmake/checks/atomic_check.cpp")
+ if(HAVE_CXX_ATOMICS_WITH_LIB)
+ list(APPEND OPENCV_LINKER_LIBS atomic)
+ else()
+ message(FATAL_ERROR "C++11 compiler must support std::atomic")
+ endif()
+ endif()
+endif()
else()
set(__msg "")
endif()
+ if(CMAKE_REQUIRED_LIBRARIES)
+ set(__link_libs LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+ else()
+ set(__link_libs)
+ endif()
+ set(__cmake_flags "")
+ if(CMAKE_EXE_LINKER_FLAGS) # CMP0056 do this on new CMake
+ list(APPEND __cmake_flags "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}")
+ endif()
+
+ # CMP0067 do this on new CMake
+ if(DEFINED CMAKE_CXX_STANDARD)
+ list(APPEND __cmake_flags "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}")
+ endif()
+ if(DEFINED CMAKE_CXX_STANDARD_REQUIRED)
+ list(APPEND __cmake_flags "-DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}")
+ endif()
+ if(DEFINED CMAKE_CXX_EXTENSIONS)
+ list(APPEND __cmake_flags "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
+ endif()
+
MESSAGE(STATUS "Performing Test ${RESULT}${__msg}")
TRY_COMPILE(${RESULT}
"${CMAKE_BINARY_DIR}"
"${_fname}"
- CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}" # CMP0056 do this on new CMake
+ CMAKE_FLAGS ${__cmake_flags}
COMPILE_DEFINITIONS "${FLAG}"
+ ${__link_libs}
OUTPUT_VARIABLE OUTPUT)
if(${RESULT})