|
|
|
@ -42,49 +42,11 @@ if(MSVC AND CMAKE_C_COMPILER MATCHES "icc|icl") |
|
|
|
|
set(CV_ICC __INTEL_COMPILER_FOR_WINDOWS) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
|
|
|
|
# Detect GNU version: |
|
|
|
|
# ---------------------------------------------------------------------------- |
|
|
|
|
if(CMAKE_COMPILER_IS_CLANGCXX) |
|
|
|
|
set(CMAKE_GCC_REGEX_VERSION "4.2.1") |
|
|
|
|
set(CMAKE_OPENCV_GCC_VERSION_MAJOR 4) |
|
|
|
|
set(CMAKE_OPENCV_GCC_VERSION_MINOR 2) |
|
|
|
|
set(CMAKE_OPENCV_GCC_VERSION 42) |
|
|
|
|
set(CMAKE_OPENCV_GCC_VERSION_NUM 402) |
|
|
|
|
|
|
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -v |
|
|
|
|
ERROR_VARIABLE CMAKE_OPENCV_CLANG_VERSION_FULL |
|
|
|
|
ERROR_STRIP_TRAILING_WHITESPACE) |
|
|
|
|
|
|
|
|
|
string(REGEX MATCH "version.*$" CMAKE_OPENCV_CLANG_VERSION_FULL "${CMAKE_OPENCV_CLANG_VERSION_FULL}") |
|
|
|
|
string(REGEX MATCH "[0-9]+\\.[0-9]+" CMAKE_CLANG_REGEX_VERSION "${CMAKE_OPENCV_CLANG_VERSION_FULL}") |
|
|
|
|
|
|
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCXX) |
|
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion |
|
|
|
|
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL |
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
|
|
|
|
|
|
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -v |
|
|
|
|
ERROR_VARIABLE CMAKE_OPENCV_GCC_INFO_FULL |
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
|
|
|
|
|
|
|
|
|
# Typical output in CMAKE_OPENCV_GCC_VERSION_FULL: "c+//0 (whatever) 4.2.3 (...)" |
|
|
|
|
# Look for the version number |
|
|
|
|
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}") |
|
|
|
|
if(NOT CMAKE_GCC_REGEX_VERSION) |
|
|
|
|
string(REGEX MATCH "[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
# Split the three parts: |
|
|
|
|
string(REGEX MATCHALL "[0-9]+" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}") |
|
|
|
|
|
|
|
|
|
list(GET CMAKE_OPENCV_GCC_VERSIONS 0 CMAKE_OPENCV_GCC_VERSION_MAJOR) |
|
|
|
|
list(GET CMAKE_OPENCV_GCC_VERSIONS 1 CMAKE_OPENCV_GCC_VERSION_MINOR) |
|
|
|
|
|
|
|
|
|
set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR}) |
|
|
|
|
math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}") |
|
|
|
|
message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})") |
|
|
|
|
if(NOT DEFINED CMAKE_CXX_COMPILER_VERSION) |
|
|
|
|
message(WARNING "Compiler version is not available: CMAKE_CXX_COMPILER_VERSION is not set") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX) |
|
|
|
|
if(WIN32) |
|
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine |
|
|
|
|
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE |
|
|
|
|