CMake RelWithDebInfo links to Debug libs

前端 未结 3 1077
旧巷少年郎
旧巷少年郎 2021-02-04 10:04

I have a project which links to half a dozen libraries, among them OpenCV.
Since Release variant is crashing, while Debug is working fine (just a lot slower), I wanted to co

3条回答
  •  太阳男子
    2021-02-04 10:50

    I've used the above answer by Dženan but found that some opencv libraries ignore this and still link debug! This results in an msvc project that links mixed release and debug libraries for opencv. My solution was to create a new OpenCVModules-relwithdebinfo.cmake in your the opencv installation's lib dir, which is a copy of the OpenCVModules-release.cmake file. Then replacing all references to RELEASE with RELWITHDEBINFO. This produces a msvc project linking entirely to opencv release libs. The added benefit is that you don't need to change your project's CMake files to account for this.

提交回复
热议问题