Created
March 27, 2019 13:30
-
-
Save scotchi/4fb23f059b4bc6aca53f959786454707 to your computer and use it in GitHub Desktop.
Sets the build directory for CMake projects to be the "build" directory below where CMakeLists.txt is
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-hook 'c++-mode-hook | |
(lambda () | |
(if (not (boundp 'cmake-ide-build-dir)) | |
(let* ((cmake-lists (locate-dominating-file default-directory "CMakeLists.txt")) | |
(cmake-build (concat cmake-lists "build"))) | |
(if (and cmake-lists (file-exists-p cmake-build)) | |
(progn | |
(setq cmake-ide-build-dir cmake-build) | |
(global-set-key (kbd "s-.") 'cmake-ide-compile))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment