@ -76,17 +76,27 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
# T y p i c a l o u t p u t i n C M A K E _ O P E N C V _ G C C _ V E R S I O N _ F U L L : " c + / / 0 ( whatever ) 4 . 2 . 3 ( ... ) "
# L o o k f o r t h e v e r s i o n n u m b e r
# L o o k f o r t h e v e r s i o n n u m b e r , m a j o r . m i n o r . b u i l d
string ( REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}" )
if ( NOT CMAKE_GCC_REGEX_VERSION )
if ( NOT CMAKE_GCC_REGEX_VERSION ) # m a j o r . m i n o r
string ( REGEX MATCH "[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}" )
endif ( )
# S p l i t t h e t h r e e p a r t s :
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 )
if ( CMAKE_GCC_REGEX_VERSION )
# S p l i t t h e p a r t s :
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 )
else ( ) # c o m p i l e r r e t u r n e d j u s t t h e m a j o r v e r s i o n n u m b e r
string ( REGEX MATCH "[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}" )
if ( NOT CMAKE_GCC_REGEX_VERSION ) # c o m p i l e r d i d n o t r e t u r n a n y t h i n g r e a s o n a b l e
set ( CMAKE_GCC_REGEX_VERSION "0" )
message ( WARNING "GCC version not detected!" )
endif ( )
set ( CMAKE_OPENCV_GCC_VERSION_MAJOR ${ CMAKE_GCC_REGEX_VERSION } )
set ( CMAKE_OPENCV_GCC_VERSION_MINOR 0 )
endif ( )
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}" )