Commit 12acf396 authored by T.J. Corona's avatar T.J. Corona Committed by Kitware Robot

Merge topic 'fetch-cmb-smtk-versions'

663ce9e0 Fetch versions for smtk/cmb master from gitlab
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel's avatarBen Boeckel <ben.boeckel@kitware.com>
Merge-request: !476
parents ede0b3db 663ce9e0
......@@ -11,8 +11,12 @@ macro (superbuild_setup_variables)
if (cmb_SOURCE_SELECTION STREQUAL "git")
# Assuming master; just use the latest version, but let the user set their
# own version in case it is actually a branch from some other version.
set(CMB_VERSION_DEFAULT "6.0.0"
set(CMB_VERSION_DEFAULT "<FETCH_FROM_GIT>"
CACHE STRING "The default version of CMB to use if it cannot be detected")
if (CMB_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
include(cmbVersion)
set(CMB_VERSION_DEFAULT "${cmb_version_major}.${cmb_version_minor}.${cmb_version_patch}")
endif ()
mark_as_advanced(CMB_VERSION_DEFAULT)
set(cmb_default_version "${CMB_VERSION_DEFAULT}")
elseif (cmb_SOURCE_SELECTION STREQUAL "source")
......@@ -29,8 +33,12 @@ macro (superbuild_setup_variables)
if (smtk_SOURCE_SELECTION STREQUAL "git" OR smtk_SOURCE_SELECTION STREQUAL "from_cmb")
# Assuming master; just use the latest version, but let the user set their
# own version in case it is actually a branch from some other version.
set(SMTK_VERSION_DEFAULT "3.0.0"
set(SMTK_VERSION_DEFAULT "<FETCH_FROM_GIT>"
CACHE STRING "The default version of SMTK to use if it cannot be detected")
if (SMTK_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
include(smtkVersion)
set(SMTK_VERSION_DEFAULT "${smtk_version_major}.${smtk_version_minor}.${smtk_version_patch}")
endif ()
mark_as_advanced(SMTK_VERSION_DEFAULT)
set(smtk_default_version "${SMTK_VERSION_DEFAULT}")
elseif (smtk_SOURCE_SELECTION STREQUAL "source")
......
# Download SMTK's master branch version.txt
file(DOWNLOAD https://gitlab.kitware.com/cmb/cmb/raw/master/version.txt
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cmbVersion.txt STATUS status)
list(GET status 0 error_code)
if (error_code)
message(FATAL_ERROR "Could not access the version file for CMB")
endif ()
file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cmbVersion.txt version_string )
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)[-]*(.*)"
version_matches "${version_string}")
set(cmb_version_major ${CMAKE_MATCH_1})
set(cmb_version_minor ${CMAKE_MATCH_2})
set(cmb_version_patch "${CMAKE_MATCH_3}")
# Do we just have a patch version or are there extra stuff?
if (CMAKE_MATCH_4)
set(cmb_version_patch "${CMAKE_MATCH_3}-${CMAKE_MATCH_4}")
endif()
set(cmb_version "${cmb_version_major}.${cmb_version_minor}")
# Download SMTK's master branch version.txt
file(DOWNLOAD https://gitlab.kitware.com/cmb/smtk/raw/master/version.txt
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/smtkVersion.txt STATUS status)
list(GET status 0 error_code)
if (error_code)
message(FATAL_ERROR "Could not access the version file for SMTK")
endif ()
file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/smtkVersion.txt version_string )
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)[-]*(.*)"
version_matches "${version_string}")
set(smtk_version_major ${CMAKE_MATCH_1})
set(smtk_version_minor ${CMAKE_MATCH_2})
set(smtk_version "${smtk_version_major}.${smtk_version_minor}")
if (CMAKE_MATCH_3)
set(smtk_version_patch ${CMAKE_MATCH_3})
set(smtk_version "${smtk_version}.${smtk_version_patch}")
else()
set(smtk_version_patch 0)
endif()
# To be thorough, we should split the label into "-prerelease+metadata"
# and, if prerelease is specified, use it in determining precedence
# according to semantic versioning rules at http://semver.org/ .
# For now, just make the information available as a label:
if (CMAKE_MATCH_4)
set(smtk_version_label "${CMAKE_MATCH_4}")
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment