diff options
author | Marius Kintel <marius@kintel.net> | 2013-10-19 21:15:05 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-10-19 21:15:05 (GMT) |
commit | 257d1f711525414038242f40796abf57e5ef9c0e (patch) | |
tree | 7a67e9c912986851b8bf9a474ff2ae2ebb50d760 /tests | |
parent | e77615be3027cfe365e3e52f3ed609dae9711028 (diff) |
Use VERSION env. variable or current timestamp for test builds
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2957240..c560b4f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -434,7 +434,32 @@ endif() # Internal includes include_directories(../src) -add_definitions(-DOPENSCAD_VERSION=test -DOPENSCAD_YEAR=2011 -DOPENSCAD_MONTH=10) +# Handle OpenSCAD version based on VERSION env. variable. +# Use current timestamp if not specified (development builds) +if ("$ENV{VERSION}" STREQUAL "") + # Timestamp is only available in cmake >= 2.8.11 + if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.10) + string(TIMESTAMP VERSION "%Y.%m.%d") + else() + set(VERSION "2013.06") + endif() +else() + set(VERSION $ENV{VERSION}) +endif() +message(STATUS "OpenSCAD version: ${VERSION}") +string(REGEX MATCHALL "^[0-9]+|[0-9]+|[0-9]+$" MYLIST "${VERSION}") +list(GET MYLIST 0 OPENSCAD_YEAR) +list(GET MYLIST 1 OPENSCAD_MONTH) +list(LENGTH MYLIST VERSIONLEN) +if (${VERSIONLEN} EQUAL 3) + list(GET MYLIST 2 OPENSCAD_DAY) +endif() + +add_definitions(-DOPENSCAD_VERSION=${VERSION} -DOPENSCAD_YEAR=${OPENSCAD_YEAR} -DOPENSCAD_MONTH=${OPENSCAD_MONTH}) +if (DEFINED OPENSCAD_DAY) + add_definitions(-DOPENSCAD_DAY=${OPENSCAD_DAY}) +endif() + add_definitions(-DOPENSCAD_TESTING) # Search for MCAD in correct place |