You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are just packaging the Node Editor project in Conan (PR conan-io/conan-center-index#24751) and it fails to be built when using Qt full dynamic libraries, so moc executable can not find its dependencies libraries due to a misconfiguration of ld library path. Of course, it will not happen in case Qt is fully static, or moc and rcc executables at least.
However, Nodeeditor is using qt_wrap_cpp which is marked as deprecated by CMake page, but still working. The CMake's page also recommends:
Consider updating the project to use the AUTOMOC target property instead for a more automated way of invoking the moc tool.
The CMake's suggestion here will not only reduce your CMakeLists.txt size, but also its maintenance as well.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c9285b..a2e366c 100644
--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -60,16 +60,6 @@ if (${QT_VERSION} VERSION_LESS 5.11.0)
message(FATAL_ERROR "Requires qt version >= 5.11.0, Your current version is ${QT_VERSION}")
endif()
-if (${QT_VERSION_MAJOR} EQUAL 6)- qt_add_resources(RESOURCES ./resources/resources.qrc)-else()- qt5_add_resources(RESOURCES ./resources/resources.qrc)-endif()--# Unfortunately, as we have a split include/src, AUTOMOC doesn't work.-# We'll have to manually specify some files-set(CMAKE_AUTOMOC ON)-
set(CPP_SOURCE_FILES
src/AbstractGraphModel.cpp
src/AbstractNodeGeometry.cpp
@@ -95,6 +85,7 @@ set(CPP_SOURCE_FILES
src/StyleCollection.cpp
src/UndoCommands.cpp
src/locateNode.cpp
+ resources/resources.qrc
)
set(HPP_HEADER_FILES
@@ -203,24 +194,8 @@ set_target_properties(QtNodes
######
# Moc
##
+set_target_properties(QtNodes PROPERTIES AUTOMOC ON AUTORCC ON)-file(GLOB_RECURSE HEADERS_TO_MOC include/QtNodes/internal/*.hpp)--if (${QT_VERSION_MAJOR} EQUAL 6)- qt_wrap_cpp(nodes_moc- ${HEADERS_TO_MOC}- TARGET QtNodes- OPTIONS --no-notes # Don't display a note for the headers which don't produce a moc_*.cpp- )-else()- qt5_wrap_cpp(nodes_moc- ${HEADERS_TO_MOC}- TARGET QtNodes- OPTIONS --no-notes # Don't display a note for the headers which don't produce a moc_*.cpp- )-endif()--target_sources(QtNodes PRIVATE ${nodes_moc})
###########
# Examples
As a result, the build log still generates the qrc_resources.cpp, but now is automatically done by CMake:
Hello!
We are just packaging the Node Editor project in Conan (PR conan-io/conan-center-index#24751) and it fails to be built when using Qt full dynamic libraries, so moc executable can not find its dependencies libraries due to a misconfiguration of ld library path. Of course, it will not happen in case Qt is fully static, or moc and rcc executables at least.
However, Nodeeditor is using qt_wrap_cpp which is marked as deprecated by CMake page, but still working. The CMake's page also recommends:
The CMake's suggestion here will not only reduce your CMakeLists.txt size, but also its maintenance as well.
I did a patch locally to validate this theory and it looks to be working: 0001-configure-automoc.patch
As a result, the build log still generates the
qrc_resources.cpp
, but now is automatically done by CMake:Here is my full build log, so you can visualize everything:
nodeeditor-3.0.11-macos-shared-patched.log
I see the comment in your CMakeLists.txt as well:
However, it was 7 years ago (PR #142) and many features changed in CMake since then.
Please, feel free to share your ideas about using AUTOMOC now. I could open a PR if needed.
The text was updated successfully, but these errors were encountered: