Compare commits

..

8 Commits

Author SHA1 Message Date
Duncan Ogilvie 43c72160b5 Merge pull request #200 from de-ep/gitignore-CMKR_BUILD_DIR
Automatically create .gitignore in CMAKE_BINARY_DIR
2026-06-03 20:22:25 +02:00
deep ef3c1a288a Automatically create .gitignore in CMAKE_BINARY_DIR 2026-06-03 23:30:33 +08:00
Duncan Ogilvie 26acf23989 Merge pull request #199 from build-cpp/gitignore-update
Add CMakeUserPresets.json to generated .gitignore
2026-04-14 12:12:36 +02:00
Duncan Ogilvie 15886fc340 Add CMakeUserPresets.json to generated .gitignore 2026-04-14 12:09:54 +02:00
Duncan Ogilvie d5e34b0bcc Merge pull request #197 from ZehMatt/fix-option-prefix2
Fix a regression that no longer warns if condition is manually defined
2026-02-14 19:11:36 +01:00
ζeh Matt 916ae11cae Fix a regression that no longer warns if condition is manually defined 2026-02-14 18:14:39 +02:00
Duncan Ogilvie eaa361611a Merge pull request #196 from ZehMatt/fix-option-prefix
Fix warnings when options are not prefixed with the project name
2026-02-14 16:38:37 +01:00
ζeh Matt 2300612ba9 Fix warnings when options are not prefixed with the project name 2026-02-14 17:23:02 +02:00
3 changed files with 13 additions and 5 deletions
+1
View File
@@ -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
+7 -1
View File
@@ -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},
+5 -4
View File
@@ -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);
}
}
}