diff options
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 { |