Add versioning system
This commit is contained in:
parent
82a18161d3
commit
df359a712e
@ -1,5 +1,4 @@
|
|||||||
# Mainspring project CMakeLists.txt
|
# Mainspring project CMakeLists.txt
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
project(mainspring)
|
project(mainspring)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# Mainspring app CMakeLists.txt
|
# Mainspring app CMakeLists.txt
|
||||||
|
|
||||||
add_executable(Mainspring WIN32 "src/Mainspring.cpp")
|
add_executable(Mainspring WIN32 "src/Mainspring.cpp")
|
||||||
|
|
||||||
set_property(TARGET Mainspring PROPERTY CXX_STANDARD 20)
|
set_property(TARGET Mainspring PROPERTY CXX_STANDARD 20)
|
||||||
@ -9,3 +8,8 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /entry:mainCRTStartup")
|
|||||||
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||||
set_property(TARGET Mainspring PROPERTY WIN32_EXECUTABLE FALSE)
|
set_property(TARGET Mainspring PROPERTY WIN32_EXECUTABLE FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(Git)
|
||||||
|
execute_process(COMMAND ${GIT_EXECUTABLE} describe OUTPUT_VARIABLE MAINSPRING_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
configure_file(src/version.h.in version.h)
|
||||||
|
target_include_directories(Mainspring PUBLIC "${PROJECT_BINARY_DIR}/Mainspring")
|
@ -1,9 +1,11 @@
|
|||||||
// Mainspring main file
|
// Mainspring main file
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <format>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
std::cout << "Mainspring\n";
|
std::cout << std::format("Mainspring {}\n", MAINSPRING_VERSION);
|
||||||
|
|
||||||
std::cin.get();
|
std::cin.get();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
2
Mainspring/src/version.h.in
Normal file
2
Mainspring/src/version.h.in
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Version configured header file
|
||||||
|
#define MAINSPRING_VERSION "@MAINSPRING_VERSION@"
|
Loading…
x
Reference in New Issue
Block a user