Conditional installing of proxymodeltestsuite

Alexander Neundorf neundorf at kde.org
Thu Jul 29 18:50:11 CEST 2010


On Thursday 29 July 2010, Stephen Kelly wrote:
> Alexander Neundorf wrote:
>
> Hi,
>
> Thanks for the feedback.
>
> > On Wednesday 28 July 2010, Stephen Kelly wrote:
> >> I guess I should attach the patch.
> >
> > diff --git a/kdeui/tests/proxymodeltestsuite/CMakeLists.txt
> > b/kdeui/tests/proxymodeltestsuite/CMakeLists.txt
> > index 5194511..dc4175e 100644
> > --- a/kdeui/tests/proxymodeltestsuite/CMakeLists.txt
> > +++ b/kdeui/tests/proxymodeltestsuite/CMakeLists.txt
> > @@ -2,11 +2,22 @@ project(proxymodeltestsuite)
> >
> >  set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
> >
> > +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
> > +
> > +  # Building the test suite standalone
> > +  set(proxymodeltestsuite_standalone TRUE)
> >
> > -------------------------------------------------
> > good idea to use a helper variable
> > -------------------------------------------------
> >
> > +
> > +  find_package(Qt4 REQUIRED)
> > +  find_package(Automoc4 REQUIRED)
> > +  cmake_minimum_required(VERSION 2.6.3)
> > +endif()
> > +
> > +include(${QT_USE_FILE})
> >
> > -------------------------------------------------
> > I think you don't need QT_USE_FILE here, I mean, you set the include
> > directories explicitely and you also link against ${QT_QTTEST_LIBRARY},
> > so I think this is not necessary.
>
> Ok. Actually I didn't even know what that does. At some point in Grantlee
> development I needed that to build, so now I put it in all CMake Qt only
> projects.

From the docs for FindQt4.cmake:
"It sets up the compilation environment for include directories, preprocessor 
defines and populates a QT_LIBRARIES variable."

I.e. it does the necessary include_directories() and add_definitions() calls 
and sets up the QT_LIBRARIES variable. You do all that yourself, so it 
shouldn't be necessary.

> > -------------------------------------------------
> >
> >  @@ -51,15 +71,49 @@ if (Grantlee_FOUND)
> >
> >  endif()
> >
> > -kde4_add_library(proxymodeltestsuite SHARED
> > -  ${proxymodeltestsuite_SRCS}
> > -  ${eventlogger_RCS_SRCS}
> > -)
> > +if(proxymodeltestsuite_standalone)
> > +  automoc4_add_library(proxymodeltestsuite SHARED
> > +    ${proxymodeltestsuite_SRCS}
> > +    ${eventlogger_RCS_SRCS}
> > +  )
> > +else ()
> > +  kde4_add_library(proxymodeltestsuite SHARED
> > +    ${proxymodeltestsuite_SRCS}
> > +    ${eventlogger_RCS_SRCS}
> > +  )
> > +endif()
> >
> >
> > -------------------------------------------------
> > If it needs to build correctly also without KDE, I would remove the
> > kde4_add_library() completely and always use the other branch.
> > I just extended the documentation for kde4_add_library() in
> > FindKDE4Internal.cmake a bit.
> > kde4_add_library() adds enable_final (you don't need that), automoc (you
> > already have that),
> >
> > and it sets the LINK_INTERFACE_LIBRARIES property to
> > empty (you may want to do this too).
>
> I'm not sure how.

From kde4_add_library() in kdelibs/cmake/modules/KDE4Macros.cmake (which is 
included by FindKDE4Internal.cmake):
"
   # By default don't add any linked libraries to the "exported"
   # link interfaces, so that executables linking against this library
   # will not automatically add implicit dependencies to their link list.
   #
   # This reduces inter-package dependencies and makes it easier to remove
   # dependencies of shared libraries without breaking binary compatibility.
   if(NOT "${_add_lib_param}" STREQUAL "STATIC")
      set_target_properties(${_target_NAME} PROPERTIES
                            LINK_INTERFACE_LIBRARIES "" )
   endif(NOT "${_add_lib_param}" STREQUAL "STATIC")
"
...

Alex


More information about the Kde-buildsystem mailing list