Cmake support

499 views
Skip to first unread message

Patrick von Reth

unread,
Jan 14, 2010, 8:52:18 AM1/14/10
to qextser...@googlegroups.com
Hi, 
cause I prefer using CMake instead of qmake I created the folowing CMake script base on the qmake file.
I'm currently only able to test it with release mode on windows with mingw4 so if It doesn't work on mac or Linux please report, If it work you can add it to your repository for all those who prefer CMake (like me ;)) 


Greetings,

Patrick
CMakeLists.txt

Márton Miklós

unread,
Jan 14, 2010, 9:15:44 AM1/14/10
to qextser...@googlegroups.com
Hello,

Works for me fine on Linux (Ubuntu 9.10 64 bit with Qt 4.6.0).

Regards,
Miklós Márton


Patrick von Reth írta:

Patrick von Reth

unread,
Jan 14, 2010, 9:16:23 AM1/14/10
to qextser...@googlegroups.com
Removed setting of buildtype to RelWithDebinfo, now it should be possible to set different buildtypes by cmak argument.

2010/1/14 Patrick von Reth <pat...@von-reth.de>
CMakeLists.txt

Andrew Louis

unread,
Jul 31, 2012, 4:33:58 PM7/31/12
to qextser...@googlegroups.com, pat...@von-reth.de
Hi, 

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.

1+1=2

unread,
Aug 15, 2012, 5:23:32 AM8/15/12
to qextser...@googlegroups.com
Hi Andrew,

The problem is that, for a header file that contains Q_OBJECT,

qmake calls:

moc xxxx.h -o moc_xxxx.cpp

while camke calls:

moc xxxx.h -o moc_xxxx.cxx

This isn't a problem for normal use. But when we try to include the
generated file in another compile unit, errors will occur.

More information can be found from
http://code.google.com/p/qextserialport/wiki/Three_Usage_Of_MOC

Regards

Debao
> --
> You received this message because you are subscribed to the Google Groups
> "qextserialport" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/qextserialport/-/Czn6CY5E1gAJ.
> To post to this group, send email to qextser...@googlegroups.com.
> To unsubscribe from this group, send email to
> qextserialpor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/qextserialport?hl=en.

Elia Mazzuoli

unread,
Jun 3, 2013, 10:27:49 AM6/3/13
to qextser...@googlegroups.com, pat...@von-reth.de
Hi,

Can I compile the qextserialport like shared library with normal procudere and then use it by CMakeFile ?? I have followed the guide for shared compiling, but writing

find_package(qextserialport REQUIRED)

I get "not found"..

Any idea?

Elia.

Lisandro Damián Nicanor Pérez

unread,
Jun 3, 2013, 12:35:11 PM6/3/13
to qextser...@googlegroups.com, Elia Mazzuoli, pat...@von-reth.de
On Monday 03 June 2013 07:27:49 Elia Mazzuoli wrote:
> Hi,
>
> Can I compile the qextserialport like shared library with normal procudere
> and then use it by CMakeFile ??

You should be able.

> I have followed the guide for shared
> compiling, but writing
>
> find_package(qextserialport REQUIRED)
>
> I get "not found"..
>
> Any idea?

Yes, libqextseriaport does not ships a CMake configuration file, so you can't
use find_package.

What I did to "solve" this issue is:

# We also need qextserialport, but as it doesn't provides a CMake
# configuration file, we hardcode the path (not nice, but works)
include_directories("/usr/include/QtExtSerialPort/")

That's of course if you use qextserialport as provided by your system (if you
use Linux).

You may need to adjust that path if you have the lib somewhere else.

Kinds regards, Lisandro.

--

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

Volker Fröhlich

unread,
Jun 3, 2013, 12:57:51 PM6/3/13
to qextser...@googlegroups.com
On 06/03/2013 06:35 PM, Lisandro Damián Nicanor Pérez Meyer wrote:
> On Monday 03 June 2013 07:27:49 Elia Mazzuoli wrote:
>> Hi,
>>
>> Can I compile the qextserialport like shared library with normal procudere
>> and then use it by CMakeFile ??
>
> You should be able.
>
>> I have followed the guide for shared
>> compiling, but writing
>>
>> find_package(qextserialport REQUIRED)
>>
>> I get "not found"..
>>
>> Any idea?
>
> Yes, libqextseriaport does not ships a CMake configuration file, so you can't
> use find_package.
>
> What I did to "solve" this issue is:
>
> # We also need qextserialport, but as it doesn't provides a CMake
> # configuration file, we hardcode the path (not nice, but works)
> include_directories("/usr/include/QtExtSerialPort/")
>
> That's of course if you use qextserialport as provided by your system (if you
> use Linux).
>
> You may need to adjust that path if you have the lib somewhere else.
>
> Kinds regards, Lisandro.
>

Maybe you find this one useful:
https://github.com/qgis/Quantum-GIS/blob/master/cmake/FindQextserialport.cmake

Volker

Elia Mazzuoli

unread,
Jun 4, 2013, 10:40:26 AM6/4/13
to qextser...@googlegroups.com, pat...@von-reth.de
I have try this:

> # We also need qextserialport, but as it doesn't provides a CMake 
> # configuration file, we hardcode the path (not nice, but works) 
> include_directories("/usr/include/QtExtSerialPort/") 

but I don't understand how I can link the library (I know that the only "include" is not sufficient or yes??).
Yes, the link is useful, but I am newbie witch CMake and I don't know how execute this script, any suggestion?




Lisandro Damián Nicanor Pérez

unread,
Jun 4, 2013, 11:02:37 AM6/4/13
to qextser...@googlegroups.com, Elia Mazzuoli, pat...@von-reth.de
On Tuesday 04 June 2013 07:40:26 Elia Mazzuoli wrote:
> I have try this:
> > # We also need qextserialport, but as it doesn't provides a CMake
> > # configuration file, we hardcode the path (not nice, but works)
> > include_directories("/usr/include/QtExtSerialPort/")
>
> but I don't understand how I can link the library (I know that the only
> "include" is not sufficient or yes??).

target_link_libraries(your_app -lqextserialport <other links if needed>)

--

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

Volker Fröhlich

unread,
Jun 4, 2013, 11:20:54 AM6/4/13
to qextser...@googlegroups.com, pat...@von-reth.de
See https://github.com/qgis/Quantum-GIS/blob/master/CMakeLists.txt

FIND_PACKAGE(Qextserialport REQUIRED)

Later use those variables:
https://github.com/qgis/Quantum-GIS/blob/master/src/core/CMakeLists.txt

INCLUDE_DIRECTORIES(${QEXTSERIALPORT_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(qgis_core ${QEXTSERIALPORT_LIBRARY})

Volker

>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "qextserialport" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to qextserialpor...@googlegroups.com.
> To post to this group, send email to qextser...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/qextserialport?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>


Reply all
Reply to author
Forward
0 new messages