Changeset - b0a44adcd19f
[Not reviewed]
default
0 3 0
Hasan Yavuz ÖZDERYA - 8 years ago 2017-05-05 05:13:45
hy@ozderya.net
move version information back to cmake file because its needed for package names
3 files changed with 25 insertions and 13 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
@@ -161,14 +161,15 @@ else()
 
  message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
 
endif()
 

	
 
# get revision number from mercurial
 
# default version
 
set(VERSION_STRING "0.9.0")
 
set(VERSION_REVISION "0")
 

	
 
# get revision number from mercurial and parse version string
 
include(GetVersion)
 
if (NOT ${HG_VERSION} STREQUAL "")
 
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_STRING=\\\"${HG_VERSION}\\\" ")
 
endif()
 
if (NOT ${HG_REVISION} STREQUAL "")
 
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_REVISION=\\\"${HG_REVISION}\\\" ")
 
endif()
 

	
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_STRING=\\\"${VERSION_STRING}\\\" ")
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_REVISION=\\\"${VERSION_REVISION}\\\" ")
 

	
 
# add make run target
 
add_custom_target(run
 
@@ -228,9 +229,9 @@ include(InstallRequiredSystemLibraries)
 
set(CPACK_PACKAGE_NAME "${PROGRAM_NAME}")
 
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Small and simple software for plotting data from serial port")
 
set(CPACK_PACKAGE_CONTACT "Hasan Yavuz Özderya <hy@ozderya.net>")
 
set(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
 
set(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
 
set(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION})
 
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
 
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
 
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
 
set(CPACK_STRIP_FILES TRUE)
 
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5widgets5 (>= 5.2.1), libqt5svg5 (>= 5.2.1), libqt5serialport5 (>= 5.2.1), libc6 (>= 2.19)")
 
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Small and simple software for plotting data from serial port
cmake/modules/GetVersion.cmake
Show inline comments
 
@@ -60,7 +60,17 @@ endif ()
 
# extract version information from tag (remove 'v' prefix)
 
if (NOT ${HG_LATEST_TAG} STREQUAL "")
 
  string(REPLACE "v" "" HG_VERSION ${HG_LATEST_TAG})
 
  message("Version: ${HG_VERSION} (${HG_REVISION})")
 
  message("Version from mercurial: ${HG_VERSION} (${HG_REVISION})")
 

	
 
  # replace version string
 
  set(VERSION_STRING ${HG_VERSION})
 
  set(VERSION_REVISION ${HG_REVISION})
 
else ()
 
  message("Failed to find version information.")
 
  message("Failed to find version information from mercurial.")
 
endif ()
 

	
 
# parse version numbers
 
string(REPLACE "." ";" VERSION_LIST ${VERSION_STRING})
 
list(GET VERSION_LIST 0 VERSION_MAJOR)
 
list(GET VERSION_LIST 1 VERSION_MINOR)
 
list(GET VERSION_LIST 2 VERSION_PATCH)
src/version.h
Show inline comments
 
@@ -21,7 +21,8 @@
 
#define VERSION_H
 

	
 
#ifndef VERSION_STRING
 
#define VERSION_STRING   "0.9.0"
 
#warning VERSION_STRING not defined!
 
#define VERSION_STRING   "0.0.0"
 
#endif
 

	
 
#ifndef VERSION_REVISION
0 comments (0 inline, 0 general)