Disallow IMPORTED_LOCATION_<CONFIG> without IMPORTED_CONFIGURATIONS
Consider an imported target:
add_library(foo STATIC IMPORTED)
set_target_properties(foo PROPERTIES
IMPORTED_LOCATION_DEBUG "/path/to/libfoo_d.a"
IMPORTED_LOCATION_RELEASE "/path/to/libfoo.a"
IMPORTED_LOCATION_MINSIZEREL "/path/to/libfoo.a"
IMPORTED_LOCATION_RELWITHDEBINFO "/path/to/libfoo.a"
)
Currently this works by accident in many (but probably not all) cases if the project consuming this imported target does not have any configurations not exactly provided by the set of IMPORTED_LOCATION_<CONFIG>
properties. However, the set of cases in which this works can vary subtly as CMake's implementation changes. Projects can always be fixed by:
+ IMPORTED_CONFIGURATIONS "Release;Debug"
IMPORTED_LOCATION_DEBUG "/path/to/libfoo_d.a"
IMPORTED_LOCATION_RELEASE "/path/to/libfoo.a"
- IMPORTED_LOCATION_MINSIZEREL "/path/to/libfoo.a"
- IMPORTED_LOCATION_RELWITHDEBINFO "/path/to/libfoo.a"
but it would be better to warn on this case up front so that projects do not make the mistake in the first place.