cpp-best-practices / cmake_template

CMake for C++ Best Practices
The Unlicense
1.07k stars 116 forks source link

Verify VSCode Experience (Windows) #22

Open lefticus opened 1 year ago

lefticus commented 1 year ago

This is the "out of the box" experience.

When you open this project in Clion (Windows) does it Just Work?

related #17

St0wy commented 1 year ago

I just tried it on my machine with the latest VSCode and the C/C++ and CMake extensions.

When building with MSVC Debug, I got that error :

error: invalid argument '-MDd' not allowed with '-fsanitize=address' [clang-diagnostic-error]

But it worked with Clang Debug and MSVC Release.

It still had some warnings :

[cmake] CMake Warning:
[cmake]   Manually-specified variables were not used by the project:
[cmake] 
[cmake]     ENABLE_CLANG_TIDY_DEFAULT
[cmake]     ENABLE_CPPCHECK_DEFAULT
[cmake]     ENABLE_DEVELOPER_MODE

and this one, which showed in the problems tab, but maybe it's just my ccache setup that is wrong ?

CMake Warning at cmake/Cache.cmake:31 (message):ccache is enabled but was not found.  Not using it

I also got this CMake warning :

CMake Warning at cmake/VCEnvironment.cmake:65 (message):Could not find `vcvarsall.bat` for automatic MSVC environment preparation.
Please manually open the MSVC command prompt and rebuild the project.

Should VSCode be setup to use the Visual Studio developper terminal by default ?

I also tried compiling with Clang Release the intro target. I enabled thread sanitzing just to see if it would break things by changing this line option(myproject_ENABLE_SANITIZER_THREAD "Enable thread sanitizer" ON) I got these errors :

[build] D:\dev\cpp\cmake_template\out\build\windows-clang-release\_deps\ftxui-src\src\ftxui\component\screen_interactive.cpp(73,15): error: unused variable 'timeout_microseconds' [-Werror,-Wunused-const-variable]
[build] constexpr int timeout_microseconds = timeout_milliseconds * 1000;
[build] error: no such file or directory: '/fsanitize=thread'; did you mean '-fsanitize=thread'? [clang-diagnostic-error]

For the rest, it pretty much worked but selecting the target was really annoying because all of ftxui examples show up, it would be nice if there was a way for them to be hidden.

PS : I think you forgot to change CLion to VSCode in the first comment.