Breaking change, rename 'cmake.minimum' to 'cmake.version' and make it optional

toml-checker
Duncan Ogilvie 4 years ago
parent 5c942599a5
commit b5752b7c2b

@ -1,24 +1,26 @@
# This file was generated automatically by cmkr.
# Create a configure-time dependency on cmake.toml to improve IDE support
configure_file(cmake.toml cmake.toml COPYONLY)
cmake_minimum_required(VERSION 2.8...3.8)
# Regenerate CMakeLists.txt file when necessary
# Regenerate CMakeLists.txt automatically in the root project
set(CMKR_ROOT_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMKR_ROOT_PROJECT ON)
# Bootstrap cmkr
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT)
cmkr()
endif()
# Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
# Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Create a configure-time dependency on cmake.toml to improve IDE support
if(CMKR_ROOT_PROJECT)
configure_file(cmake.toml cmake.toml COPYONLY)
endif()
# Hack to hide a warning during cmkr bootstrapping on Windows
if(CMAKE_BUILD_TYPE)
@ -34,6 +36,7 @@ project(cmkr
"CMakeLists generator from TOML"
)
# third_party
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
if(CMAKE_FOLDER)
set(CMAKE_FOLDER "${CMAKE_FOLDER}/third_party")

@ -1,5 +1,5 @@
[cmake]
minimum = "2.8...3.8"
version = "2.8...3.8"
[project]
cmake-before = """

@ -11,7 +11,7 @@ int %s() {
static const char *cmake_toml = R"lit(
[cmake]
minimum = "3.15"
version = "3.15"
# subdirs = []
# build-dir = ""
# cpp-flags = []

@ -58,8 +58,8 @@ CMake::CMake(const std::string &path, bool build) {
} else {
if (toml.contains("cmake")) {
const auto &cmake = toml::find(toml, "cmake");
cmake_version = toml::find(cmake, "minimum").as_string();
cmkr_include = toml::find_or(cmake, "cmkr-include", "cmkr.cmake");
cmake_version = toml::find(cmake, "version").as_string();
cmkr_include = toml::find_or(cmake, "cmkr-include", cmkr_include);
cppflags = optional_array(cmake, "cpp-flags");
cflags = optional_array(cmake, "c-flags");
linkflags = optional_array(cmake, "link-flags");

@ -79,8 +79,9 @@ struct Install {
};
struct CMake {
std::string cmake_version;
std::string cmkr_include;
// This is the CMake version required to use all cmkr versions.
std::string cmake_version = "3.15";
std::string cmkr_include = "cmkr.cmake";
std::string build_dir = "build";
std::string generator;
std::string config;

Loading…
Cancel
Save