added support clang compiler
authorAndrey Morozov <no@email>
Fri, 13 Apr 2012 14:15:17 +0000 (14:15 +0000)
committerAndrey Morozov <no@email>
Fri, 13 Apr 2012 14:15:17 +0000 (14:15 +0000)
cmake/OpenCVDetectCXXCompiler.cmake

index 3054fbe..c3e2e37 100644 (file)
@@ -5,6 +5,14 @@ if(CMAKE_CL_64)
     set(MSVC64 1)
 endif()
 
+if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+  set(CMAKE_COMPILER_IS_GNUCXX 1)
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+  set(CMAKE_COMPILER_IS_GNUC 1) 
+endif()
+
 # ----------------------------------------------------------------------------
 # Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):
 #  see  include/opencv/cxtypes.h file for related   ICC & CV_ICC defines.
@@ -47,7 +55,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
 
     # 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}")
+    string(REGEX MATCH "[0-9]+.[0-9]+(.[0-9]+)?" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
 
     # Split the three parts:
     string(REGEX MATCHALL "[0-9]+" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}")