qt_phonon.pri and QMAKESPEC

Yury G. Kudryashov urkud at ya.ru
Wed Feb 9 22:42:04 CET 2011


Alexander Neundorf wrote:

> On Wednesday 09 February 2011, Yury G. Kudryashov wrote:
>> Offtopic: I'm playing with translating qmake to cmake (mostly to learn
>> cmake). What is the cmake way to do what
>> qt/tools/linguist/shared/formats.pri does?
>>
>> INCLUDEPATH *= $$PWD
>> SOURCES += $$PWD/something.cpp
>> HEADERS += $$PWD/something.h
> 
> I'm not too good with qmake.
> Something like
> 
> include_directories(${CMAKE_CURRENT_SOURCE_DIR})
In qmake this file is used in the following way (say, in 
lrelease/lrelease.pro): include(../shared/formats.pri). If I try to do the 
same (include(../shared/Formats.cmake) with cmake, the 
CMAKE_CURRENT_SOURCE_DIR variable points to lrelease/, not shared/, so cmake 
looks for headers in lrelease/, not shared/.

Let me explain what I want to achieve. I have some code in shared/ that 
should be compiled into several binaries (lrelease etc.). The qmake code 
above just adds these cpp files to sources of all these binaries, just like 
I had

set(myexe_SRCS ... ../shared/something.cpp)
include_directories(../shared)

in each directory. What is the cmake alternative? Create a static library 
and link all these binaries to this library? Does it produce the same 
result?
> 
> Examples for how to use cmake with Qt are e.g. in the cmake wiki:
> http://www.cmake.org/Wiki/CMake#How_to_use_CMake_with_specific_Libraries
> 
> Alex




More information about the Kde-buildsystem mailing list