Issues with library selection when using ninja multiconfig generator (Linux/Windows) #19327
Replies: 4 comments
-
Upon further analysis I think this may be the source of the problem, in my CMakeCache.txt file this is set:
|
Beta Was this translation helpful? Give feedback.
-
Well after some digging I found a workaround:
Seems to guide the library discovery properly for the Windows case with DebugCoverage anyhow (updated the example project). Note linux is still incorrectly linking to the debug boost_random instead of release:
Note I cannot leave that setting on globally, lotta errors with targets missing IMPORTED_LOCATION property or what not. |
Beta Was this translation helpful? Give feedback.
-
More reading, and this can now be set globally in the preset file:
However, although everything now builds, cmake still things my target that I just build should reside in Debug, but it resides in DebugCoverage... But that's certainly better than it not compiling. |
Beta Was this translation helpful? Give feedback.
-
For configuration types, we currently only support Debug, Release and RelWithDbg three modes in cmake. In msbuild, we can specify the corresponding configuration type. cc @vicroms |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
MultiConfig generators with custom configurations do not honor what the documentation states.
In my scenario I have configured 3 configure types, Release, Debug, and DebugCoverage.
According to the docs this is supported:
https://vcpkg.readthedocs.io/en/latest/about/faq/
I've created a small sample project demonstrating the problem:
https://github.com/JasonDictos/ninja-multiconfig-vcpkg
When I try to build with my configuration type DebugCoverage, it links to the release libs and not the debug ones. On windows this causes the classic _ITERATOR_DEBUG_LEVEL mismatch error (in addition to the MTd/MT divergence).
On linux this mostly isn't a problem as if you link to a release library it will still link as linux does not have different runtimes or compilation flags like windows does.
Environment
To Reproduce
Linux:
Working example #1:
Note it is linking to the debug library build of libbost_random.a
Problem #1:
Note it is linking to the debug library build of libbost_random.a shouldn't it be linking to the release version??
Windows:
Working example #1
We can see here it is linking to the release library of libboost_random-vc140-mt.lib
(unlike linux which incorrectly linked to the debug version of the same library above).
Working example #2
Here we can see it is properly linking to the debug library of libboost_random-vc140-mt-gd.lib
(Note Linux did not do this, it incorrectly linked to the debug version of the boost dependency)
Problem #1
And here is my main problem, although my configuration is called DebugCoverage, the find_package hooks built into the vcpkg cmake tooling select the release version of the boost dependency.
DebugCoverage is a build preset which selects the DebugCoverage configuration type here in the presets file:
Configuration types are defined in the root buildConfig
Expected behavior
I expected Debug/Release to select the appropriate libraries
Beta Was this translation helpful? Give feedback.
All reactions