Skip to content

Commit

Permalink
Fix CMake build of network/torrent example
Browse files Browse the repository at this point in the history
The ui_XXX.h include did not match the location of the XXX.ui file, and
AUTOUIC failed with
    "SRC:/addtorrentdialog.h"
    includes the uic file "ui_addtorrentform.h",
    but the user interface file "addtorrentform.ui"
    could not be found in the following directories
      "SRC:"

While this could be fixed by adjusting the include paths properly, this
would complicate the CMake project file, and we're dealing with an
example where needless complexity would cloud comprehensibility.

Move the .ui file next to corresponding source files instead.

This removes the need for any special cases in CMakeLists.txt, and we
can remove .prev_CMakeLists.txt.

Fixes: QTBUG-87457
Pick-to: 6.1
Change-Id: Ic2dec5ded7100e22d5afc571efc4b009bc62e41c
Reviewed-by: Kai Koehne <[email protected]>
  • Loading branch information
jobor committed Feb 15, 2021
1 parent 09cc63d commit 0c51a87
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 77 deletions.
2 changes: 1 addition & 1 deletion examples/network/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(TARGET Qt::Widgets)
add_subdirectory(loopback)
add_subdirectory(threadedfortuneserver)
add_subdirectory(googlesuggest)
# add_subdirectory(torrent) FIXME: This does not find its ui file:-/ # special case
add_subdirectory(torrent)
add_subdirectory(multicastreceiver)
add_subdirectory(multicastsender)
add_subdirectory(fortuneclient)
Expand Down
73 changes: 0 additions & 73 deletions examples/network/torrent/.prev_CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions examples/network/torrent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ find_package(Qt6 COMPONENTS Widgets)

qt_add_executable(torrent
addtorrentdialog.cpp addtorrentdialog.h
addtorrentform.ui
bencodeparser.cpp bencodeparser.h
connectionmanager.cpp connectionmanager.h
filemanager.cpp filemanager.h
forms/addtorrentform.ui
main.cpp
mainwindow.cpp mainwindow.h
metainfo.cpp metainfo.h
Expand All @@ -39,7 +39,6 @@ set_target_properties(torrent PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_include_directories(torrent PUBLIC forms) # special case
target_link_libraries(torrent PUBLIC
Qt::Core
Qt::Gui
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/network/torrent/torrent.pro
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SOURCES += main.cpp \
trackerclient.cpp

# Forms and resources
FORMS += forms/addtorrentform.ui
FORMS += addtorrentform.ui
RESOURCES += icons.qrc

# install
Expand Down

0 comments on commit 0c51a87

Please sign in to comment.