I am trying to run some of the sample example code from CGAL as a Qt project, to run in Qt Creator. I expect that I will have to modify the .pro
file. How should it be modified to use CGAL libraries?
I'm not familiar with CGAL specifically, but in general , you would need to add the following to your .pro
file:
INCLUDEPATH += /path/to/cgal/headers
LIBS += -Lpath/to/cgal/libraries -lcgal_dll_name
You may also need to add some DEFINES
if CGAL requires it, ie
DEFINES += SOME_MACRO_THAT_CGAL_REQUIRES
If you were looking for help on CGAL specifically, please clarify your question and I will delete this answer.
Although this is an old question, just for the sake of having a more complete answer, this is what I had to do in the .pro file:
INCLUDEPATH += /usr/include/
LIBS += -L/usr/include/
LIBS += -lCGAL
LIBS += -lgmp
LIBS += -lmpfr // not really needed for me, but added since gmp had to be added too
QMAKE_CXXFLAGS += -frounding-math -O3
Do NOT add stuff like the following, it will get you into trouble with weird error messages, as discussed in this link .
INCLUDEPATH += /usr/include/CGAL # do NOT add this!
LIBS += -L/usr/include/CGAL # do NOT add this!
I'm using Qt 4.8.6, gcc and Fedora 24, and here is my .pro for Qt-CGAL projects :
#-------------------------------------------------
#
# Project created by QtCreator 2017-01-08T14:50:29
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = My CGAL_test
TEMPLATE = app
LIBS += -lgmp -lmpfr -lCGAL
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.