Skip to content

OpenCVConfig.cmake: issue with imported target configuration remapping #10105

@rokm

Description

@rokm

For development and debugging on linux, I tend to build OpenCV in RelWithDebInfo mode for use with my projects, which are also build in RelWithDebInfo mode.

Since commit 2d0611b, the above setup is broken; the projects that use OpenCV configure without errors, but the build fails with:

make[2]: *** No rule to make target 'opencv_core-NOTFOUND', needed by 'program-name'.  Stop

This is because RelWithDebInfo imported targets are now mapped to Release, which does not exist in this case (as OpenCV was also built in RelWithDebInfo mode).

The comment added to OpenCVConfig.cmake by 2d0611b states that "OpenCV supports Debug and Release only". This is not the always the case, as building OpenCV in RelWithDebInfo on linux results in build that generates OpenCVModules-relwithdebinfo.cmake.

Therefore, the remapping should be done only if the requested configuration does not actually exist, or it should be limited to platforms/toolchains where it is known that RelWithDebInfo and MinSizeRel are not supported (presumably Visual Studio?).

@bblanchon, as the author of the change, can you comment?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions