[CMake] CMake with Qt (plus pkg-config)

Micha Renner Micha.Renner at t-online.de
Thu Oct 22 08:40:38 EDT 2009


Okay, we are at the very beginning.

# require at least cmake 2.6
 
project(qlom)	# Should be the first command

cmake_minimum_required(VERSION 2.6 FATAL_ERROR )

 
# Maybe this adds support for moc
# if it is part of Qt 

# This should deliver QT_INCLUDE_DIR and QT_LIBRARIES see the doco (I
don't use QT)
find_package(Qt4 REQUIRED)

include_directories(${QT_INCLUDE_DIR})
 
# No! target_link_libraries($(QT_LIBRARIES))
# No! Or this?: link_directories(${QT4_LIB_DIR})
# Read the documentation
 
# No you don't need pkg-config
# find_package(PkgConfig)
# pkg_check_modules(DEPS glom-1.12 QtGui)
 
SET(QLOM_SOURCES
src/qlom.cc
src/main_window.cc
src/main_window.h
src/glom_model.cc
src/glom_model.h
src/connection_dialog.cc
src/connection_dialog.h
src/glom_layout_model.cc
src/glom_layout_model.h
src/open_sqlite.cc
src/open_sqlite.h
src/utils.cc
src/utils.h)
 
add_executable(qlom ${QLOM_SOURCES})

TARGET_LINK_LIBRARIES(qlom ${QT_LIBRARIES})

That's it.


Greetings
Micha





Am Donnerstag, den 22.10.2009, 12:15 +0200 schrieb Murray Cumming:
> I'm trying to use CMake for the first time, as an experiment, with
> little a Qt-based project. It also uses an additional library, via
> pkg-config.
> 
> So far Qt's include files don't seem to be found, and I wonder how I can
> cause moc to be used to generate some of the .cc files.
> 
> Here's what I have so far:
> http://github.com/murraycu/qlom/blob/qlom_cmake/CMakeLists.txt
> based on the many and varied google results.
> 
> Can anyone give me some clues?
> 
> 



More information about the CMake mailing list