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/CMakeLists.txt | |
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/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 13 |
1 files changed, 13 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) |