I have 2 .props files, one is for Debug, and the other one is for Release. I’ve tried 2 ways below using generator expressions, but none of them works, no file is added/shown in the Property Manager window in Visual Studio:
set_property(TARGET MyTarget PROPERTY VS_USER_PROPS
$<$<CONFIG:Debug>:${PROJECT_SOURCE_DIR}/../Include/prop_sheet_Debug.props>
$<$<CONFIG:Release>:${PROJECT_SOURCE_DIR}/../Include/prop_sheet_Release.props>
)
set_property(TARGET MyTarget PROPERTY VS_USER_PROPS "${PROJECT_SOURCE_DIR}/../Include/prop_sheet_$<CONFIG>.props")
This works, but it’ll add the prop_sheet_Debug.props
file to both Debug and Release configurations of the target (shown in the Property Manager window), which is undesirable:
set_property(TARGET MyTarget PROPERTY VS_USER_PROPS "${PROJECT_SOURCE_DIR}/../Include/prop_sheet_Debug.props")
I guess one workaround is to pass in a value for CMAKE_BUILD_TYPE and check its value in the CMakeLists.txt file, although it’ll probably still add the same .props file to both Debug and Release. I’d greatly appreciate if anyone could give me a better way to achieve it!