From 1c4510cfc4c020d54e3c1c52e187b31b67e3a5fb Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 20 Jun 2019 10:56:19 +0200 Subject: Fix build with multi-config VS code generator We want our libraries to end up in the same bin directory, not inside the Debug\ or Release\ sub-directories. Their distinct names avoid a clash. For our tools such as moc, uic, etc. we need to place the release build into the bin directory explicitly, as by default multi-config generators place binaries into the Debug\ or Release\ sub-directory. This is also needed as cmake's automoc itself expects moc to be in the bin directory. One effect of this is that with a multi-config build, it is always necessary to perform a release build first, otherwise the debug build won't find moc/uic. Change-Id: I1361823ddf5961a5f1bb517e4bca69e621cbce9e Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor --- cmake/QtBuild.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmake') diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 98c9c334cf..4427d2438b 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1131,6 +1131,8 @@ function(add_qt_module target) set_target_properties("${target}" PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}" RUNTIME_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${QT_BUILD_DIR}/${INSTALL_BINDIR}" + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${QT_BUILD_DIR}/${INSTALL_BINDIR}" ARCHIVE_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}" VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} @@ -1815,6 +1817,10 @@ function(add_qt_tool name) ) qt_internal_add_target_aliases("${name}") + set_target_properties("${name}" PROPERTIES + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${QT_BUILD_DIR}/${INSTALL_BINDIR}" + ) + if(NOT arg_NO_INSTALL AND arg_TOOLS_TARGET) # Assign a tool to an export set, and mark the module to which the tool belongs. qt_internal_append_known_modules_with_tools("${arg_TOOLS_TARGET}") -- cgit v1.2.3