From 3cfa724c8cda32c801f79eeb0ac98c835809ccc8 Mon Sep 17 00:00:00 2001 From: Maximilian Kueffner Date: Tue, 19 Aug 2025 00:27:41 +0200 Subject: [PATCH] remove dir locals, use presets instead `projectile-configure-project' in conjunction with CMakePresets.json will allow to configure the project. `projectile-compile-project' does sth similar for the compile command. This is equivalent to something like ~cmake --preset clang-debug && cmake --build build --preset clang-debug~ --- .dir-locals.el | 8 ---- CMakePresets.json | 118 ++++++++++++++++++++++++++-------------------- 2 files changed, 67 insertions(+), 59 deletions(-) delete mode 100644 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el deleted file mode 100644 index a75c213..0000000 --- a/.dir-locals.el +++ /dev/null @@ -1,8 +0,0 @@ -;;; Directory Local Variables -*- no-byte-compile: t -*- -;;; For more information see (info "(emacs) Directory Variables") - -((nil . ((compile-command . - (eval - (format "cmake -B build -S . -DCMAKE_C_COMIPLER=%S -DCMAKE_CXX_COMIPLER=%S -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFETCHCONTENT_FULLY_DISCONNECTED=OFF -G Ninja && cmake --build build" - (executable-find "clang") - (executable-find "clang++"))))))) diff --git a/CMakePresets.json b/CMakePresets.json index dbd3cf5..6fc526f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,54 +1,70 @@ { - "version": 3, - "cmakeMinimumRequired": { - "major": 3, - "minor": 21, - "patch": 0 + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default", + "generator": "Ninja", + "binaryDir": "build", + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "FETCHCONTENT_FULLY_DISCONNECTED": "OFF" + } }, - "configurePresets": [ - { - "name": "default", - "generator": "Ninja", - "binaryDir": "build", - "cacheVariables": { - "CMAKE_C_COMPILER": "clang", - "CMAKE_CXX_COMPILER": "clang++", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "FETCHCONTENT_FULLY_DISCONNECTED": "OFF" - } - }, - { - "name": "clang-release", - "inherits": "default", - "generator": "Ninja", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } - }, - { - "name": "clang-debug", - "inherits": "default", - "generator": "Ninja", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - } - ], - "buildPresets": [ - { - "name": "default", - "configurePreset": "default", - "jobs": 10 - }, - { - "name": "clang-release", - "inherits": "default", - "configuration": "Release" - }, - { - "name": "clang-debug", - "inherits": "default", - "configuration": "Debug" - } - ] + { + "name": "clang-release", + "inherits": "default", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "clang-debug", + "inherits": "default", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "gcc-release", + "inherits": "default", + "cacheVariables": { + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "gcc-debug", + "inherits": "default", + "cacheVariables": { + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_BUILD_TYPE": "Debug" + } + } + ], + "buildPresets": [ + { + "name": "default", + "configurePreset": "default", + "jobs": 10 + }, + { + "name": "release", + "inherits": "default", + "configuration": "Release" + }, + { + "name": "debug", + "inherits": "default", + "configuration": "Debug" + } + ] }