Excess Static Libs when using QMake
-
Folks,
I am using Qt 6.10 and a source build. When I use QMake to generate the make files and the _plugin_import.cpp file I am getting many additional static libraries that I do not need or have added in automatically, such as QSvgIconPlugin.
I can manually edit the generated files to remove them and things work fine, but in the long term I would rather not have to do that. Any idea how to get Qt to not auto add those static plugins?
Thanks
Dale Pennington -
Folks,
I am using Qt 6.10 and a source build. When I use QMake to generate the make files and the _plugin_import.cpp file I am getting many additional static libraries that I do not need or have added in automatically, such as QSvgIconPlugin.
I can manually edit the generated files to remove them and things work fine, but in the long term I would rather not have to do that. Any idea how to get Qt to not auto add those static plugins?
Thanks
Dale Pennington@DalePennington said in Excess Static Libs when using QMake:
Did you try
QT -= svgif you do not need SVG?
-
Tried it, no change. I am trying the cmake file now to see if I can get that to work. Seems to be OK except AUTOMOC is not generating moc files for our basic code tree (with seperate forms,inc and src dirs). Once set the AUTOUIC search path property the forms generated OK, but so far AUTOMOC is not generating the moc. If I turn the tree flat (i.e. put all the files at the top level) it works so there is something I am missing with regards to getting AUTOMOC to look in the right places
Dale -
Hi,
Might be a silly question but did you set the AUTOMOC_INCLUDE_DIRECTORIES property ?
-
At this point I have not. I tried at one point and noticed the MOC_INCLUDES variable in AutogenInfo.json did not change, do I probably did something wrong. It does include the include directory I set for the target, but this is not where the AUTOUIC places the ui_.h file it generates. I am assuming that this needs to be findable to get AUTOMOC to work properly, but no good idea how to fix that.
-
To make help easier, this is the setup
- Files are in the following tree
guiclient2 - Has .pro file forms - has ui file inc - has .hpp files src - has .cpp filesThe CMakeLists.txt file has
cmake_minimum_required(VERSION 3.16) project(guiclient LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_AUTOUIC_SEARCH_PATHS "forms") find_package(Qt5 REQUIRED COMPONENTS Widgets WebSockets) qt_standard_project_setup() qt_add_executable(guiclient2 src/main.cpp src/echowindow.cpp } target_include_directories(guiclient2 PRIVATE inc) target_link_libraries(guiclient2 PRIVATE Qt::Widgets Qt::WebSockets )The original cmake call sets up the AutogenInfo.json, so it must be determining what UI and MOC need generating at that time.
As noted, if I do the same files in a flat setup (all in guiclient2) it works fine with the same CMakeLists.txt with the paths modified.I hope this helps figure out what I am doing wrong.
Dale Pennington -
Add also your headers. Then automoc will find them and you will see them properly in the IDE.
-
Odd, not needed in flat file system case, but explicity adding it to the sources did in fact get everything to work.
As a side, not important question, is there a way to add sources to a target after the initial qt_add_executable ? I ask this for ease of future use for programs with large numbers of source files.
Thanks,
Dale Pennington -
D DalePennington has marked this topic as solved on
-
When all is in one directory then automoc can find them. It does not search in subdirectories.
For additional sources - see target_sources cmake command