mirror of
https://github.com/build-cpp/cmkr
synced 2026-06-08 13:22:55 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43c72160b5 | |||
| ef3c1a288a | |||
| 26acf23989 | |||
| 15886fc340 | |||
| d5e34b0bcc | |||
| 916ae11cae | |||
| eaa361611a | |||
| 2300612ba9 |
@@ -10,6 +10,7 @@ if(CMAKE_SCRIPT_MODE_FILE)
|
||||
set(CMAKE_BINARY_DIR "${CMAKE_BINARY_DIR}/build")
|
||||
set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_BINARY_DIR}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/.gitignore" "# This file is autogenerated by cmkr.\n*\n")
|
||||
endif()
|
||||
|
||||
# Set these from the command line to customize for development/debugging purposes
|
||||
|
||||
@@ -255,7 +255,13 @@ void generate_project(const std::string &type) {
|
||||
generate_gitfile(".gitattributes", {"/**/CMakeLists.txt linguist-generated", "/**/cmkr.cmake linguist-vendored"});
|
||||
|
||||
// Generate .gitignore with reasonable defaults for CMake
|
||||
generate_gitfile(".gitignore", {"build*/", "cmake-build*/", "CMakerLists.txt", "CMakeLists.txt.user"});
|
||||
generate_gitfile(".gitignore", {
|
||||
"build*/",
|
||||
"cmake-build*/",
|
||||
"CMakerLists.txt",
|
||||
"CMakeLists.txt.user",
|
||||
"CMakeUserPresets.json",
|
||||
});
|
||||
|
||||
tsl::ordered_map<std::string, std::string> variables = {
|
||||
{"@name", name},
|
||||
|
||||
@@ -445,18 +445,19 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
|
||||
options.push_back(o);
|
||||
|
||||
// Add a condition matching the option name
|
||||
conditions.emplace(o.name, o.name);
|
||||
if (!conditions.emplace(o.name, o.name).second) {
|
||||
print_key_warning("Option '" + o.name + "' would create a condition '" + o.name + "' that already exists", o.name, value);
|
||||
}
|
||||
|
||||
// Add an implicit condition for the option
|
||||
auto ncondition = normalize(o.name);
|
||||
if (ncondition.find(nproject_prefix) == 0) {
|
||||
ncondition = ncondition.substr(nproject_prefix.size());
|
||||
}
|
||||
if (!ncondition.empty()) {
|
||||
if (conditions.contains(ncondition)) {
|
||||
if (!ncondition.empty() && ncondition != o.name) {
|
||||
if (!conditions.emplace(ncondition, o.name).second) {
|
||||
print_key_warning("Option '" + o.name + "' would create a condition '" + ncondition + "' that already exists", o.name, value);
|
||||
}
|
||||
conditions.emplace(ncondition, o.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user