D
D
devalone2017-08-12 03:06:17
Qt
devalone, 2017-08-12 03:06:17

Qt application is not dynamically linked to windows. What to do?

There is the following cmake file:


cmake_minimum_required(VERSION 3.1)
project(Flamingo)
set (CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
find_package(Qt5Q) find_package(Qt5Q)
find_package(Qt5Q)
find_package(Qt5Multimedia)
find_package(Qt5MultimediaWidgets)
include_directories(".")
file(GLOB_RECURSE Flamingo_SRC
"*.h"
"*.cpp"
"*.hpp"
)
add_executable(${PROJECT_NAME} ${Flamingo_SRC} "res/main.qrc ")
target_link_libraries(${PROJECT_NAME} -lpthread)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} Qt5::Sql)
target_link_libraries(${PROJECT_NAME} Qt5::Multimedia)
target_link_libraries(${PROJECT_NAME} Qt5::MultimediaWidgets)

I use Qt from the off site 5.9.1 version with the MSVC compiler, I compile, everything works, but for some reason windeployqt generates ~ 100MB of files (among them opengl32sw.dll), but it does not add the necessary ones, for example Qt5Sql.dll.
What is the problem? Is there something wrong with my CMakeLists.txt?
UPD: the same project works with qmake. windeployqt generates 50MB of files and everything starts. But still I would like to know why it does not work with cmake

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrei Smirnov, 2017-08-15
@devalone

I don’t know if it will help or not, but when I built OpenCV with Qt, I used CMake UI which just highlighted in red that I couldn’t find Qt components. In the same place, I clearly indicated the correct paths and it all worked.
Maybe it makes sense to run CMake UI and see what it swears at?
1f49b21ba26148f6931e1e4c43a0ec20.PNG

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question