cmake-tools.nvim icon indicating copy to clipboard operation
cmake-tools.nvim copied to clipboard

Symlink compile_commands.json doesn't appear to work on windows

Open natecheadle opened this issue 1 year ago • 0 comments

Bug description compile_commands.json is not being symlinked to the root directory of the source folder on windows.

Running the same command that is being passed to vim.cmd works properly from the same CLI environment. cmake -E create_symlink {source} {destination}

This works fine on OSX.

(I did not test my project on Linux)

Steps to reproduce clone https://github.com/natecheadle/CppTemplate mkdir out/Debug nvim . :CMakeGenerate

Expected behavior expected compile_commands.json to be symlinked in the root source directory

Environment

  • OS: Windows
  • Plugins commit hash: a4cd0b3a2c8a166a54b36bc00579954426748959
  • CLI: Launched from Powershell

Work Around I was able to work around this issue by adding the following to my main CMakeLists.txt and disabling the symlink feature in this plugin. (This does exactly what this plugin is trying to do as far as I can tell)

execute_process(
    COMMAND ${CMAKE_COMMAND} -E create_symlink  
    ${CMAKE_BINARY_DIR}/compile_commands.json  
    ${CMAKE_SOURCE_DIR}/compile_commands.json  
)

natecheadle avatar Apr 23 '24 20:04 natecheadle