Hi, I’m Making the portablity of a code to CMake. The code needs that CMake defines Macro with last short head from git.
If I define the value maually,
target_compile_definitions(LibDEFINES PRIVATE
GITVER=3686e892
)
There is no problem, the code compiles, only with a warning
317:13: warning: floating constant exceeds range of ‘double’ [-Woverflow]
.arg(GITVER)
^
The problem comes when I try to extract automatic the macro value from the git command
execute_process (
COMMAND bash -c "git rev-parse --short HEAD"
OUTPUT_VARIABLE GIT_VER
)
message(WARNING "MiMENSAJE\t" ${GIT_VER}) //Prints to console the right value 3686e892
target_compile_definitions(LibDEFINES PRIVATE
GITVER=${GIT_VER}
)
but, I guess, the variable is not well defined, because, the compile process, stops with a strange error and yet compiles fine when is manual defined
A_Typedef.h:552:5: error: ‘Sem’ does not name a type
Sem* semPS;
My first assumption is that GIT_VER is declared like string, but I have no idea, perhaps I don’t use the right procedure to Set the macro.
How should I correctly define the macro from git command?
Thanks in advance.