2012-02-03 19:26:49 +08:00
|
|
|
SET(OPENCV_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/modules/core/include/opencv2/core/version.hpp")
|
2013-09-12 20:37:05 +08:00
|
|
|
file(STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS REGEX "#define CV_VERSION_[A-Z]+[ ]+" )
|
2012-02-17 04:29:35 +08:00
|
|
|
|
2013-11-15 23:41:53 +08:00
|
|
|
string(REGEX REPLACE ".+CV_VERSION_MAJOR[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}")
|
|
|
|
string(REGEX REPLACE ".+CV_VERSION_MINOR[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}")
|
|
|
|
string(REGEX REPLACE ".+CV_VERSION_REVISION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}")
|
2013-09-12 20:37:05 +08:00
|
|
|
string(REGEX REPLACE ".+CV_VERSION_STATUS[ ]+\"([^\"]*)\".*" "\\1" OPENCV_VERSION_STATUS "${OPENCV_VERSION_PARTS}")
|
2013-01-18 18:57:55 +08:00
|
|
|
|
2013-09-12 20:37:05 +08:00
|
|
|
set(OPENCV_VERSION_PLAIN "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
2012-02-03 19:26:49 +08:00
|
|
|
|
2013-09-12 20:37:05 +08:00
|
|
|
set(OPENCV_VERSION "${OPENCV_VERSION_PLAIN}${OPENCV_VERSION_STATUS}")
|
|
|
|
|
2021-12-02 21:32:59 +08:00
|
|
|
string(REGEX MATCH "[0-9][0-9]$" OPENCV_VERSION_MINOR_2DIGITS "00${OPENCV_VERSION_MINOR}")
|
|
|
|
string(REGEX MATCH "[0-9][0-9]$" OPENCV_VERSION_PATCH_2DIGITS "00${OPENCV_VERSION_PATCH}")
|
|
|
|
ocv_update(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR_2DIGITS}")
|
|
|
|
ocv_update(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
2012-02-03 19:26:49 +08:00
|
|
|
|
2017-08-20 23:21:39 +08:00
|
|
|
# create a dependency on the version file
|
|
|
|
# we never use the output of the following command but cmake will rerun automatically if the version file changes
|
2018-12-07 13:14:08 +08:00
|
|
|
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/opencv_junk/version.junk" COPYONLY)
|
2017-06-20 18:55:17 +08:00
|
|
|
|
|
|
|
ocv_update(OPENCV_VS_VER_FILEVERSION_QUAD "${OPENCV_VERSION_MAJOR},${OPENCV_VERSION_MINOR},${OPENCV_VERSION_PATCH},0")
|
|
|
|
ocv_update(OPENCV_VS_VER_PRODUCTVERSION_QUAD "${OPENCV_VERSION_MAJOR},${OPENCV_VERSION_MINOR},${OPENCV_VERSION_PATCH},0")
|
|
|
|
ocv_update(OPENCV_VS_VER_FILEVERSION_STR "${OPENCV_VERSION}")
|
|
|
|
ocv_update(OPENCV_VS_VER_PRODUCTVERSION_STR "${OPENCV_VERSION}")
|
|
|
|
ocv_update(OPENCV_VS_VER_PRODUCTNAME_STR "OpenCV library")
|
|
|
|
ocv_update(OPENCV_VS_VER_COMMENTS_STR "http://opencv.org/")
|