include_external_msproject does not respect CMAKE_MAP_IMPORTED_CONFIG_XXX
While using set_property(TARGET ... PROPERTY MAP_IMPORTED_CONFIG_<CONFIG> "OtherConfig")
works correctly, those properties are not populated correctly based on the CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>
.
Example:
set(CMAKE_MAP_IMPORTED_CONFIG_PROFILE Release)
include(CMakePrintHelpers)
include_external_msproject(SomeProject "SomeProject.vcxproj")
cmake_print_variables(CMAKE_MAP_IMPORTED_CONFIG_PROFILE)
cmake_print_properties(TARGETS SomeProject PROPERTIES MAP_IMPORTED_CONFIG_PROFILE)
set_target_properties(SomeProject PROPERTIES MAP_IMPORTED_CONFIG_PROFILE Release)
cmake_print_properties(TARGETS SomeProject PROPERTIES MAP_IMPORTED_CONFIG_PROFILE)
Gives the following output.
-- CMAKE_MAP_IMPORTED_CONFIG_PROFILE="Release"
--
Properties for TARGET SomeProject :
SomeProject .MAP_IMPORTED_CONFIG_PROFILE = <NOTFOUND>
--
Properties for TARGET SomeProject :
SomeProject.MAP_IMPORTED_CONFIG_PROFILE = "Release"
As you can see, the property is only set after the call to set_target_properties
which is not very practical when you have multiple targets using include_external_msproject
.
Note this is different from #20823 (closed) and was implemented by !669 (merged)