Get compiler version values
This commit is contained in:
parent
ac88a68ebc
commit
209617dd24
|
@ -260,18 +260,30 @@ macro(set_default_value VARIABLE DEFAULT)
|
|||
endif()
|
||||
endmacro()
|
||||
|
||||
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||
list(GET VERSION_LIST 0 CXX_COMPILER_VERSION_MAJOR)
|
||||
list(GET VERSION_LIST 1 CXX_COMPILER_VERSION_MINOR)
|
||||
list(GET VERSION_LIST 2 CXX_COMPILER_VERSION_PATCH)
|
||||
list(GET VERSION_LIST 3 CXX_COMPILER_VERSION_TWEAK)
|
||||
macro(set_version_values VARIABLE)
|
||||
string(REPLACE "." ";" __version_list "${${VARIABLE}}")
|
||||
list(LENGTH __version_list __len)
|
||||
if(${__len} GREATER 0)
|
||||
list(GET __version_list 0 ${VARIABLE}_MAJOR)
|
||||
endif()
|
||||
if(${__len} GREATER 1)
|
||||
list(GET __version_list 1 ${VARIABLE}_MINOR)
|
||||
endif()
|
||||
if(${__len} GREATER 2)
|
||||
list(GET __version_list 2 ${VARIABLE}_PATCH)
|
||||
endif()
|
||||
if(${__len} GREATER 3)
|
||||
list(GET __version_list 3 ${VARIABLE}_TWEAK)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
find_package(CUDA QUIET)
|
||||
|
||||
set_default_value(CXX_COMPILER_VERSION_MAJOR 0)
|
||||
set_default_value(CXX_COMPILER_VERSION_MINOR 0)
|
||||
set_default_value(CXX_COMPILER_VERSION_PATCH 0)
|
||||
set_default_value(CXX_COMPILER_VERSION_TWEAK 0)
|
||||
set_version_values(CMAKE_CXX_COMPILER_VERSION)
|
||||
set_default_value(CMAKE_CXX_COMPILER_VERSION_MAJOR 0)
|
||||
set_default_value(CMAKE_CXX_COMPILER_VERSION_MINOR 0)
|
||||
set_default_value(CMAKE_CXX_COMPILER_VERSION_PATCH 0)
|
||||
set_default_value(CMAKE_CXX_COMPILER_VERSION_TWEAK 0)
|
||||
set_default_value(CUDA_VERSION_MAJOR 0)
|
||||
set_default_value(CUDA_VERSION_MINOR 0)
|
||||
set_default_value(OpenCV_VERSION_MAJOR 0)
|
||||
|
|
|
@ -5,10 +5,10 @@ HOST_NAME: "@HOST_NAME@"
|
|||
HOST_ARCH: "@HOST_ARCH@"
|
||||
HOST_COMPILER: "@CMAKE_CXX_COMPILER_ID@"
|
||||
COMPILER_VERSION: "@CMAKE_CXX_COMPILER_VERSION@"
|
||||
COMPILER_VERSION_MAJOR: @CXX_COMPILER_VERSION_MAJOR@
|
||||
COMPILER_VERSION_MINOR: @CXX_COMPILER_VERSION_MINOR@
|
||||
COMPILER_VERSION_PATCH: @CXX_COMPILER_VERSION_PATCH@
|
||||
COMPILER_VERSION_TWEAK: @CXX_COMPILER_VERSION_TWEAK@
|
||||
COMPILER_VERSION_MAJOR: @CMAKE_CXX_COMPILER_VERSION_MAJOR@
|
||||
COMPILER_VERSION_MINOR: @CMAKE_CXX_COMPILER_VERSION_MINOR@
|
||||
COMPILER_VERSION_PATCH: @CMAKE_CXX_COMPILER_VERSION_PATCH@
|
||||
COMPILER_VERSION_TWEAK: @CMAKE_CXX_COMPILER_VERSION_TWEAK@
|
||||
CUDA_VERSION: "@CUDA_VERSION@"
|
||||
CUDA_VERSION_MAJOR: @CUDA_VERSION_MAJOR@
|
||||
CUDA_VERSION_MINOR: @CUDA_VERSION_MINOR@
|
||||
|
|
Loading…
Reference in New Issue
Block a user