@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.9)
44set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR} /cmake/" )
55
66#TODO better versioning here when releasing
7- set (VERSION_SHORT "latest" )
7+
88
99# Enforce build type
1010if (NOT CMAKE_BUILD_TYPE )
@@ -51,23 +51,25 @@ find_package(LibXml2)
5151
5252message (STATUS "openssl libraries: ${OPENSSL_LIBRARIES} " )
5353
54- # Figure out a proper versioning for the build
55- if (NOT GIT_FOUND)
56- find_package (Git QUIET )
57- endif ()
58-
59- execute_process (COMMAND ${GIT_EXECUTABLE} describe --tags --match "ver*"
60- OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
61-
62- if (VERSION MATCHES "^ver" )
63- MESSAGE (STATUS "log: found git tag: ${VERSION} " )
54+ if (NOT PROJECT_IS_TOP_LEVEL)
55+ set (VERSION_SHORT "latest" )
56+ set (CMAKE_PROJECT_NAME "libzwaveip" )
6457else ()
65- if (NOT DEFINED VERSION )
66- set (VERSION ver0_0.0)
58+
59+ # Figure out a proper versioning for the build
60+ if (NOT GIT_FOUND)
61+ find_package (Git QUIET )
6762 endif ()
63+
64+ execute_process (COMMAND ${GIT_EXECUTABLE} describe --tags --match "ver*"
65+ OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
66+ endif ()
67+
68+ if (NOT VERSION MATCHES "^ver" )
69+ set (VERSION ver0_0.00)
6870endif ()
6971
70- # parse the version information into pieces.
72+ message ( STATUS "log: parse the version information into pieces: ${VERSION} " )
7173string (REGEX REPLACE "^ver([0-9]+)_.*" "\\ 1" VERSION_MAJOR "${VERSION} " )
7274string (REGEX REPLACE "^ver[0-9]+_([0-9]+).*" "\\ 1" VERSION_MINOR "${VERSION} " )
7375string (REGEX REPLACE "^ver[0-9]+_[0-9]+.[0-9]+[0-9,R,C,_]*-.[0-9]*-(.*)" "\\ 1" VERSION_SHA1 "${VERSION} " )
@@ -83,14 +85,15 @@ set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${PATCH_LEVEL}")
8385if (DEFINED VERSION_SHA1)
8486 set (VERSION_SHORT "${VERSION_SHORT} -${VERSION_SHA1} " )
8587endif ()
88+
8689message (STATUS "VERSION_MAJOR: " ${VERSION_MAJOR} )
8790message (STATUS "VERSION_MINOR: " ${VERSION_MINOR} )
8891message (STATUS "PATCH_LEVEL: " ${PATCH_LEVEL} )
8992message (STATUS "VERSION_TWEAK: " ${VERSION_TWEAK} )
9093message (STATUS "VERSION_SHA1: " ${VERSION_SHA1} )
9194message (STATUS "VERSION_SHORT: " ${VERSION_SHORT} )
9295
93- configure_file (pkgconfig.h.cmake.in ${CMAKE_CURRENT_SOURCE_DIR} / pkgconfig.h)
96+ configure_file (pkgconfig.h.cmake.in pkgconfig.h)
9497
9598add_subdirectory ( libzwaveip )
9699add_subdirectory ( xml )
0 commit comments