Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nondeterministic C include renaming #64

Merged
merged 3 commits into from
Aug 8, 2022
Merged

Conversation

mikedh
Copy link
Contributor

@mikedh mikedh commented Aug 8, 2022

No description provided.

@PyryM PyryM merged commit 3084f79 into PyryM:master Aug 8, 2022
@@ -6,7 +6,7 @@
#ifndef TRUSSAPI_H_HEADER_GUARD
#define TRUSSAPI_H_HEADER_GUARD

#define TRUSS_VERSION_STRING "0.2.2"
#define TRUSS_VERSION_STRING "0.2.3"
Copy link
Collaborator

@psigen psigen Aug 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The normal way to do this is to just ask git and put the result into a compile variable:
https://cmake.org/pipermail/cmake/2018-October/068389.html

find_package(Git QUIET REQUIRED)

execute_process(
    COMMAND "${GIT_EXECUTABLE}" describe --always HEAD
    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
    RESULT_VARIABLE res
    OUTPUT_VARIABLE MYAPP_VERSION
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE)

set_property(GLOBAL APPEND
    PROPERTY CMAKE_CONFIGURE_DEPENDS
    "${CMAKE_SOURCE_DIR}/.git/index")

string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*$"
"\\1;\\2;\\3" _ver_parts "${MYAPP_VERSION}")
list(GET _ver_parts 0 MYAPP_VERSION_MAJOR)
list(GET _ver_parts 1 MYAPP_VERSION_MINOR)
list(GET _ver_parts 2 MYAPP_VERSION_PATCH)

if("${MYAPP_VERSION}" MATCHES "^.*-(.*)-g.*$")
    string(REGEX REPLACE "^.*-(.*)-g.*$" "\\1" MYAPP_VERSION_MICRO
"${MYAPP_VERSION}")
else()
    set(MYAPP_VERSION_MICRO "0")
endif()

This prevents the spurious commit versions in source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants