Subject: CGAL users discussion list
List archive
- From: 陳 柏宏 <>
- To:
- Subject: [cgal-discuss] CMakeLists
- Date: Sat, 14 Feb 2009 02:06:12 +0800 (CST)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.tw; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=Wy2IUj4oMoG35yH3A131wydpH+Gzioc4vQMG5eSTZ9/GIfMihuvQ37LQqGfh/7M5+0oySt2eFibp283UIUwRhQOWBAe8SvFRNegfD07+oETIFotUmXtP1q0CJgl68dalv/DBj9klMS4Mu+k1B/5Z26v9jPNOf95eYAi6r6i7aXw=;
Hi, How do I write CMakeLists for CGAL 3.4?
I am trying to convert this Makefile (under 3.1)
__________________________________________
include $(CGAL_MAKEFILE)
CXXFLAGS = $(CGAL_CXXFLAGS) -g -ansi -w
SOLVER_LIBS= -lgsl -lgslcblas
all: example gen_data kinetic
clean:
rm -f *.o *.moc example gen_data *~ core*
example: example.o poly.o zroots.o
$(CXX) $(CXXFLAGS) $(CGAL_LDFLAGS) -o example $^ $(SOLVER_LIBS)
gen_data: gen_data.o poly.o
zroots.o
$(CXX) $(CXXFLAGS) $(CGAL_LDFLAGS) -o gen_data $^ $(SOLVER_LIBS)
window.moc: window.h
$(QT_MOC) -o window.moc window.h
interface.moc: interface.h
$(QT_MOC) -o interface.moc interface.h
window.o: window.moc
interface.o: interface.moc
kinetic: main.o window.o interface.o poly.o zroots.o kdt.o
$(CXX) $(CXXFLAGS) $(CGAL_LDFLAGS) -o kinetic $^ $(SOLVER_LIBS) -lCGALQt -lqt -lgmp -lmpfr -lm
__________________________________________
to a CMakeLists for CGAL 3.4
I
tried:
____________________________________________
# This is the CMake script for compiling a CGAL application.
project( kinetic )
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
set(SOLVER_LIBS -lgsl -lgslcblas)
if ( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif()
find_package(CGAL COMPONENTS Qt3 )
include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND QT3_FOUND AND CGAL_Qt3_FOUND)
# use
the Qt MOC preprocessor on classes that derives from QObject
include( Qt3Macros-patched )
qt3_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/window.h" window.moc )
qt3_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/interface.h" interface.moc )
# The executable itself.
add_executable ( example
example.cpp
poly.cpp
zroots.cpp)
add_executable ( gen_data
gen_data.cpp
poly.cpp
zroots.cpp)
add_executable ( kinetic
window.cpp window.moc
interface.cpp interface.moc
poly.cpp
zroots.cpp
kdt.cpp)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS example )
add_to_cached_list( CGAL_EXECUTABLE_TARGETS gen_data )
add_to_cached_list( CGAL_EXECUTABLE_TARGETS kinetic )
target_link_libraries( example ${CGAL_LIBRARIES} ${SOLVER_LIBS} ${CGAL_3RD_PARTY_LIBRARIES})
target_link_libraries( gen_data ${CGAL_LIBRARIES} ${SOLVER_LIBS} ${CGAL_3RD_PARTY_LIBRARIES})
target_link_libraries( kinetic ${CGAL_LIBRARIES} ${SOLVER_LIBS}
${CGAL_3RD_PARTY_LIBRARIES})
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt3, and will not be compiled.")
endif()
______________________________________
But when compiling I get a linking error
Linking CXX executable kinetic
/usr/bin/cmake -P CMakeFiles/kinetic.dir/cmake_clean_target.cmake
/usr/bin/c++ -frounding-math -O3 -DNDEBUG -fPIC "CMakeFiles/kinetic.dir/window.o" "CMakeFiles/kinetic.dir/interface.o" "CMakeFiles/kinetic.dir/poly.o" "CMakeFiles/kinetic.dir/zroots.o" "CMakeFiles/kinetic.dir/kdt.o" -o kinetic -rdynamic -L/afs/ir.stanford.edu/class/cs268/support/CGAL-3.4/lib -L/usr/class/cs268/support/CGAL-3.4/lib -L/usr/class/cs268/support/qt/lib -lCGAL_Qt3 -lCGAL -lboost_thread-gcc41-mt-1_34_1 -Wl,-Bstatic -lqassistantclient -Wl,-Bdynamic -lqt -lSM -lICE -lX11 -lXext -ldl
-lGLU -lGL -lSM -lICE -lX11 -lXext -lCGAL_Qt3 -lCGAL -lgsl -lgslcblas -lboost_thread-gcc41-mt-1_34_1 -Wl,-Bstatic -lqassistantclient -Wl,-Bdynamic -lqt -lSM -lICE -lX11 -lXext -ldl -lGLU -lGL -lSM -lICE -lX11 -lXext -Wl,-rpath,/afs/ir.stanford.edu/class/cs268/support/CGAL-3.4/lib:/usr/class/cs268/support/CGAL-3.4/lib:/usr/class/cs268/support/qt/lib
/usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
What is wrong here?
付費才容量無上限?Yahoo!奇摩電子信箱2.0免費給你,信件永遠不必刪! - 馬上體驗! |
- [cgal-discuss] CMakeLists, 陳 柏宏, 02/13/2009
- Re: [cgal-discuss] CMakeLists, Bart Janssens, 02/13/2009
Archive powered by MHonArc 2.6.16.