Obey CMAKE_BUILD_TYPE set in CMakeLists.txt for build folder name creation
krishnakumarg1984 opened this issue · 4 comments
In CMakeLists.txt
, it is possible to set a default build type if not explicitly set on the command line invocation like so:
# we default to RelWithDebInfo build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()
However, from within vim, when invoking :CMake
provided by cmake4vim, the build folder simply reverts to cmake-build-release
(which I can see from your docs is the default, unless overridden by the relevant vim config variable, or the build type explicitly selected with :CMakeSelectBuildType
).
Now, this is problematic if the build type does not match with the folder name, especially when building in a shared network folder (especially when some colleagues do not use cmake4vim or even vim itself).
Is problematic even for a single user if the build type does not quite match the folder name. Can you please check if this variable is set, either in the command line or in the CMakeLists.txt, and create a suitably named folder for the build?
Could you clarify would it be a problem if you just put let g:cmake_build_type = 'Debug'
in your vimrc
?
When do you want to build the default type without knowing which one it is? You could also have project local vimrc
with the aforementioned line.
Besides, calling :CMake
without setting the build type defaults to Release
, as you said, and the folder name reflects that.
I'm not quite sure what's the issue.
@krishnakumarg1984 Thank you for the issue.
As @mark2185 said, you can try to set default value of g:cmake_build_type
variable in your vimrc
or local_vimrc
I think it should help.
Moreover if you have another rules to configure cmake build folder name, you can use variables from the Readme Build path section. These variables should allow to configure rules for name configuration of build folder.
@krishnakumarg1984 Did you try ours advices?
Does the issue solved?
I didn't get any response. Looks like the original issue can be solved by local vimrc config.
@krishnakumarg1984 Feel free to reopen the ticket if issue is still relevant.