[Interest] using cmake to build Qt projects.

Bill Crocker william.crocker at analog.com
Wed May 4 16:08:27 CEST 2016


Hello:

I am trying to port my Qt project to a cmake based build so
I can use CLion for debugging.

I am almost there, but when it links there are symbols undefined.
 From my experience the symbols I am seeing are typical of missing moc files.
I know I have all of my #include "abc.moc" statements in place because
my project builds fine with qmake.

I have qmake in my path at the time of construction as recommended
by the cmake doc.

Note that I do not want to use cmake, but because CLion appears unable
to debug an app unless it was built by CLion and with cmake, here I am.
(The previous statement is from CLion tech support.)

My cmake file is provide below.
Does anyone see anything obvious

Thanks

Bill

-------------------------

cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)

PROJECT(abc)

set(CMAKE_AUTOMOC TRUE)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt4 4.8.6 REQUIRED QtCore QtGui QtXml QtSvg QtNetwork)
include(${QT_USE_FILE})

set(CMAKE_CXX_FLAGS "-m32")

add_executable(z z.cpp ui.cpp act.cpp)

add_definitions(-DLINTEL)
add_definitions(-DQT_MAJOR_VERSION=4)

include_directories(/home/whc/lintel/qt/4.8.6-shared-debug-ssl-32Bit-NoICU/include)

target_link_libraries(z Qt4::QtCore Qt4::QtGui Qt4::QtXml Qt4::QtSvg Qt4::QtNetwork)



More information about the Interest mailing list