diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-02-25 07:01:28 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-02-25 07:01:28 +0100 |
commit | f19b8c4d82380ae0defb6c6041270d815164b0d2 (patch) | |
tree | 2155a87f86d48f520e77d4fb2fbb6884128da960 /src | |
parent | da761883608d20798c66a2e9243240bb6142b024 (diff) | |
download | fastd-f19b8c4d82380ae0defb6c6041270d815164b0d2.tar fastd-f19b8c4d82380ae0defb6c6041270d815164b0d2.zip |
Rewrite 'git describe' version support to update the version whenever needed
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 13 | ||||
-rw-r--r-- | src/types.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 916a726..0b45153 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,4 +36,17 @@ add_executable(fastd set_target_properties(fastd PROPERTIES COMPILE_FLAGS -pthread ${UECC_CFLAGS_OTHER} LINK_FLAGS -pthread ${UECC_LDFLAGS_OTHER}) target_link_libraries(fastd rt ${CAP_LIBRARY} ${UECC_LIBRARIES} ${NACL_LIBRARY}) +add_custom_target( + version + COMMAND echo "#ifndef _FASTD_VERSION_H_" > ${CMAKE_CURRENT_BINARY_DIR}/version.h.new + COMMAND echo "#define _FASTD_VERSION_H_" >> ${CMAKE_CURRENT_BINARY_DIR}/version.h.new + COMMAND sh -c "echo \"#define FASTD_VERSION \\\"\$(git describe --dirty || echo ${FASTD_VERSION})\\\"\"" >> ${CMAKE_CURRENT_BINARY_DIR}/version.h.new + COMMAND echo "#endif /* _FASTD_VERSION_H_ */" >> ${CMAKE_CURRENT_BINARY_DIR}/version.h.new + COMMAND cmp -s ${CMAKE_CURRENT_BINARY_DIR}/version.h.new ${CMAKE_CURRENT_BINARY_DIR}/version.h && rm ${CMAKE_CURRENT_BINARY_DIR}/version.h.new || mv ${CMAKE_CURRENT_BINARY_DIR}/version.h.new ${CMAKE_CURRENT_BINARY_DIR}/version.h + WORKING_DIRECTORY "${FASTD_SOURCE_DIR}" + VERBATIM +) + +add_dependencies(fastd version) + install(TARGETS fastd RUNTIME DESTINATION bin) diff --git a/src/types.h b/src/types.h index 4cd48e6..1a0b791 100644 --- a/src/types.h +++ b/src/types.h @@ -34,6 +34,7 @@ #define _FASTD_TYPES_H_ #include <config.h> +#include <version.h> typedef enum fastd_mode { |