Skip to content

Commit

Permalink
Use windows compatible build date generation #16
Browse files Browse the repository at this point in the history
Rely on CMake TIMESTAMP to provide date string derivatives.
  • Loading branch information
evido committed Jun 9, 2020
1 parent 80f117f commit ad48872
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ add_library(jsoncpp STATIC
ext/jsoncpp/include/json/json.h
ext/jsoncpp/include/json/json-forwards.h)

set(ENV{TZ} utc)
# the commit's SHA1, and whether the building workspace was dirty or not
execute_process(COMMAND
"${GIT_EXECUTABLE}" describe --match=NeVeRmAtCh --always --abbrev=40 --dirty
Expand Down Expand Up @@ -127,21 +126,14 @@ execute_process(COMMAND
OUTPUT_VARIABLE BUILD_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)


# the subject of the commit
execute_process(COMMAND
"date" -u +%Y%m%d.%H%M%S
OUTPUT_VARIABLE BUILD_VERSION
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)


unset(ENV{TZ})
string(TIMESTAMP BUILD_DATE "%a %b %d %H:%M:%S %Y" UTC)
string(TIMESTAMP BUILD_VERSION %Y%m%d.%H%M%S UTC)

# generate version.cpp
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/version.cpp" @ONLY)


add_executable(wotreplay-parser src/main.cpp "${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp" src/version.h)
add_executable(wotreplay-parser src/main.cpp "${CMAKE_CURRENT_SOURCE_DIR}/src/version.cpp" src/version.h)

target_link_libraries( wotreplay ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${TBB_LIBRARIES} ${GD_LIBRARY})
target_link_libraries( wotreplay-parser ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${TBB_LIBRARIES} ${GD_LIBRARY} wotreplay jsoncpp)
Expand Down

0 comments on commit ad48872

Please sign in to comment.