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