diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-11-03 23:09:50 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-11-03 23:41:03 +0100 |
commit | a7136a69d1f12c2783c96674c27f5899eb916bc6 (patch) | |
tree | a5f5f5267fab7a865ef466c721b7901f1e59acaa | |
parent | 66e7d295aa8bbc0ee68aa94cf8de389d48b4b8c5 (diff) |
cmake: always copy qt5 to install dir on Windows
Simplify the logic also.
-rw-r--r-- | cmake/opentrack-qt.cmake | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index ede00963..ded4ec41 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -4,43 +4,21 @@ include_directories(SYSTEM ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5W add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) -install(CODE " +if(WIN32) + foreach(i Qt5Core Qt5Gui Qt5Network Qt5SerialPort Qt5Widgets) + install(FILES "${Qt5_DIR}/../../../bin/${i}.dll" DESTINATION .) + endforeach() + install(FILES "${Qt5_DIR}/../../../plugins/platforms/qwindows.dll" DESTINATION "./platforms") +endif() - set(run-this FALSE) - if(\$ENV{USERNAME} STREQUAL \"sthalik\") - set(run-this TRUE) - endif() +string(FIND "${CMAKE_GENERATOR}" "Visual Studio " is-msvc) - if(WIN32 AND run-this) - if(NOT EXISTS \"${Qt5_DIR}/../../../bin/qmake.exe\") - message(FATAL_ERROR \"configure qt at least a:${Qt5_DIR} b:\${qt-dir}\") - endif() +# on .sln generator we have no editbin path ready - if(EXISTS \"\${CMAKE_INSTALL_PREFIX}/opentrack.exe\") - file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}\") - endif() - - file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}\") - - if(NOT EXISTS \"\${CMAKE_INSTALL_PREFIX}\") - message(FATAL_ERROR \"make sure install dir exists at least\") - endif() - - set(bin-path \"${Qt5_DIR}/../../../bin\") - set(platforms-path \"${Qt5_DIR}/../../../plugins/platforms\") - - foreach(i Qt5Core Qt5Gui Qt5Network Qt5SerialPort Qt5Widgets) - configure_file(\"\${bin-path}/\${i}.dll\" \"\${CMAKE_INSTALL_PREFIX}/\${i}.dll\" COPYONLY) - endforeach() - - file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/platforms\") - configure_file(\"\${platforms-path}/qwindows.dll\" \"\${CMAKE_INSTALL_PREFIX}/platforms/qwindows.dll\" COPYONLY) - endif() - - if(MSVC) +if(MSVC AND NOT is-msvc EQUAL 0) + install(CODE " foreach(i Qt5Core Qt5Gui Qt5Network Qt5SerialPort Qt5Widgets platforms/qwindows) - execute_process(COMMAND editbin -nologo -SUBSYSTEM:WINDOWS,5.01 -OSVERSION:5.1 \"\${i}.dll\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}\") + execute_process(COMMAND editbin -nologo -SUBSYSTEM:WINDOWS,5.01 -OSVERSION:5.1 \"\${i}.dll\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}\") endforeach() - endif() - -") + ") +endif() |