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

vcpkg-wip
Duncan Ogilvie 4 years ago
parent 5c942599a5
commit b5752b7c2b

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

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

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

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

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

Loading…
Cancel
Save