[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    Patch to add two more automoc4 convenience macros
From:       Matthias Kretz <kretz () kde ! org>
Date:       2008-07-29 15:02:52
Message-ID: 200807291702.53030.kretz () kde ! org
[Download RAW message or body]

Hi,

for all the automoc4 users that cannot use KDE4Macros.cmake I'd like to add 
the following two macros:

macro(ADD_AUTOMOC4_EXECUTABLE _target_NAME)
   set(_SRCS ${ARGN})

   set(_add_executable_param)
   foreach(_argName "WIN32" "MACOSX_BUNDLE" "EXCLUDE_FROM_ALL")
      list(GET _SRCS 0 _arg)
      if(_arg STREQUAL _argName)
         list(APPEND _add_executable_param ${_argName})
         list(REMOVE_AT _SRCS 0)
      endif(_arg STREQUAL _argName)
   endforeach(_argName)

   if(MSVC)
      add_automoc4_target("${_target_NAME}_automoc" _SRCS)
   else(MSVC)
      automoc4(${_target_NAME} _SRCS)
   endif(MSVC)
   add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS})
   if(MSVC)
      add_dependencies(${_target_NAME} "${_target_NAME}_automoc")
   endif(MSVC)
endmacro(ADD_AUTOMOC4_EXECUTABLE)

macro(ADD_AUTOMOC4_LIBRARY _target_NAME)
   set(_SRCS ${ARGN})

   set(_add_executable_param)
   foreach(_argName "STATIC" "SHARED" "MODULE" "EXCLUDE_FROM_ALL")
      list(GET _SRCS 0 _arg)
      if(_arg STREQUAL _argName)
         list(APPEND _add_executable_param ${_argName})
         list(REMOVE_AT _SRCS 0)
      endif(_arg STREQUAL _argName)
   endforeach(_argName)

   if(MSVC)
      add_automoc4_target("${_target_NAME}_automoc" _SRCS)
   else(MSVC)
      automoc4(${_target_NAME} _SRCS)
   endif(MSVC)
   add_library(${_target_NAME} ${_add_executable_param} ${_SRCS})
   if(MSVC)
      add_dependencies(${_target_NAME} "${_target_NAME}_automoc")
   endif(MSVC)
endmacro(ADD_AUTOMOC4_LIBRARY)

AFAICS we could then also switch the macros in KDE4Macros.cmake to use this.

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz@gmx.net, kretz@kde.org,
Matthias.Kretz@urz.uni-heidelberg.de

_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic