experimenting with PRE_BUILD command
This commit is contained in:
parent
b38329aa0e
commit
dd986fefd3
@ -25,7 +25,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
list(GET FSFW_GIT_INFO 1 FSFW_VERSION)
|
||||
list(GET FSFW_GIT_INFO 2 FSFW_SUBVERSION)
|
||||
list(GET FSFW_GIT_INFO 3 FSFW_REVISION)
|
||||
list(GET FSFW_GIT_INFO 4 FSFW_VERSION_CST_GIT_SHA1)
|
||||
list(GET FSFW_GIT_INFO 4 FSFW_VCS_INFO)
|
||||
if(NOT FSFW_VERSION)
|
||||
set(FSFW_VERSION ${FSFW_VERSION_IF_GIT_FAILS})
|
||||
endif()
|
||||
@ -448,6 +448,13 @@ string(CONCAT POST_BUILD_COMMENT
|
||||
"######################################################################\n"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${LIB_FSFW_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/FSFWVersion.h.in
|
||||
COMMENT "${MSG_PREFIX} Updating FSFWVersion.h"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${LIB_FSFW_NAME}
|
||||
POST_BUILD
|
||||
|
0
FSFWVersion.h.in
Normal file
0
FSFWVersion.h.in
Normal file
@ -6,6 +6,6 @@ static constexpr int FSFW_VERSION_MAJOR = @FSFW_VERSION@;
|
||||
static constexpr int FSFW_VERSION_MINOR = @FSFW_SUBVERSION@;
|
||||
static constexpr int FSFW_VERSION_REVISION = @FSFW_REVISION@;
|
||||
// Also contains CST (Commits since tag) information
|
||||
static const char FSFW_VERSION_CST_GIT_SHA1[] = "@FSFW_VERSION_CST_GIT_SHA1@";
|
||||
static const char FSFW_VCS_INFO[] = "@FSFW_VCS_INFO@";
|
||||
|
||||
#endif /* FSFW_VERSION_H_ */
|
||||
|
@ -13,7 +13,7 @@
|
||||
#endif
|
||||
|
||||
const fsfw::Version fsfw::FSFW_VERSION = {FSFW_VERSION_MAJOR, FSFW_VERSION_MINOR,
|
||||
FSFW_VERSION_REVISION, FSFW_VERSION_CST_GIT_SHA1};
|
||||
FSFW_VERSION_REVISION, FSFW_VCS_INFO};
|
||||
|
||||
fsfw::Version::Version(int major, int minor, int revision, const char* addInfo)
|
||||
: major(major), minor(minor), revision(revision), addInfo(addInfo) {}
|
||||
|
Loading…
Reference in New Issue
Block a user