[CMake] CMake does not find an header file, and ignores the classes found in several other header files.

Toronto Andrew andrew.louis93 at gmail.com
Sat Aug 4 19:58:31 EDT 2012


Hello, thank you for looking at my CMake issues! I really appreciate it :)

I fixed the major issue you mentioned (Moving INCLUDE_DIRECTORIES above
ADD_EXECUTABLE), however this did not seem to fix anything. I still got the
errors I was receiving prior to that change, and I used absolute paths when
linking to the include directory within my source. 

I fixed this *qextserialport\src\moc_qextserialport.cpp(10): fatal error
C1083: Cannot open include file: '../../../src/qextserialport.h': No such
file or directory. * by linking to the absolute path in
moc_qextserialport.cpp, which seemed to get rid of it, however it draws up
these now: 

*2>build\x\QExtSerialPort\src\moc_qextserialport.cxx(97): error C2027: use
of undefined type 'QextSerialPortPrivate'
2>  QExtSerialPort/src/qextserialport.h(167) : see declaration of
'QextSerialPortPrivate'
2>build\x\QExtSerialPort\src\moc_qextserialport.cxx(97): error C2227: left
of '->_q_canRead' must point to class/struct/union/generic type*

All these errors stem from a class in qextserialport_p.h (Recall:
QExtSerialPort/src/qextserialport_p.h(0): Note: No relevant classes found.
No output generated. still shows up),

So I guess the question is still how do I get the compiler to read these
files? And why is it not reading them? 

This is how the CMakeLists.txt file looks as it is right now:


*PROJECT(CppSampleQt01)
FIND_PACKAGE(Qt4 REQUIRED)

FIND_LIBRARY(SIMPLONLIB lv.simplon lib)
FIND_LIBRARY(SIMPLONIMGPROC lv.simplon.imgproc lib)

SET(CppSampleQt01_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/include/lv.simplon.class.cpp camera.cpp main.cpp
mainwindow.cpp osdep.cpp paint.cpp)
SET(CppSampleQt01_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/lv.simplon.class.h camera.h mainwindow.h
osdep.h paint.h)
SET(CppSampleQt01_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(CppSampleQt01_HEADERS_MOC ${CppSampleQt01_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(CppSampleQt01 ${CppSampleQt01_SOURCES}
				${QExtSerialPort_SOURCES}
				${CppSampleQt01_HEADERS_MOC}
				${CppSampleQt01_RESOURCES_RCC})

TARGET_LINK_LIBRARIES(CppSampleQt01 ${QT_LIBRARIES} ${SIMPLONLIB}
${SIMPLONIMGPROC})
*

Once again, thank you guys!



--
View this message in context: http://cmake.3232098.n2.nabble.com/CMake-does-not-find-an-header-file-and-ignores-the-classes-found-in-several-other-header-files-tp7581066p7581076.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list