core icon indicating copy to clipboard operation
core copied to clipboard

Incompatible CLI options for VS 2019 Debug build

Open burnerlee opened this issue 3 years ago • 3 comments

🐛 Bug Report

When building in Visual Studio 2019 in Debug mode I get this error: image Only happens in Debug build; Release, MinSizeRel, RelWithDebInfo build fine

Expected Behavior

The project should build fine

Current Behavior

The project did not build :(

Possible Solution

There's this: https://stackoverflow.com/a/44416270 But having /O2 for a debug build seems incorrect. Also had an issue with CLion+Linux where Debug build skipped breakpoints, which can be proof of incorrect configuration.

Steps to Reproduce

  1. git clone https://github.com/metacall/core.git
  2. install VS 2019
  3. mkdir build
  4. cd build
  5. cmake ..
  6. Hit Local Windows Debugger here image

Context (Environment)

I was trying to build the project

burnerlee avatar Jan 24 '22 01:01 burnerlee

This needs to be documented. Basically.. MetaCall build system depends on this flag:

cmake -DCMAKE_BUILD_TYPE=Debug ..

The default option is Release. MSVC allows you to change after generation time the build type but metacall depends on the cmake option.. so each time you want to change the build type you need to set it up and re-generate the msvc files.

Has this solved your problem? Can we close the issue?

viferga avatar Jan 24 '22 11:01 viferga

@viferga it makes sense. But this solution seems incorrect as an IDE user would expect the configurations to work fine out of the box. Apart from Visual Studio, I had an issue in Clion where breakpoints were skipped. Now that I added the flag you mentioned, it works fine for me. So if this hack is intended, we can close this issue and I can add this to the documnentation

burnerlee avatar Jan 25 '22 19:01 burnerlee

I just discovered that since CMake 3.11, you can set up per configuration the options! We should either check if this works: https://stackoverflow.com/a/32956785 Or this: https://stackoverflow.com/a/33831145

I think the second version may not work because generator expressions are handled at cmake generation time.

I'm leaving the issue open until it is solved.

viferga avatar Jan 26 '22 10:01 viferga