On Wednesday 09 February 2011, Yury G. Kudryashov wrote:
> 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/.http://www.cmake.org/Wiki/CMake_Useful_Variables#Locations Additionally, if there is a project(SomeName) call in some foo/bar/CMakeLists.txt, then variable SomeName_SOURCE_DIR and SomeName_BINARY_DIR will be defined, which will point to foo/bar/ in the source tree and in the build tree respectibvely. > 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 You can do this too. > 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? Yes. Alex _______________________________________________ Kde-buildsystem mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-buildsystem
