paceholder / nodeeditor

Qt Node Editor. Dataflow programming framework
BSD 3-Clause "New" or "Revised" License
3.03k stars 814 forks source link

Leave Qt version up to users #314

Closed higaski closed 2 years ago

higaski commented 2 years ago

Currently CMakeLists.txt tries to find Qt6 and eventually falls back to Qt5.13 in case 6 isn't available.

# Find the QtWidgets library
find_package(Qt6
  COMPONENTS
   Core
   Widgets
   Gui
   OpenGL
)

if (NOT Qt6_FOUND)
  find_package(Qt5 5.13
    COMPONENTS
     Core
     Widgets
     Gui
     OpenGL
  )
endif()

This is an issue on machines were both, Qt6 and 5, are installed. There is no way to force nodeeditor to link against Qt5 if Qt6 is also found on the system. Maybe it would be a good idea to first check if Qt6 or Qt5 has already been added as dependency?

# Find the QtWidgets library
macro(find_qt6)
  find_package(Qt6 COMPONENTS Core Widgets Gui OpenGL)
endmacro()
macro(find_qt5)
  find_package(Qt5 5.13 COMPONENTS  Core Widgets Gui OpenGL)
endmacro()

if(Qt6_FOUND)
  find_qt6()
elseif(Qt5_FOUND)
  find_qt5()
elseif(NOT Qt6_FOUND AND NOT Qt5_FOUND)
  find_qt6()
  if(NOT Qt6_FOUND)
    find_qt5()
  endif()
endif()
aleksandaratanasov commented 2 years ago

Also on machines with just Qt5 the project actually fails to build claiming it cannot find Qt6.

paceholder commented 2 years ago

Hi @aleksandaratanasov ,

yes, the version selection was implemented in a "quick and dirty" manner. I'll try to merge @Yadunund 's branch soon.

paceholder commented 2 years ago

I've merged the mentioned branch to master. Let me know if that works for your purposes now.