DGtal-team / DGtalTools

Tools associated with DGtal Library
http://dgtal.org
GNU Lesser General Public License v3.0
44 stars 38 forks source link

Compilation Error #336

Closed ngophuc closed 6 years ago

ngophuc commented 6 years ago

I got this error while compiling the tools :

CMake Error at visualisation/CMakeLists.txt:67 (qt5_use_modules): Unknown CMake command "qt5_use_modules".

And the line 67 is

qt5_use_modules(sliceViewer Widgets OpenGL Xml)

dcoeurjo commented 6 years ago

hi @ngophuc , could you please be a bit more specific (os, system, complete cmake trace,...) ?

dcoeurjo commented 6 years ago

e.g. are you sure to have DGtal built with qt5?

copyme commented 6 years ago

If you ask me then I think she did not use Qt5 to compile DGtal, etc. @ngophuc is it correct that you have tried to compile DGtal and DGtalTools on OS X?

ngophuc commented 6 years ago

I do compile with qt5 on mac os 13.3.4.

kerautret commented 6 years ago

I am on 13.3.5 and no pb, with an installation of qt without brew. Perhaps it is the cohabitation of qt4/qt5 since you said me that you have the two ;) Could you please test to remove qt4 and test it again ? (On my machine I can remove the qt5_use_modules but I suppose that is is perhaps needed on other context). @naubry perhaps you member ?

naubry commented 6 years ago

I don't know if you are using a modern version of CMake (after 3.0) but now CMake is "Targets/Properties" philosophy. So if you want to use Qt in your project with a CMakeLists.txt you have to include like that :

find_package(Qt5Widgets QUIET)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON) if you use qrc file
set(CMAKE_AUTOMOC ON) // if you use QObject
set(CMAKE_AUTOUIC ON) // if you have ui

add_executable(monprojet ...)
target_link_libraries(monprojet PRIVATE Qt5::Widgets)

you can specify where is your Qt version with : set(CMAKE_PREFIX_PATH whereisyourQt)

ngophuc commented 6 years ago

Qt5 is found correctly, it is related to qt5_use_modules When I comment line 67 of visualisation/CMakeLists.txt, it complied without any problem.

dcoeurjo commented 6 years ago

Qt5 works perfectly on many linux/macos OS. Could you please be more specific on your config (and cut/paste the cmake trace) ?

naubry commented 6 years ago

qt5_use_modules is for using Qt 5 with CMake older than 2.8.1. With what I wrote earlier, this is enough to compile a program using Qt5. When you have a CMake version above 3.0 of course.

ngophuc commented 6 years ago

I'm using Cmake 3.11. Here are what I obtained when compiling the code


-- Checking if DGtal is installed: -- c++11 enabled by cmake. -- DGtal found. -- Boost version: 1.67.0 -- Found the following Boost libraries: -- program_options -- Boost and boost_program_options found.


-- Checking if doxygen/dot is installed: -- dot found: /usr/local/bin/dot. Installing doc in /usr/local/share/DGtalTools -- configured /Users/NGO_Phuc/Documents/Dgtal/DGtalTools-master/doc/doxy.config.in --> /Users/NGO_Phuc/Documents/Dgtal/DGtalTools-master/newBuild/doxy.config


CMake Error at visualisation/CMakeLists.txt:67 (qt5_use_modules): Unknown CMake command "qt5_use_modules".

-- Configuring incomplete, errors occurred!

kerautret commented 6 years ago

thanks @naubry so I think that we can remove the qt5_use_modules and update cmake since DGtal need cmake version at least 3.1, if you have already tested you can PR it ;)