From 2998dc09288f009e162a0573edd703628f939488 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 10 Aug 2017 16:15:17 +0200 Subject: cmake: fix installed qt dlls location --- cmake/opentrack-platform.cmake | 10 ++++++---- cmake/opentrack-qt.cmake | 22 +++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 7e140e98..7882196e 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -25,7 +25,9 @@ if(NOT CMAKE_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install") endif() -set(CMAKE_BUILD_TYPE_INIT "RELEASE") +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE) +endif() if(APPLE) if(NOT CMAKE_OSX_ARCHITECTURES) @@ -60,9 +62,9 @@ if(MSVC) add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_ITERATOR_DEBUG_LEVEL=0 -D_ITERATOR_DEBUG_LEVEL=0) add_definitions(-D_HAS_EXCEPTIONS=0) - if(MSVC_VERSION GREATER 1910) # 1911 is 15.3 update - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive-") - set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -permissive-") + if(MSVC_VERSION GREATER 1909) # visual studio 2017 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive- -diagnostics:caret") + set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -permissive- -diagnostics:caret") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Zi -std:c++14") diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index 311ff53d..de1c41c4 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -1,18 +1,27 @@ -find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets Gui LinguistTools QUIET) +if(WIN32) + find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) +endif() +find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui QUIET) find_package(Qt5 COMPONENTS SerialPort Gamepad QUIET) + include_directories(SYSTEM ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) if(WIN32) - foreach(i Qt5Core Qt5Gui Qt5Network Qt5SerialPort Qt5Widgets) - set(path "${Qt5_DIR}/../../../bin/${i}") - install(FILES "${path}.dll" DESTINATION .) + foreach(i Qt5::Core Qt5::Gui Qt5::Network Qt5::SerialPort Qt5::Widgets) + get_property(path TARGET "${i}" PROPERTY LOCATION) + if("${path}" STREQUAL "") + message(FATAL_ERROR "${i} ${path}") + endif() + install(FILES "${path}" DESTINATION .) if(NOT MSVC AND opentrack_install-debug-info AND EXISTS "${path}.pdb") install(FILES "${path}.pdb" DESTINATION "${opentrack-hier-debug}") endif() endforeach() - install(FILES "${Qt5_DIR}/../../../plugins/platforms/qwindows.dll" DESTINATION "./platforms") + + get_property(qwindows-dll TARGET Qt5::QWindowsIntegrationPlugin PROPERTY IMPORTED_LOCATION_RELEASE) + install(FILES "${qwindows-dll}" DESTINATION "./platforms") endif() function(is_msvc_sln_generator var) @@ -24,7 +33,7 @@ function(is_msvc_sln_generator var) endif() endfunction() -if(MSVC) +if(MSVC AND FALSE) # on .sln generator we have no editbin in path is_msvc_sln_generator(is-msvc) if(is-msvc) @@ -44,4 +53,3 @@ if(MSVC) endforeach() ") endif() - -- cgit v1.2.3