You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Make sure the build directory has the same name as value of *cppcm-build-dirname*. It is "build" by default. Make sure the build is located somewhere in the directory hierarchy from C++ file.
48
+
Quick start:
49
+
- The build directory should have the *same name as value of cppcm-build-dirname*. It is "build" by default. Make sure the build is located somewhere in the directory hierarchy from C++ file.
47
50
- Go to build directory to run cmake and make
48
51
- *Done!* Enjoy programming in Emacs as usual.
49
52
50
-
* Plugins (OPTIONAL)
51
-
Let's start by creating a "hello world" C++ project.
52
-
53
-
Execute below command in shell:
53
+
* Demo (OPTIONAL)
54
+
Let's start by creating a "hello world" C++ project:
The command line displayed in minibuffer is `make -C ~/your-projects-blah-blah/hello/build`
66
+
You can also `M-x cppcm-compile` to compile the current excutable only.
72
67
73
-
BTW, you can also `M-x cppcm-compile` to compile the current excutable only.
68
+
** gdb
69
+
Press hotkey `C-c C-g` (I suppose you've copied my setup).
74
70
75
-
You can see the actual command displayed in minibuffer is `make -C ~/your-project-blah-blah/hello/build/sub-project-dir-if-your-are-editing-its-cpp-file`
76
-
** Start gdb
77
-
Press hotkey `C-c C-g` (suppose you've copied my configuration from previous section).
71
+
gud-gdb starts and the binary "~/your-projects-blah-blah/hello/build/main" is loaded automatically.
78
72
79
-
You can see the gud-gdb starts and the executable "~/your-projects-blah-blah/hello/build/main" is loaded automatically.
Press the hotkey `C-x C-o` or `M-x ff-find-other-file`. The corresponding header is opened correctly.
89
-
90
-
This is the default feature of Emacs. What cpputils-cmake does is to set up the directories of those header files for you automatically so that the header files could be found by Emacs.
83
+
Press the hotkey `C-x C-o` or `M-x ff-find-other-file`. The corresponding header is opened.
91
84
92
-
* Advanced Tips
85
+
* FAQ
93
86
** Avoid scanning when opening system header files
94
87
cpputils-cmake scanning is light weight enough so below code is *optional*:
95
88
#+BEGIN_SRC elisp
@@ -101,7 +94,7 @@ cpputils-cmake scanning is light weight enough so below code is *optional*:
101
94
(cppcm-reload-all))
102
95
)))
103
96
#+END_SRC
104
-
** Get executable's full path of executable to build
97
+
** Get executable's full path
105
98
The command "cppcm-get-exe-path-current-buffer" will copy current executable into kill ring AND OS clipboard.
106
99
107
100
You need install `xsel` under Linux to support OS clipboard.
@@ -132,7 +125,7 @@ Please press "C-h v cppcm-compile-list" for other compile options.
132
125
** Make clean && make
133
126
"M-x cppcm-recompile"
134
127
135
-
** Manually specify the binary's path if you modify the default target output directory
128
+
** Customize target path
136
129
For example, if the CMakeLists.txt contains something like this:
The executable's name will be "hello-proj1-a1-a2".
187
180
181
+
** Stop creating Makefiles for flymake
182
+
Insert below code into ~/.emacs:
183
+
#+BEGIN_SRC elisp
184
+
(setq cppcm-write-flymake-makefile nil)
185
+
#+END_SRC
188
186
* Credits
189
187
- [[https://github.com/dojeda][David Ojeda (AKA dojeda)]] developed the algorithm to locate the top level project
190
188
- [[https://github.com/erreina][Ernesto Rodriguez Reina (AKA erreina)]] added the command "cppcm-recompile"
@@ -211,4 +209,4 @@ This program is free software; you can redistribute it and/or modify it under th
211
209
212
210
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
213
211
214
-
You should have received a copy of the GNU General Public License along with this program. If not, see [[http://www.gnu.org/licenses/]].
212
+
You should have received a copy of the GNU General Public License along with this program. If not, see [[http://www.gnu.org/licenses/]].
0 commit comments