Fix C++ examples not launching out of the box on Windows when using multi-config generator

We copy the sixtyfps_cpp.dll into the bin directory where the examples
are, but that needs to be a Debug/ or Release/ sub-directory in case of
a multi-config generator.
This commit is contained in:
Simon Hausmann 2021-11-18 11:39:54 +01:00
parent 6bf224c9de
commit 7f61d99734

View file

@ -168,10 +168,14 @@ if(WIN32)
install(FILES $<TARGET_LINKER_FILE:sixtyfps-cpp-shared> TYPE LIB) install(FILES $<TARGET_LINKER_FILE:sixtyfps-cpp-shared> TYPE LIB)
# Copy the dll to the top-level bin directory, where the examples will # Copy the dll to the top-level bin directory, where the examples will
# will also be located, so that they can find the dll. # will also be located, so that they can find the dll.
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)
set(config_subdir_genex "$<CONFIG>/")
endif()
add_custom_target(SixtyFPS_dll_convenience ALL DEPENDS sixtyfps-cpp-shared add_custom_target(SixtyFPS_dll_convenience ALL DEPENDS sixtyfps-cpp-shared
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:sixtyfps-cpp-shared> $<TARGET_FILE:sixtyfps-cpp-shared>
${CMAKE_BINARY_DIR}/bin/$<TARGET_FILE_NAME:sixtyfps-cpp-shared>) ${CMAKE_BINARY_DIR}/bin/${config_subdir_genex}$<TARGET_FILE_NAME:sixtyfps-cpp-shared>)
endif() endif()
install(PROGRAMS $<TARGET_FILE:sixtyfps-compiler> TYPE BIN) install(PROGRAMS $<TARGET_FILE:sixtyfps-compiler> TYPE BIN)