Skip to content

Commit

Permalink
feat: specify minimum cmake version
Browse files Browse the repository at this point in the history
  • Loading branch information
araujo88 committed Apr 2, 2024
1 parent 5313b64 commit 61375f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cmake_minimum: 3.10
project_name: example_project
version: 1.0
cpp_standard: 17
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

// Config represents the structure of the YAML configuration file
type Config struct {
CMakeMinimum string `yaml:"cmake_minimum"`
ProjectName string `yaml:"project_name"`
Version string `yaml:"version"`
CPPStandard int `yaml:"cpp_standard"`
Expand Down Expand Up @@ -62,7 +63,7 @@ func generateCMakeLists(config Config) string {
var sb strings.Builder

// Basic project setup
sb.WriteString("cmake_minimum_required(VERSION 3.10)\n")
sb.WriteString("cmake_minimum_required(VERSION " + config.CMakeMinimum + ")\n")
sb.WriteString("project(" + config.ProjectName + " VERSION " + config.Version + ")\n")
sb.WriteString("set(CMAKE_CXX_STANDARD " + fmt.Sprintf("%d", config.CPPStandard) + ")\n")
sb.WriteString("set(CMAKE_CXX_STANDARD_REQUIRED True)\n")
Expand Down

0 comments on commit 61375f0

Please sign in to comment.