Trying to build qextserialport using CMake

358 views
Skip to first unread message

Andrew Louis

unread,
Jul 31, 2012, 4:36:18 PM7/31/12
to qextserialport
I`m trying to build qextserialport using CMake using the support I
found here: https://groups.google.com/forum/?fromgroups#!msg/qextserialport/QQ8S_LYXie8/mU2X6OXQJZsJ,
and was unable to do so, I`ve posted details below. Please inform me
if any more information is reqired.

I put the text file in my QExtSerialPort/src folder, and changed some
of the filenames form posix_qext... to qextserialport_p, and so on, as
I found the files in the latest release, however, when I opened the
Solution file in Visual Studio generated by CMake, there were a few
errors that were brought up:

QExtSerialPort\src\qextserialport.cpp(1028): fatal error C1083: Cannot
open include file: 'moc_qextserialport.cpp': No such file or directory
QExtSerialPort/src/qextserialport.h(167) : see declaration of
'QextSerialPortPrivate'
build\QExtSerialPort\moc_qextserialport.cxx(99): error C2227: left of
'->_q_onWinEvent' must point to class/struct/union/generic type
build\QExtSerialPort\moc_qextserialport.cxx(99): error C2061: syntax
error : identifier 'HANDLE'
build\QExtSerialPort\moc_qextserialport.cxx(100): error C2027: use of
undefined type 'QextSerialPortPrivate'
QExtSerialPort/src/qextserialport.h(167) : see declaration of
'QextSerialPortPrivate'
QExtSerialPort\moc_qextserialport.cxx(100): error C2227: left of '-
>_q_canRead' must point to class/struct/union/generic type

I do not understand what I should be linking that is not being linked
as this is done, any input would be awesome.

Lisandro Damián Nicanor Pérez Meyer

unread,
Jul 31, 2012, 8:44:08 PM7/31/12
to qextser...@googlegroups.com, Andrew Louis
On Mar 31 Jul 2012 17:36:18 Andrew Louis escribió:
> I`m trying to build qextserialport using CMake using the support I
> found here:
> https://groups.google.com/forum/?fromgroups#!msg/qextserialport/QQ8S_LYXie
> 8/mU2X6OXQJZsJ, and was unable to do so, I`ve posted details below. Please
> inform me if any more information is reqired.

I haven't checked the CMake file, but it was made in 2010 so it probably
doesn't fits well inside the current source code, or it may have deprecated
stuff in it.

You can still try to modify it or do it yourself from scratch. Check:

<http://developer.qt.nokia.com/quarterly/view/using_cmake_to_build_qt_projects>

And also:

<http://dumbledore.com.ar/gitweb/?p=libusbtmc.git;a=tree;h=df21496cea40056728214f17009851a9eb390a37;hb=df21496cea40056728214f17009851a9eb390a37>

for inspiration :)

Regards, Lisandro.

--
"Hola, soy su amigo Chespirito. Cuando estaba yo en el vientre de mi madre,
ella sufrió un accidente que la puso al borde de la muerte. El médico le
dijo: -Tendrás que abortar. Y ella respondió: -¿Abortar yo? Jamás.
Es decir, defendió la vida, mi vida. Y gracias a ello estoy aquí."
Roberto "Chespirito" Gómez Bolaños
http://es.wikipedia.org/wiki/Chespirito

Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/
signature.asc

Andrew Louis

unread,
Aug 5, 2012, 9:13:32 AM8/5/12
to qextserialport
Hello there, so I did finally get it to work. Even after running CMake
and running the generated Visual Studio project, I still had some
linker issues, but I managed to get rid of them by manually getting
rid of the linker issues (Giving absolute paths, making sure all
necessary classes were recognized etc. More information here:
http://cmake.3232098.n2.nabble.com/CMake-does-not-find-an-header-file-and-ignores-the-classes-found-in-several-other-header-files-td7581066.html)

The following is the CMakeLists.txt file that worked. Doesn't make
much of a difference but this was done with QExtSerialPort-1.2
(Alpha).

PROJECT(MyProject)
FIND_PACKAGE(Qt4 REQUIRED)

#Find libs that you might be using (I believe it is a different
process using DLL libraries)
FIND_LIBRARY(LIB1 filename path)
FIND_LIBRARY(LIB2 filename2 path2)

#Set your own project`s headers and source files here.
#SET(MyProject_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/include/
myincludefile.cpp myfile1.cpp myfile2.cpp myfile3.cpp myfile4.cpp
myfile5.cpp)
#SET(MyProject_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/
myincludefile.h myfile2.h myfile3.h myfile4.h myfile5.h)
#SET(MyProject_RESOURCES icons.qrc)

SET(QExtSerialPort_HEADERS QExtSerialPort/src/
qextwineventnotifier_p.h
QExtSerialPort/src/qextserialport_p.h
QExtSerialPort/src/qextserialport_global.h
QExtSerialPort/src/qextserialport.h
QExtSerialPort/src/qextserialenumerator_p.h
QExtSerialPort/src/qextserialenumerator.h)
SET(QExtSerialPort_SOURCES QExtSerialPort/src/qextserialenumerator.cpp
QExtSerialPort/src/qextserialport.cpp
QExtSerialPort/src/qextwineventnotifier_p.cpp)

if (WIN32)
#Check syntax for this. QExt... may need to be wrapped in
parentheses.
LIST(APPEND QExtSerialPort_SOURCES QExtSerialPort/src/
qextserialport_win.cpp)
#SET(QExtSerialPort_SOURCES ${QExtSerialPort_SOURCES} QExtSerialPort/
src/qextserialport_win.cpp)
# add_definitions(-DWINVER=0x0501) # needed for mingw (dbt
business??
LINK_LIBRARIES(${QT_QTGUI_LIBRARY} setupapi advapi32 user32)
endif(WIN32)

if (UNIX)
LIST(APPEND QExtSerialPort_SOURCES QExtSerialPort/src/
qextserialport_unix.cpp)
endif (UNIX)

if (OSX)
LINK_LIBRARIES(framework IOKit)
LIST(APPEND QExtSerialPort_SOURCES QExtSerialPort/src/
qextserialport_osx.cpp)
endif (OSX)

QT4_WRAP_CPP(MyProject_HEADERS_MOC ${MyProject_HEADERS} $
{QExtSerialPort_HEADERS})

INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})


INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} $
{CMAKE_CURRENT_SOURCE_DIR}/include QExtSerialPort/src)
ADD_EXECUTABLE(MyProject ${MyProject_SOURCES}
${QExtSerialPort_SOURCES}
${MyProject_HEADERS_MOC}
${MyProject_RESOURCES_RCC})

TARGET_LINK_LIBRARIES(MyProject ${QT_LIBRARIES} ${LIB1} ${LIB2})

Cheers! Bump this thread if I can be of assistance, I went through a
lot of time and effort trying to get this to work.

On Jul 31, 8:44 pm, Lisandro Damián Nicanor Pérez Meyer
<perezme...@gmail.com> wrote:
> On Mar 31 Jul 2012 17:36:18 Andrew Louis escribió:
>
> > I`m trying to build qextserialport using CMake using the support I
> > found here:
> >https://groups.google.com/forum/?fromgroups#!msg/qextserialport/QQ8S_...
> > 8/mU2X6OXQJZsJ, and was unable to do so, I`ve posted details below. Please
> > inform me if any more information is reqired.
>
> I haven't checked the CMake file, but it was made in 2010 so it probably
> doesn't fits well inside the current source code, or it may have deprecated
> stuff in it.
>
> You can still try to modify it or do it yourself from scratch. Check:
>
> <http://developer.qt.nokia.com/quarterly/view/using_cmake_to_build_qt_...>
>
> And also:
>
> <http://dumbledore.com.ar/gitweb/?p=libusbtmc.git;a=tree;h=df21496cea4...>
>
> for inspiration :)
>
> Regards, Lisandro.
>
> --
> "Hola, soy su amigo Chespirito. Cuando estaba yo en el vientre de mi madre,
> ella sufrió un accidente que la puso al borde de la muerte. El médico le
> dijo: -Tendrás que abortar. Y ella respondió: -¿Abortar yo? Jamás.
> Es decir, defendió la vida, mi vida. Y gracias a ello estoy aquí."
>   Roberto "Chespirito" Gómez Bolaños
>  http://es.wikipedia.org/wiki/Chespirito
>
> Lisandro Damián Nicanor Pérez Meyerhttp://perezmeyer.com.ar/http://perezmeyer.blogspot.com/
>
>  signature.asc
> < 1KViewDownload
Reply all
Reply to author
Forward
0 new messages