Cleanup version number handling in CMake
This commit is contained in:
parent
380e2db9aa
commit
876744ad2c
|
@ -23,37 +23,55 @@ option (SYNERGY_BUILD_LEGACY_INSTALLER "Build the installer" ON)
|
||||||
set (CMAKE_CXX_STANDARD 14)
|
set (CMAKE_CXX_STANDARD 14)
|
||||||
set (CMAKE_CXX_EXTENSIONS OFF)
|
set (CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Version
|
# Version
|
||||||
#
|
#
|
||||||
if ((NOT DEFINED SYNERGY_VERSION_MAJOR) AND (DEFINED ENV{SYNERGY_VERSION_MAJOR}))
|
# NOTE: We follow 'Semantic Versioning' now: http://semver.org/
|
||||||
|
|
||||||
|
if (NOT DEFINED SYNERGY_VERSION_MAJOR)
|
||||||
|
if (DEFINED ENV{SYNERGY_VERSION_MAJOR})
|
||||||
set (SYNERGY_VERSION_MAJOR $ENV{SYNERGY_VERSION_MAJOR})
|
set (SYNERGY_VERSION_MAJOR $ENV{SYNERGY_VERSION_MAJOR})
|
||||||
|
else()
|
||||||
|
set (SYNERGY_VERSION_MAJOR 1)
|
||||||
|
message (WARNING "SYNERGY_VERSION_MAJOR not set. Defaulted to ${SYNERGY_VERSION_MAJOR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED SYNERGY_VERSION_MINOR)
|
||||||
|
if (DEFINED ENV{SYNERGY_VERSION_MINOR})
|
||||||
set (SYNERGY_VERSION_MINOR $ENV{SYNERGY_VERSION_MINOR})
|
set (SYNERGY_VERSION_MINOR $ENV{SYNERGY_VERSION_MINOR})
|
||||||
|
else()
|
||||||
|
set (SYNERGY_VERSION_MINOR 9)
|
||||||
|
message (WARNING "(SYNERGY_VERSION_MINOR not set. Defaulted to ${SYNERGY_VERSION_MINOR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED SYNERGY_VERSION_PATCH)
|
||||||
|
if (DEFINED ENV{SYNERGY_VERSION_PATCH})
|
||||||
set (SYNERGY_VERSION_PATCH $ENV{SYNERGY_VERSION_PATCH})
|
set (SYNERGY_VERSION_PATCH $ENV{SYNERGY_VERSION_PATCH})
|
||||||
|
else()
|
||||||
|
set (SYNERGY_VERSION_PATCH 0)
|
||||||
|
message (WARNING "SYNERGY_VERSION_PATCH not set. Defaulted to ${SYNERGY_VERSION_PATCH}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED SYNERGY_VERSION_STAGE)
|
||||||
|
if (DEFINED ENV{SYNERGY_VERSION_STAGE})
|
||||||
set (SYNERGY_VERSION_STAGE $ENV{SYNERGY_VERSION_STAGE})
|
set (SYNERGY_VERSION_STAGE $ENV{SYNERGY_VERSION_STAGE})
|
||||||
|
else()
|
||||||
|
set (SYNERGY_VERSION_STAGE "git")
|
||||||
|
message (WARNING "SYNERGY_VERSION_STAGE not set. Defaulted to ${SYNERGY_VERSION_STAGE}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DEFINED SYNERGY_VERSION_MAJOR)
|
if ((NOT DEFINED SYNERGY_REVISION) AND (DEFINED ENV{SYNERGY_REVISION}))
|
||||||
set (VERSION_MAJOR ${SYNERGY_VERSION_MAJOR})
|
set (SYNERGY_REVISION $ENV{SYNERGY_REVISION})
|
||||||
set (VERSION_MINOR ${SYNERGY_VERSION_MINOR})
|
|
||||||
set (VERSION_REV ${SYNERGY_VERSION_PATCH})
|
|
||||||
set (VERSION_STAGE ${SYNERGY_VERSION_STAGE})
|
|
||||||
else()
|
|
||||||
message (WARNING "Synergy version number not set by build environment.")
|
|
||||||
set (VERSION_MAJOR 1)
|
|
||||||
set (VERSION_MINOR 9)
|
|
||||||
set (VERSION_REV 0)
|
|
||||||
set (VERSION_STAGE git)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set (SYNERGY_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
|
set (SYNERGY_VERSION "${SYNERGY_VERSION_MAJOR}.${SYNERGY_VERSION_MINOR}.${SYNERGY_VERSION_PATCH}")
|
||||||
set (VERSION ${SYNERGY_VERSION})
|
|
||||||
message (STATUS "Synergy version is " ${SYNERGY_VERSION})
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: Find out why we need these, and remove them
|
# TODO: Find out why we need these, and remove them
|
||||||
if (COMMAND cmake_policy)
|
if (COMMAND cmake_policy)
|
||||||
|
|
|
@ -33,8 +33,8 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
qt5_use_modules (synergy Core Widgets Network)
|
qt5_use_modules (synergy Core Widgets Network)
|
||||||
target_compile_definitions (synergy PRIVATE -DVERSION_STAGE="${VERSION_STAGE}")
|
target_compile_definitions (synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_VERSION_STAGE}")
|
||||||
target_compile_definitions (synergy PRIVATE -DVERSION_REVISION="${SYNERGY_GIT_COMMIT}")
|
target_compile_definitions (synergy PRIVATE -DSYNERGY_REVISION="${SYNERGY_REVISION}")
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries (synergy ${DNSSD_LIB})
|
target_link_libraries (synergy ${DNSSD_LIB})
|
||||||
|
|
|
@ -29,7 +29,7 @@ AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) :
|
||||||
|
|
||||||
m_versionChecker.setApp(synergyApp);
|
m_versionChecker.setApp(synergyApp);
|
||||||
QString version = m_versionChecker.getVersion();
|
QString version = m_versionChecker.getVersion();
|
||||||
version = version + '-' + VERSION_STAGE + '-' + VERSION_REVISION;
|
version = version + '-' + SYNERGY_VERSION_STAGE + '-' + SYNERGY_REVISION;
|
||||||
m_pLabelSynergyVersion->setText(version);
|
m_pLabelSynergyVersion->setText(version);
|
||||||
|
|
||||||
QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified();
|
QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified();
|
||||||
|
|
Loading…
Reference in New Issue