Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flexible build directory naming & structure for enabling multiple build types #21

Closed
krishnakumarg1984 opened this issue Dec 7, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@krishnakumarg1984
Copy link

Currently, the build directory name needs to be hard coded in the configuration. It would be helpful to have a more flexible approach wherein a build_dir_prefix strings is provided to be user configurable. This will enable C++ developers to have access to multiple type of builds.

Examples:

  • build_dir_prefix: cmake_build_
    In the above example, the build directory will become cmake_build_Debug, cmake_build_Release, wherein the appropriate suffix is chosen by the build type

  • build_dir_prefix: build/
    In this above example with the trailing /, a classical nested hierarchical structure of various types of builds can be facilitated

build
├── Debug
├── MinRelease
├── Release
└── RelwithDebInfo

The above is a classical build tree for multiple type of builds, and is easily done through cmake invocations at the command-line, but this is not currently possible with this plugin.
The vimscript plugin, [cmake4vim](https://github.com/ilyachur/cmake4vim) already supports this, and I am using it now in my projects, but I'd like to move to this lua-based plugin, mainly for its integration with nvim-dap.

Of course, to prevent breaking changes to existing users' configurations, the build_dir_prefix behaviour should be activated only when cmake_build_directory is set explicitly to an empty string. Otherwise, we simply ignore the build_dir_prefix setting, and simply overwrite builds each time to the folder configured in cmake_build_directory (the current behaviour).

@krishnakumarg1984 krishnakumarg1984 added the enhancement New feature or request label Dec 7, 2022
@Civitasv Civitasv self-assigned this Dec 8, 2022
@Civitasv
Copy link
Owner

Civitasv commented Dec 8, 2022

Thanks for your suggestion. I will implement this option soon.

@Civitasv
Copy link
Owner

Civitasv commented Dec 10, 2022

Hi, please see commit f726e66. I've implemented this feature.

require("cmake-tools").setup({
...
  cmake_build_directory = "",
  cmake_build_directory_prefix = "build/",
...
})

@Civitasv Civitasv closed this as completed Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants