Created
January 7, 2017 05:10
-
-
Save abekkine/ec1486327b9a4b75cae6b5bedb7f1c21 to your computer and use it in GitHub Desktop.
Embedding Version Info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "Version.h" | |
int main() { | |
std::cout << "Version : " << VERSION_STR << std::endl; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: version | |
g++ -o main main.cpp | |
version: | |
sh version.sh | |
clean: | |
rm *.o main Version.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILE=Version.h | |
VSTR=v0.1 | |
echo "#ifndef VERSION_H_" > $FILE | |
echo "#define VERSION_H_" >> $FILE | |
echo >> $FILE | |
echo "#define VERSION_STR \"$VSTR\"" >> $FILE | |
echo >> $FILE | |
echo "#endif // VERSION_H_" >> $FILE | |
echo >> $FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment