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
vim-cmake is a Vim plugin to make working with CMake a little nicer.
4
6
5
-
I got tired of navitating to the build directory each time, and I also
6
-
disliked setting makeprg manually each time. This plugin does just that.
7
+
I got tired of navigating to the build directory each time, and I also
8
+
disliked setting makeprg manually each time. This plugin does just that.
7
9
8
10
## Usage
9
11
@@ -12,46 +14,69 @@ disliked setting makeprg manually each time. This plugin does just that.
12
14
*`:CMake` searches for the closest directory named build in an upwards search,
13
15
and whenever one is found, it runs the cmake command there, assuming the CMakeLists.txt
14
16
file is just one directory above. Any arguments given to :CMake will be directly passed
15
-
on to the cmake command. It also sets the working directory of the make command, so
17
+
on to the cmake command. It also sets the working directory of the make command, so
16
18
you can just use quickfix as with a normal Makefile project.
17
19
If you have the [AsyncRun plugin](https://github.com/skywind3000/asyncrun.vim)
18
20
installed, it will be used automatically and you will be able to check the
19
21
result of the cmake command in the quickfix as well.
20
22
21
23
*`:CMakeClean` deletes all files in the build directory. You can think of this as a CMake version of make clean.
22
24
25
+
*`:CMakeFindBuildDir` resets the build directory path set for the current buffer and then tries to find a new one. Useful if it previously found a wrong path to then reset it after a new build folder has been created for example.
26
+
23
27
### Variables
24
28
25
29
*`g:cmake_install_prefix` same as `-DCMAKE_INSTALL_PREFIX`
26
30
27
31
*`g:cmake_build_type` same as `-DCMAKE_BUILD_TYPE`
28
32
29
-
*`g:cmake_cxx_compiler` same as `-DCMAKE_CXX_COMPILER`. The build directory will be cleared the next time you run :CMake.
33
+
*`g:cmake_cxx_compiler` same as `-DCMAKE_CXX_COMPILER`. Changes will have no effect until you run:CMakeClean and then:CMake.
30
34
31
-
*`g:cmake_c_compiler` same as `-DCMAKE_C_COMPILER`. The build directory will be cleared the next time you run :CMake.
35
+
*`g:cmake_c_compiler` same as `-DCMAKE_C_COMPILER`. Changes will have no effect until you run:CMakeClean and then:CMake.
32
36
33
37
*`g:cmake_build_shared_libs` same as `-DBUILD_SHARED_LIBS`
34
38
39
+
*`g:cmake_project_generator` same as `-G`. Changes will have no effect until you run :CMakeClean and then :CMake.
40
+
41
+
*`g:cmake_export_compile_commands` same as `-DCMAKE_EXPORT_COMPILE_COMMANDS`.
42
+
43
+
*`g:cmake_ycm_symlinks` create symlinks to the generated compilation database for use with [YouCompleteMe](https://github.com/Valloric/YouCompleteMe/).
44
+
45
+
*`b:build_dir` is the path to the cmake build directory for the current buffer. This variable is set with the first :CMake or :CMakeFindBuildDir call. Once found, it will not be searched for again unless you call :CMakeFindBuildDir. If automatic finding is not sufficient you can set this variable manually to the build dir of your choice.
46
+
35
47
36
48
## Installation
37
49
38
-
If you don't have a preferred installation method, I recommend
39
-
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
40
-
then simply copy and paste:
50
+
51
+
### Vim-pathogen
52
+
53
+
With [pathogen.vim](https://github.com/tpope/vim-pathogen) simply copy and paste:
41
54
42
55
cd ~/.vim/bundle
43
56
git clone git://github.com/vhdirk/vim-cmake.git
44
57
45
58
Once help tags have been generated, you can view the manual with
46
59
`:help cmake`.
47
60
61
+
### Vundle
48
62
63
+
With [Vundle.vim](https://github.com/VundleVim/Vundle.vim) simply add this repository to your plugins list:
64
+
65
+
Plugin 'vhdirk/vim-cmake'
49
66
50
67
## Acknowledgements
51
68
52
69
* Thanks to [Tim Pope](http://tpo.pe/), his plugins are really awesome.
53
-
* Thanks to @SteveDeFacto for extending this with more fine grained control.
54
-
70
+
* Thanks to [Junegunn Choi](https://junegunn.kr/), for [vader.vim](https://github.com/junegunn/vader.vim), which is the testing framework used for this plugin.
71
+
* Also thanks to
72
+
*@SteveDeFacto for extending this with more fine grained control.
73
+
*@snikulov for enhancing makeprg.
74
+
*@dapicester for allowing specifying targets.
75
+
*@thomasgubler for the build dir option.
76
+
*@antmd for fixing a bug with handing of spaces in directory names.
77
+
*@jmirabel for fixing concatenation of cmake arguments.
78
+
*@T4ng10r for the project generator option.
79
+
*@Squareys for a small overhaul of the project, the initial test and travis setup.
0 commit comments