OpenCV only defines two configurations, Debug and Release. Trying to build a dependent project in RelWithDebInfo causes a link error on MSVC. A solution to that is to set MAP_IMPORTED_CONFIG_RELWITHDEBINFO to RELEASE.
However, when building it via ExternalProject_Add I don’t know how to do an equivalent thing. Can it be done, and how?