cdelledonne / vim-cmake Goto Github PK
View Code? Open in Web Editor NEWVim/Neovim plugin for working with CMake projects
License: MIT License
Vim/Neovim plugin for working with CMake projects
License: MIT License
Thank you very much for a such great plugin.
In order to use it personally I need some more project generation options:
let g:cmake_export_compile_commands = 1
let g:cmake_project_generator = 'ninja'
let g:cmake_cxx_compiler = 'path to executable'
let g:cmake_c_compiler = 'path to executable'
let g:cmake_toolchain_file = 'path to executable'
Or just an array of custom generation options:
let g:cmake_generate_options = []
I suppose they must be useful for another people.
Unable to set cmake_root_markers
to empty list via .vimrc
. If let g:cmake_root_markers = []
is executed after launching vim, then the correct value can be set.
.vimrc
or init.vim
file:let g:cmake_root_markers = []
let g:cmake_root_markers
in vim.['.git', '.svn']
instead of []
The output should be an empty list instead of the default list.
.vimrc
I am able to reproduce this issue with a minimal .vimrc
:help cmake
): 0.6.2For the time being, I have modified the values in the list here to an empty list and installed your awesome plugin using the modified code. This issue is probably due to config_vars
overriding the options set in the .vimrc
file, but I could be wrong.
On Windows, ConPTY seems to be hard-wrapping lines that are longer than the PTY's width (possibly related issues: microsoft/terminal#405, mintty/mintty#971). Generating a Quickfix list of errors relies on error messages to be output on a single line, which is not the case for hard-wrapped error messages.
The effect is that the Quickfix feature does not work reliably.
We could try to work around this problem as mentioned in the issues linked above, but we're not sure whether that's feasible at all and what the complexity/maintenance cost would be.
Run :CMakeBuild
in a project with errors in a narrow terminal in Neovim on Windows, and observe that when error messages span multiple lines in the Vim-CMake console, the Quickfix list is incorrect.
We would expect entire lines of output to be passed to the job's callback as single lines (e.g. ['This is a line of output', '']
), not as multiple lines (e.g. ['This is a line', ' of output', '']
).
:echo cmake#GetInfo().version
): 0.11.1cmake --version
): 3.22.2A clear and concise description of what the bug is.
After running :CMakeGenerate or :CMakeBuild, a blank terminal is generated but it was doing nothing. I have made sure that the command leads to cmake executable is correct. The terminal remains blank no matter how long I waited for it.
Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.
Successfully generate build files
.vimrc
A clear and concise description of what happens whe trying to reproduce the bug with a minimal .vimrc
. Ideally, a minimal .vimrc
only contains configuration for this plugin, and nothing else. If the minimal .vimrc
used is more complicated, please post the content here.
The only configuration of this plugin is Plug 'cdelledonne/vim-cmake'.
This problem occurs without all other plugins too.
If applicable, add screenshots to help explain your problem.
:help cmake
): 0.6.2Add any other context about the problem here.
Describe the solution you'd like
It would be awesome to have an option which closes the CMake window after a successful build. Just to avoid the two keystrokes for cq
.
Thanks for the great plugin π
I got a weird project root path output after I run CMakeGenerate:
the pwd is: /home/rave/tmp/test_project, but the project root path is pwd followed by a white space, which does not exist.
Steps to reproduce the behavior:
CMakeGenerate
cmake build success.
.vimrc
my vim-cmake config:
let g:cmake_link_compile_commands = 1
let g:cmake_build_dir_location = './build'
let g:cmake_build_options= ["-j8"]
let g:cmake_log_file="/tmp/vim-cmake.log"
see Bug description
section.
:help cmake
): 0.7.0[2022-03-23 21:22:53] [ INFO] Loading Vim-CMake
[2022-03-23 21:22:53] [ INFO] Commands defined
[2022-03-23 21:22:53] [ INFO] Mappings defined
[2022-03-23 21:22:53] [ INFO] Vim-CMake loaded
[2022-03-23 21:22:56] [ INFO] Project root: /home/raven/tmp/test_project
[2022-03-23 21:22:56] [ INFO] Current config: Debug (/home/raven/tmp/test_project/build/Debug)
[2022-03-23 21:22:56] [DEBUG] Invoked: statusline.SetBuildInfo(Debug)
[2022-03-23 21:22:56] [DEBUG] Build configs: []
[2022-03-23 21:22:56] [ INFO] Configuration options:
[2022-03-23 21:22:56] [ INFO] > g:cmake_build_dir_location: './build'
[2022-03-23 21:22:56] [ INFO] > g:cmake_build_options: ['-j8']
[2022-03-23 21:22:56] [ INFO] > g:cmake_command: 'cmake'
[2022-03-23 21:22:56] [ INFO] > g:cmake_console_echo_cmd: 1
[2022-03-23 21:22:56] [ INFO] > g:cmake_console_position: 'botright'
[2022-03-23 21:22:56] [ INFO] > g:cmake_console_size: 15
[2022-03-23 21:22:56] [ INFO] > g:cmake_default_config: 'Debug'
[2022-03-23 21:22:56] [ INFO] > g:cmake_generate_options: []
[2022-03-23 21:22:56] [ INFO] > g:cmake_jump: 0
[2022-03-23 21:22:56] [ INFO] > g:cmake_jump_on_completion: 0
[2022-03-23 21:22:56] [ INFO] > g:cmake_jump_on_error: 1
[2022-03-23 21:22:56] [ INFO] > g:cmake_link_compile_commands: 1
[2022-03-23 21:22:56] [ INFO] > g:cmake_log_file: '/tmp/vim-cmake.log'
[2022-03-23 21:22:56] [ INFO] > g:cmake_native_build_options: []
[2022-03-23 21:22:56] [ INFO] > g:cmake_root_markers: ['.git', '.svn']
[2022-03-23 21:22:56] [DEBUG] API invoked: cmake#Generate(0, [])
[2022-03-23 21:22:56] [DEBUG] Invoked: buildsys.Generate(0, '')
[2022-03-23 21:22:56] [DEBUG] Invoked: terminal.Run(['cmake', '-D CMAKE_BUILD_TYPE=Debug', '-D CMAKE_EXPORT_COMPILE_COMMANDS=ON', '-S .', '-B build/Debug'], 'generate', [function('<SNR>80_RefreshConfigs'), function('<SNR>80_RefreshTargets'), function('<SNR>80_LinkCompileCommands')], [function('<SNR>80_RefreshConfigs')], [], [])
[2022-03-23 21:22:56] [DEBUG] Invoked: terminal.Open(v:false)
[2022-03-23 21:22:56] [DEBUG] Created console window
[2022-03-23 21:22:57] [DEBUG] Invoked: statusline.SetCmdInfo(Generating buildsystem...)
[2022-03-23 21:22:57] [DEBUG] Invoked console exit callback
[2022-03-23 21:22:57] [DEBUG] Invoked: statusline.SetCmdInfo()
[2022-03-23 21:22:57] [DEBUG] Invoked: terminal.Focus()
[2022-03-23 21:22:57] [DEBUG] Callback invoked: <SNR>80_RefreshConfigs()
[2022-03-23 21:22:57] [DEBUG] Build configs: []
[2022-03-23 21:23:01] [ INFO] Loading Vim-CMake
[2022-03-23 21:23:01] [ INFO] Commands defined
[2022-03-23 21:23:01] [ INFO] Mappings defined
[2022-03-23 21:23:01] [ INFO] Vim-CMake loaded
After triggering :CMakeGenerate
first time in every session, all text in origin buffer become white and have no highlight.
(If I reopen the file in the same buffer or run syntax on
, do some editing and re-run :CMakeGenerate
, this does not happen)
After testing, this behavior is actually triggered by everytime :CMakeToggle
is triggered. It seems that on first :CMakeGenerate
or everytime :CMakeRun
is ran in text buffer :CMakeToggle
is called. (Sorry I didn't have the time to dig into the code to check if it is true)
Hightlight does not disappear from the first time.
.vimrc
Same behavior with a minimal .vimrc
as following:
set nocompatible
let &runtimepath = '~/.vim/bundle/vim-cmake,' . &runtimepath
filetype plugin indent on
syntax enable
:echo cmake#GetInfo().version
):0.14.0cmake --version
):3.27.7Vim-CMake uses the help
target to retrieve a list of available build targets. When running cmake --build <build_dir> --target help
, there are a few differences between the output for Makefile systems and that for Ninja systemsβe.g. the format is different, and Ninja systems also return a lot more entries.
To make the retrieval of build targets consistent and build tool-independent, we could use CMake's file api. From #57 (comment):
Fortunately CMake has a feature for this. It is called cmake-file-api(7) and is meant to be used by 'clients' to retrieve semantic information about the buildsystems CMake generates. So exactly what we want, especially with the Object Kind "codemodel".
Parsing JSON data should not be an issue, as both Vim and Neovim provide the function json_decode()
.
When generating a ninja based build system instead of a Makefile based one the display of ninjas output during build doesn't work as it should. There are two components to this issue:
Steps to reproduce the behavior:
I would expect ninjas output to be either shown as in a normal terminal or as when piped through a command like cat.
For reference run the following commands in the build folder:
ninja
ninja | cat
.vimrc
Same as above with empty vimrc/init.vim
Actual:
Expected normal:
Expected cat:
:help cmake
): 0.9.0 / d62f24dcmake --version
): 3.23.2Ninja outputs carriage returns instead of newlines to only have one line of output. Vim-CMake removes carriage returns and waits for the entire line before sending it to the console window. I could experimentally patch the first part by just disabling the relevant bit of code but don't know what that entails other than the intended (code is probably there for a reason), the second part takes some more knowledge of the code than I have to do right probably.
I'd like to be able to focus the cmake console window when running :CMakeOpen
.
The reason is that I want to toggle line numbers in that window when it has been newly opened.
Even if I set :let g:cmake_jump=1
, when calling :CMakeOpen
the window focus is not on the cmake console window.
Perhaps adding a :CMakeFocus
function could be a nice extension?
Or adding a conditional check on autoload/cmake/terminal.vim:370
like if g:cmake_jump==0 && ...
since jumping works for generate/build etc.
Describe the bug
Trying to run CMakeGenerate, but getting error: Undefined variable: s:cmake_version
cmake is installed, version 3.19.2
To Reproduce
Steps to reproduce the behavior:
Other info
:help cmake
): 0.4.0If I use commands:
:CMakeGenerate Debug
or :CMakeGenerate! Debug
It adds -DCMAKE_BUILD_TYPE=Debug
flag only if folder build/Debug doesn't exist.
If I run it the second time it doesn't add this flag
Steps to reproduce the behavior:
:CMakeGenerate! Debug
:CMakeGenerate! Debug
second timeExpected to always add -DCMAKE_BUILD_TYPE=Debug
or -DCMAKE_BUILD_TYPE=Release
flags
First time running :CMakeGenerate! Debug
:
Second time running :CMakeGenerate! Debug
:
:help cmake
): 0.6.1If CMakeRun is called, information of CMakeGenerate and CMakeBuild will never show up in the quickfix list
Steps to reproduce the behavior:
The quickfix list of CMakeBuild overwrite the one occupied by CMakeRun.
The cmake command string that generated when calling :CMakeGenerate
and :CMakeBuild
has too many backslash character on directory with space character.
$ pwd
/tmp/directory with space/project
:CMakeGenerate
outputRunning command: cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_EXPORT_COMPILE_COMMANDS=ON -S /tmp/directory\\\ with\\\ space/project -B /tmp/directory\\\\\\\\\\\\\\\ with\\\\\\\\\\\\\\\ space
/project/Debug
:CMakeBuild
outputRunning command: cmake --build /tmp/directory\\\\\\\\\\\\\\\ with\\\\\\\\\\\\\\\ space/project/Debug
Steps to reproduce the behavior:
:CMakeGenerate
and :CMakeBuild
.Exactly one backslash character per space character.
.vimrc
The same as above.
call plug#begin('~/.config/nvim/plugged')
Plug 'cdelledonne/vim-cmake'
call plug#end()
let g:cmake_link_compile_commands=1
nmap <leader>cg :CMakeGenerate<cr>
nmap <leader>cb :CMakeBuild<cr>
[2022-12-21 15:43:50] [ INFO] Configuration options:
[2022-12-21 15:43:50] [ INFO] > g:cmake_build_dir_location: '.'
[2022-12-21 15:43:50] [ INFO] > g:cmake_build_options: []
[2022-12-21 15:43:50] [ INFO] > g:cmake_command: 'cmake'
[2022-12-21 15:43:50] [ INFO] > g:cmake_console_echo_cmd: 1
[2022-12-21 15:43:50] [ INFO] > g:cmake_console_position: 'botright'
[2022-12-21 15:43:50] [ INFO] > g:cmake_console_size: 15
[2022-12-21 15:43:50] [ INFO] > g:cmake_default_config: 'Debug'
[2022-12-21 15:43:50] [ INFO] > g:cmake_generate_options: []
[2022-12-21 15:43:50] [ INFO] > g:cmake_jump: 0
[2022-12-21 15:43:50] [ INFO] > g:cmake_jump_on_completion: 0
[2022-12-21 15:43:50] [ INFO] > g:cmake_jump_on_error: 1
[2022-12-21 15:43:50] [ INFO] > g:cmake_link_compile_commands: 1
[2022-12-21 15:43:50] [ INFO] > g:cmake_log_file: 'VIM_CMAKE_LOG'
[2022-12-21 15:43:50] [ INFO] > g:cmake_log_level: 'INFO'
[2022-12-21 15:43:50] [ INFO] > g:cmake_native_build_options: []
[2022-12-21 15:43:50] [ INFO] > g:cmake_reinit_on_dir_changed: 1
[2022-12-21 15:43:50] [ INFO] > g:cmake_restore_state: 1
[2022-12-21 15:43:50] [ INFO] > g:cmake_root_markers: ['.git', '.svn']
[2022-12-21 15:43:50] [ INFO] > g:cmake_statusline: 0
[2022-12-21 15:43:50] [ INFO] > g:cmake_test_command: 'ctest'
[2022-12-21 15:43:50] [ INFO] > g:cmake_test_options: []
[2022-12-21 15:43:50] [ INFO] Project root: /tmp/directory\ with\ space/project
[2022-12-21 15:43:50] [ INFO] Current config: Debug (/tmp/directory\\\\\\\ with\\\\\\\ space/project/Debug)
I'm running neovim on Ubuntu 20.04 WSL and I'm having the following error when I run the :CMakeGenerate
command.
Error detected while processing function cmake#Generate[2]..293[20]..290[17]..287[19]..74_CreateConsoleBuffer[2]..74_TermSetup: line 4: E117: Unknown function: nvim_open_term E15: Invalid expression: nvim_open_term(bufnr(''), l:options)
Any idea what I can do?
Vim shows multiple errors when running any command from Vim-CMake. This does not happen in NeoVim.
The errors don't appear to break anything obvious based on some preliminary testing.
Steps to reproduce the behavior:
:CMakeOpen
As shell commands:
mv ~/.vim{,.bak_gh}; mv ~/.vimrc{,.bak_gh}
mkdir -p ~/.vim/pack/local/start/
git -C ~/.vim/pack/local/start clone https://github.com/cdelledonne/vim-cmake.git
git -C ~/.vim/pack/local/start/vim-cmake checkout fcd20af9758a38c98ece6660e5b2780eef93333e
vim +CMakeOpen
# to reset
rm -rf ~/.vim
mv ~/.vim{.bak_gh,}; mv ~/.vimrc{.bak_gh,}
The code in question should not produce any errors at this stage.
.vimrc
Works without any vimrc
$ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Oct 22 2022 19:58:44)
Included patches: 1-813
Compiled by Arch Linux
Huge version without GUI.
:echo cmake#GetInfo().version
): 0.11.1 (current master fcd20af)cmake --version
): 3.24.2
The error from the screenshot as text:
Error detected while processing /home/marwin/Workspace/vim/vim-cmake/autoload/cmake.vim[14]..function cmake#util#PrintNews[1]..<SNR>38_UpdateVersionNumber:
line 15:
E896: Argument of get() must be a List, Dictionary or Blob
Error detected while processing /home/marwin/Workspace/vim/vim-cmake/autoload/cmake.vim[24]..function 29[6]..18:
line 3:
E896: Argument of get() must be a List, Dictionary or Blob
Error detected while processing /home/marwin/Workspace/vim/vim-cmake/autoload/cmake.vim[24]..function 29:
line 6:
E896: Argument of get() must be a List, Dictionary or Blob
Error detected while processing /home/marwin/Workspace/vim/vim-cmake/autoload/cmake.vim[24]..function 29[6]..<SNR>30_SetCurrentConfig[11]..20[4]..18:
line 3:
E896: Argument of get() must be a List, Dictionary or Blob
Press ENTER or type command to continue
Originally reported by @marwing in #70 (comment)
By CMakeGenerate crash with error by function RefreshTests, but there is no test declarate in the project. It is just "Hello World"
Just run CMakeGenerate. Clear Debian 11 "bullseye"
#include <iostream>
using namespace std;
int main () {
cout << "Hello World!" << endl;
return 0;
}
cmake_minimum_required(VERSION 3.5)
project(foo LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
list(APPEND SOURCES main.cpp)
add_executable(foo ${SOURCES})
.vimrc
syntax on
set number
set scrolloff=3
set wrap
set showmatch
set autoread
set confirm
set noswapfile
set incsearch
set hlsearch
set ignorecase
set smartcase
filetype plugin on
" ##############################################################################
" Plug autoload
" ##############################################################################
" automatically downloads vim-plug to your machine if not found.
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Define plugins to install
call plug#begin('~/.vim/plugged')
Plug 'cdelledonne/vim-cmake'
call plug#end()
let g:cmake_link_compile_commands = 1
:help cmake
): 0.10.1cmake --version
): 3.18.4Run an executable file inside vim/nvim using CMakeRun.
After executing the CMakeBuild command, we will get a bunch of executable files. It would be very sweet if we could run those files inside vim/nvim, i.e. run :CMakeRun + exec file + args
in vim/nvim.
Run the file in a terminal window.
Is your feature request related to a problem? Please describe.
It would be cool to also be able to run ctest -v
in the current build directory
Describe the solution you'd like
A new command CTest
that runs ctest in the current build dir.
Your plugin its pretty well designed, I like the idea of using an unique window so I don't have to use the :colder command with ALE, also I can switch easily between buildings, but there is one problem, when an error occurs I cant jump to the line with that error.
I guess implementing this with the terminal window it would be like walking trough hell, so maybe it would be nice to have the option to decide if you want to use the terminal window or a quickfix, but I guess you will still have to write a lot of code to accomplish this.
Anyway I open the issue and maybe someone will come up with some idea.
Error when running :CMakeGenerate
Error detected while processing function cmake#Generate[2]..72[20]..69[17]..66[19]..<SNR>156_CreateConsoleBuffer[2]..<SNR>156_TermSetup:
E117: Unknown function: nvim_open_term
E15: Invalid expression: nvim_open_term(bufnr(''), l:options)
Steps to reproduce the behavior:
.vimrc
call plug#begin('~/.config/nvim/plugged')
Plug 'cdelledonne/vim-cmake'
call plug#end()
let g:cmake_link_compile_commands=1
nmap <leader>cg :CMakeGenerate<cr>
nmap <leader>cb :CMakeBuild<cr>
:help cmake
): 0.7.0Support for Neovim under Windows has been added in #40. However, the plugin does not work in Vim under Windows yet.
g:cmake_link_compile_commands option should imply -DCMAKE_EXPORT_COMPILE_COMMANDS=ON command line argument to cmake.
When I run CMakeBuild
and CMakeClose
and then try to write and quit all buffers using :wqa
, I get a "One job is still running"
The job should stop when CMakeBuild
ended or when CMakeClose
is called
.vimrc
Same behavior
:echo cmake#GetInfo().version
): 0.12.1cmake --version
): 3.26.1Reasoning
It is quite annoying to be forced to always jump to the top level directory, but we also dont want to mess up the build. For example, git submodules or external projects on wrong invocation of cmake may lead to this.
(the CMakeList.txt does not hint that the code is used as submodule)
Status Line
I It would be good to show the top-level directory in the statusline, but probably sufficient to show the top-level directory folder name in the status line. Adding instructions for doing this to the README would be great.
HOW
We can check git rev-parse --show-toplevel
and git rev-parse --show-superproject-working-tree
. Does cmake offer a similar solution? I did not find any yet.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when an invalid compile_commands.json link has been created
Describe the solution you'd like
A clear and concise description of what you want to happen.
create the link after successfully running cmake command
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Can we support CMake presets? I would like to see an option which shows the available presets and let's the user tab complete it. And possibly change state variables like g:cmake_build_dir_location
based on selected preset.
CMakePreset
command with the preferred preset, cmake --preset
should be called.g:cmake_build_dir_location
, g:cmake_default_config
et al. should be updated to match selected preset from CMakePresets.json
file.g:cmake_show_preset_in_status_line
maybe?g:cmake_preset
and do steps 1-3I am able to do this via terminal. This is my flow
# list the presets, maybe this can be used for autocomplete?
cmake --list-presets
# generate cmake files based on the preset
cmake --preset x86_64-unknown-linux-gnu
# configure local .vimrc manually
# for pointing vim-cmake to the generated files
I would like to use this plugin for a simple Qt project:
cmake_minimum_required(VERSION 3.14)
project(myproject LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
add_executable(myproject
main.cpp
)
target_link_libraries(myproject Qt${QT_VERSION_MAJOR}::Core)
install(TARGETS myproject
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
Unfortunately, when I try to run :CMakeGenerate
, I have the following issue:
Running command: cmake -D CMAKE_BUILD_TYPE=Debug -S . -B Debug
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:12 (find_package):
Could not find a package configuration file provided by "QT" with any of
the following names:
Qt6Config.cmake
qt6-config.cmake
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "QT" to CMAKE_PREFIX_PATH or set "QT_DIR" to
a directory containing one of the above files. If "QT" provides a separate
development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
See also "/Users/martindelille/dev/tests/undo-test2/Debug/CMakeFiles/CMakeOutput.log".
See also "/Users/martindelille/dev/tests/undo-test2/Debug/CMakeFiles/CMakeError.log".
Running command: cmake -S . -B Debug
CMake Error at CMakeLists.txt:12 (find_package):
Could not find a package configuration file provided by "QT" with any of
the following names:
Qt6Config.cmake
qt6-config.cmake
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "QT" to CMAKE_PREFIX_PATH or set "QT_DIR" to
a directory containing one of the above files. If "QT" provides a separate
development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
See also "/Users/martindelille/dev/tests/myproject/Debug/CMakeFiles/CMakeOutput.log".
See also "/Users/martindelille/dev/tests/myproject/Debug/CMakeFiles/CMakeError.log".
Running command: cmake -S . -B Debug
CMake Error at CMakeLists.txt:12 (find_package):
Could not find a package configuration file provided by "QT" with any of
the following names:
Qt6Config.cmake
qt6-config.cmake
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "QT" to CMAKE_PREFIX_PATH or set "QT_DIR" to
a directory containing one of the above files. If "QT" provides a separate
development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
See also "/Users/martindelille/dev/tests/myproject/Debug/CMakeFiles/CMakeOutput.log".
See also "/Users/martindelille/dev/tests/myproject/Debug/CMakeFiles/CMakeError.log".
How can I specify the CMAKE_PREFIX_PATH ?
Currently, I can switch CMake build type by setting g:cmake_default_config='Debug'/'Release'. Is there any better way to do this?
another question is how to use :CMakeSwitch <config>
, I don't understand what does <config>
mean.
Thanks!
Can someone tell me how to do it?
Describe the bug
vim-cmake does generate the Makefile and cmake objects in folder Debug, but it does not generate a compile_commands.json necessary for clangd or any other c++ language server.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The compile_commands.json should be created. However it is not, which makes clangd unusable.
Screenshots
(would show that clangd does not find files)
Other info
:help cmake
): 0.5.0Additional context
Here is a hint that the compile_commands.json needs a second invocation of cmake. Did you skip this at some point? Otherwise I would suggest creating another command to generate the compile_commands.json.
Probably they changed the behavior such that cmake does not invoke itself a second time?!
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
works as expected, so maybe the cmake CLI interface got changed?!
suppose the project's file hierarchy as below:
project_root
CMakeLists.txt
.marker(such .git)
src
main.cpp
include
hello.hpp
I can only use cmakegenerate in project_root to locate .marker correctly
if I try it in src or include , it will try to locate .marker from $HOME
I found FindProjectRoot() in autoload
if I change the following line:
let l:root = fnamemodify(l:marker_path, printf(
\ ':.:s?%s??:h', l:marker_path))
to:
let l:root = fnamemodify(l:marker_path,":h")
things will work fine
I think nvim change it's findfile() return value to full path, to strip the .marker, we only need to use ':h' in fnamemodify()
It should be configurable to set path for build folder. For example '..' (parent directory of the project root)
/Users/user/project/
βββ Debug
βββ compile_commands.json
βββ project
βββ .git
βββ CMakeLists.txt
βββ compile_commands.json -> ../Debug/compile_commands.json
βββ src
βββ main.cpp
Describe the bug
CMakeGenerate ignores root folder found by g:cmake_root_markers
To Reproduce
Steps to reproduce the behavior:
/Users/user/project/
βββ .git
βββ CMakeLists.txt
βββ src
βββ main.cpp
let g:cmake_generate_options = ['-GNinja', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON']
let g:cmake_root_markers = ['.git']
let g:cmake_link_compile_commands = 1
/Users/user/project/
βββ .git
βββ CMakeLists.txt
βββ compile_commands.json -> Debug/compile_commands.json
βββ src
βββ Debug
βββ main.cpp
Expected behavior
Directory Debug must be created at the project root.
We also have a broken link here. compile_commands.json points to a not existing directory.
It also must be configurable to set path for the Debug folder. For example '..' (parent directory of the project root)
Also g:cmake_link_compile_commands option should imply -DCMAKE_EXPORT_COMPILE_COMMANDS=ON command line argument to cmake.
Since we already have :CMakeOpen
and :CMakeClose
it feels like it would be appropriate with a :CMakeToggle
command that toggles the cmake window.
This could be manually scripted in users' init script file(s), but it would be much cleaner and easier to keybind if it was a built-in feature of the plugin.
Describe the bug
CMakeClose fail to close the console window
To Reproduce
Steps to reproduce the behavior:
CMakeBuild
or CMakeGenerate
, which write some chars into the console window buffer. Or just call CMakeOpen
and input some random chars.CMakeClose
. Error37: No write since last change (add ! to override)Expected behavior
CMakeClose
should close the window even if there is change in the buffer.CMakeClose!
, which has the similar behaviour like :q!
and keep the current CMakeClose
for those who want to save the CMake log from the console window.Screenshots
If applicable, add screenshots to help explain your problem.
Other info
:help cmake
): 0.4.0Additional context
Add any other context about the problem here.
Add an option to save (and restore) project context, mostly buildsys.current_config
.
Context should be saved such that when exiting and starting Vim/Neovim again it can be restored. The buildsys.current_config
variable is the most important one, as it points to the current build configuration. There should also be an option to control whether or not context should be saved/restored.
.data
file at the root of the repository.Describe the bug
The plugin is not working on CentOS7 / neovim v0.3.0 / cmake v3.17.2
Error:
Error detected while processing function cmake#Generate[16]..cmake#generate#Run:
line 8:
E121: Undefined variable: s:cmake_version
E15: Invalid expression: s:cmake_version < 313
To Reproduce
Steps to reproduce the behavior:
Plug 'cdelledonne/vim-cmake'
Expected behavior
No errors - folder build
created, generated files appear in it.
Other info
cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)
nvim --version
NVIM v0.3.0
Build type: RelWithDebInfo
Lua 5.1
Compilation: /usr/bin/cc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wconversion -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/builddir/build/BUILD/neovim-0.3.0/build/config -I/builddir/build/BUILD/neovim-0.3.0/src -I/usr/include -I/builddir/build/BUILD/neovim-0.3.0/build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.3.0/build/include
Compiled by mockbuild
Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
:help cmake
):Additional context
Add any other context about the problem here.
It would be nice to run a command BEFORE any cmake command. E.g. execute a bash script before the cmake configure/build run.
Specified command will run before any cmake command.
I have the need to create junctions on windows before building. Currently I'm doing it within QT Creator where I can define build steps. Would be nice to have the same functionallity within this plugin.
Adding autocmd in the beginning of the Generate and Build functions. This way I could hook into them and call my scripts
After installing the plugin through Vundle, I tried to run :CmakeGenerate and I get the following error:
Expect to get the initial cmake files
.vimrc
:help cmake
): 0.11.0cmake --version
): 3.22.1Add any other context about the problem here.
I reproduced this in latest version.
Originally posted by @jowu598 in #11 (comment)
In Vim, we can't seem to be able to set the PTY's width (as we reported upstream: vim/vim#11476). Some commands (i.e. Ninja, as far as we know) rely on the PTY's width to output properly formatted lines, and even use ANSI sequences to manipulate/clear lines, which gets messed up when the width perceived by the command does not correspond to what we try to set for the PTY.
The effect is a messed-up output in the Vim-CMake console. However, all other functionalities, including Quickfix, work as expected.
Run :CMakeBuild
for a Ninja-based build system in a narrow terminal in Vim.
We would expect the PTY to have the width we specify when we call s:system.JobRun()
. The environment variable COLUMNS
seems to be set correctly, but the actual width of the PTY is wrong (see vim/vim#11476).
:echo cmake#GetInfo().version
): 0.11.1Describe the bug
Quickfix doesn't populate all the errors
To Reproduce
:CMakeBuild
[Open quickfix]
Expected behavior
All the errors and warnings must be present in the quickfix.
Screenshots
If I fix the second bug...
Other info
:help cmake
): 0.3.0Additional context
:chistory tell me I am in a CMakeBuild quickfix.
The errors are detected by other plugins.
I will update the issue if I figure out anything else.
Describe the bug To Reproduce
Using commands like :CMakeCenerate or :CMakeCuild let the procces running in the background so when I try to exist vim an E947 doesn't let me leave.
Expected behavior
The script should finish or kill the process when I leave vim
Other info
:help cmake
): 0.2.2Edit: Its enough to open the window (:CMakeOpen)
I need to add -DCMAKE_TOOLCHAIN_FIL=/path/to/toolchain/ E to command but I couldn't add. Can someone help.
Describe the bug
A clear and concise description of what the bug is.
The plugin refuses to generate because my home path contains a space
To Reproduce
Steps to reproduce the behavior:
:CMakeGenerate
Expected behavior
The project should successfully configure
Other info
:help cmake
): 0.3.0Additional context
At the moment, only vim-airline is supported. Add support for additional statusline plugins, possibly also those written in Lua for Neovim.
Describe the bug
Error detected while processing function 181_NeovimStdoutCallback[3]..185_CMakeConsoleCb:
line 13:
E492: Not an editor command: AirlineRefresh
To Reproduce
No special steps it, is hit by default.
Expected behavior
AirlineRefresh needs to be called only if it exist:
if exists(":AirlineRefresh")
execute "AirlineRefresh"
endif
Screenshots
If applicable, add screenshots to help explain your problem.
Other info
:help cmake
):Additional context
Add any other context about the problem here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.