2012-02-03 12:26:49 +01:00
|
|
|
SET(OPENCV_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/modules/core/include/opencv2/core/version.hpp")
|
2013-09-12 14:37:05 +02:00
|
|
|
file(STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS REGEX "#define CV_VERSION_[A-Z]+[ ]+" )
|
2012-02-16 21:29:35 +01:00
|
|
|
|
2013-11-15 16:41:53 +01: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 14:37:05 +02:00
|
|
|
string(REGEX REPLACE ".+CV_VERSION_STATUS[ ]+\"([^\"]*)\".*" "\\1" OPENCV_VERSION_STATUS "${OPENCV_VERSION_PARTS}")
|
2013-01-18 11:57:55 +01:00
|
|
|
|
2013-09-12 14:37:05 +02:00
|
|
|
set(OPENCV_VERSION_PLAIN "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
2012-02-03 12:26:49 +01:00
|
|
|
|
2013-09-12 14:37:05 +02:00
|
|
|
set(OPENCV_VERSION "${OPENCV_VERSION_PLAIN}${OPENCV_VERSION_STATUS}")
|
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
|
2013-01-18 11:57:55 +01:00
|
|
|
set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
2012-02-03 12:26:49 +01:00
|
|
|
|
|
|
|
# create a dependency on version file
|
|
|
|
# we never use output of the following command but cmake will rerun automatically if the version file changes
|
|
|
|
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY)
|