Commit bff37f8d authored by Klint Youngmeyer's avatar Klint Youngmeyer
Browse files

Fix some cmake issues. Add .gitignore. Add README

parent 99a48d51
Pipeline #93 failed with stages
......@@ -5,8 +5,8 @@ if(DEFINED ARCH)
include ($ENV{HOME}/EMAC-SDK/example-projects/toolchain.i586.cmake)
endif()
endif()
cmake_minimum_required(VERSION 2.8)
project(git-hash-in-program)
cmake_minimum_required(VERSION 3.0)
project(GIT_HASH_IN_PROGRAM)
## Git Stuff
# Get the current working branch
......@@ -34,9 +34,14 @@ include_directories("inc/")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi -Wall -std=gnu99 -g -O0")
add_definitions(-D_GNU_SOURCE)
# Add all .c or .h files in the below dirctories
file(GLOB CORE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c")
file(GLOB CORE_INC "${CMAKE_CURRENT_SOURCE_DIR}/inc/*.h")
# Can add more sources or headers in these variables.
set(SOURCES ${CORE_SRC})
set(HEADERS ${CORE_INC})
if(DEFINED BUILD)
if(${BUILD} STREQUAL "DEBUG")
add_definitions(-DDEBUG)
......
# Git Info in Binary
Template project that includes the Git branch and current Git commit hash in the actual binary. This project is built with `cmake` as follows.
```
mkdir build
cd build/
cmake ..
make
```
You can run the binary with:
```
./git-hash
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment