Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Error #336

Closed
ngophuc opened this issue Jun 11, 2018 · 11 comments · Fixed by #337
Closed

Compilation Error #336

ngophuc opened this issue Jun 11, 2018 · 11 comments · Fixed by #337

Comments

@ngophuc
Copy link
Contributor

ngophuc commented Jun 11, 2018

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
Copy link
Member

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

@dcoeurjo
Copy link
Member

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

@copyme
Copy link
Member

copyme commented Jun 12, 2018

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
Copy link
Contributor Author

ngophuc commented Jun 12, 2018

I do compile with qt5 on mac os 13.3.4.

@kerautret
Copy link
Member

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
Copy link

naubry commented Jun 12, 2018

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
Copy link
Contributor Author

ngophuc commented Jun 12, 2018

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
Copy link
Member

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

@naubry
Copy link

naubry commented Jun 12, 2018

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
Copy link
Contributor Author

ngophuc commented Jun 12, 2018

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
Copy link
Member

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 ;)

dcoeurjo added a commit that referenced this issue Aug 31, 2018
Fix qt5 compile (issue #336) with SliceViewer Fix (issue #335)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants