KDE/kdelibs/cmake

Alexander Neundorf neundorf at kde.org
Tue Jul 8 00:09:59 CEST 2008


SVN commit 829250 by neundorf:

-make automoc4 required finally (... 4.1 is not too far away)

Alex

CCMAIL: kde-buildsystem at kde.org
CCMAIL: kretz at kde.org



 M  +4 -4      CMakeLists.txt  
 M  +10 -37    modules/FindKDE4Internal.cmake  
 M  +4 -81     modules/KDE4Macros.cmake  


--- trunk/KDE/kdelibs/cmake/CMakeLists.txt #829249:829250
@@ -1,8 +1,8 @@
 
-if(NOT AUTOMOC4_EXECUTABLE)
-   # this is just a fallback in case automoc4 from kdesupport isn't found, Alex
-   add_subdirectory(automoc)
-endif(NOT AUTOMOC4_EXECUTABLE)
+#if(NOT AUTOMOC4_EXECUTABLE)
+#   # this is just a fallback in case automoc4 from kdesupport isn't found, Alex
+#   add_subdirectory(automoc)
+#endif(NOT AUTOMOC4_EXECUTABLE)
 
 add_subdirectory(modules)
 
--- trunk/KDE/kdelibs/cmake/modules/FindKDE4Internal.cmake #829249:829250
@@ -16,7 +16,7 @@
 # compile KDE software:
 #
 #  KDE4_KCFGC_EXECUTABLE    - the kconfig_compiler executable
-#  KDE4_AUTOMOC_EXECUTABLE  - the kde4automoc executable
+#  KDE4_AUTOMOC_EXECUTABLE  - the kde4automoc executable, deprecated, use AUTOMOC4_EXECUTABLE instead
 #  KDE4_MEINPROC_EXECUTABLE - the meinproc4 executable
 #  KDE4_MAKEKDEWIDGETS_EXECUTABLE - the makekdewidgets executable
 #
@@ -238,9 +238,10 @@
 #this line includes FindQt4.cmake, which searches the Qt library and headers
 find_package(Qt4 REQUIRED)
 
-# automoc4 (from kdesupport) is not yet required, but will be in June
-# until then still automoc from kdelibs is used as fallback, Alex
-find_package(Automoc4)
+# automoc4 (from kdesupport) is now required, Alex
+find_package(Automoc4 REQUIRED)
+# use automoc4 from kdesupport
+set(KDE4_AUTOMOC_EXECUTABLE        "${AUTOMOC4_EXECUTABLE}" )
 
 # Perl is required for building KDE software,
 find_package(Perl REQUIRED)
@@ -287,26 +288,12 @@
       # CMAKE_CFG_INTDIR is the output subdirectory created e.g. by XCode and MSVC
       set(KDE4_KCFGC_EXECUTABLE          ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler )
 
-      # use automoc4 from kdesupport if it has been found
-      if(AUTOMOC4_EXECUTABLE)
-         set(KDE4_AUTOMOC_EXECUTABLE        "${AUTOMOC4_EXECUTABLE}" )
-      else(AUTOMOC4_EXECUTABLE)
-         set(KDE4_AUTOMOC_EXECUTABLE        ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kde4automoc )
-      endif(AUTOMOC4_EXECUTABLE)
-
       set(KDE4_MEINPROC_EXECUTABLE       ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4 )
       set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets )
    else (WIN32)
       set(LIBRARY_OUTPUT_PATH            ${CMAKE_BINARY_DIR}/lib )
       set(KDE4_KCFGC_EXECUTABLE          ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler.shell )
 
-      # use automoc4 from kdesupport if it has been found
-      if(AUTOMOC4_EXECUTABLE)
-         set(KDE4_AUTOMOC_EXECUTABLE        "${AUTOMOC4_EXECUTABLE}" )
-      else(AUTOMOC4_EXECUTABLE)
-         set(KDE4_AUTOMOC_EXECUTABLE        ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kde4automoc.shell )
-      endif(AUTOMOC4_EXECUTABLE)
-
       set(KDE4_MEINPROC_EXECUTABLE       ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4.shell )
       set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets.shell )
    endif (WIN32)
@@ -318,19 +305,12 @@
    set( _KDE4_MAKEKDEWIDGETS_DEP makekdewidgets)
    set( _KDE4_MEINPROC_EXECUTABLE_DEP meinproc4)
 
-   if(AUTOMOC4_EXECUTABLE)
-      set( _KDE4_AUTOMOC_EXECUTABLE_DEP)
-   else(AUTOMOC4_EXECUTABLE)
-      set( _KDE4_AUTOMOC_EXECUTABLE_DEP kde4automoc)
-   endif(AUTOMOC4_EXECUTABLE)
-
    set(KDE4_INSTALLED_VERSION_OK TRUE)
 
 else (_kdeBootStrapping)
 
   # ... but NOT otherwise
    set( _KDE4_KCONFIG_COMPILER_DEP)
-   set( _KDE4_AUTOMOC_EXECUTABLE_DEP)
    set( _KDE4_MAKEKDEWIDGETS_DEP)
    set( _KDE4_MEINPROC_EXECUTABLE_DEP)
 
@@ -455,13 +435,6 @@
    find_program(KDE4_KCFGC_EXECUTABLE NAME kconfig_compiler PATHS ${KDE4_BIN_INSTALL_DIR} NO_DEFAULT_PATH )
    find_program(KDE4_KCFGC_EXECUTABLE NAME kconfig_compiler )
 
-   if (AUTOMOC4_EXECUTABLE)
-      set(KDE4_AUTOMOC_EXECUTABLE "${AUTOMOC4_EXECUTABLE}")
-   else (AUTOMOC4_EXECUTABLE)
-      find_program(KDE4_AUTOMOC_EXECUTABLE NAME kde4automoc PATHS ${KDE4_BIN_INSTALL_DIR} NO_DEFAULT_PATH )
-      find_program(KDE4_AUTOMOC_EXECUTABLE NAME kde4automoc )
-   endif (AUTOMOC4_EXECUTABLE)
-
    find_program(KDE4_MEINPROC_EXECUTABLE NAME meinproc4 PATHS ${KDE4_BIN_INSTALL_DIR} NO_DEFAULT_PATH )
    find_program(KDE4_MEINPROC_EXECUTABLE NAME meinproc4 )
 
@@ -1091,11 +1064,11 @@
       message(STATUS "Didn't find the KDE4 kconfig_compiler preprocessor")
    endif(KDE4_KCFGC_EXECUTABLE)
 
-   if(KDE4_AUTOMOC_EXECUTABLE)
-      message(STATUS "Found KDE4 automoc: ${KDE4_AUTOMOC_EXECUTABLE}")
-   else(KDE4_AUTOMOC_EXECUTABLE)
-      message(STATUS "Didn't find the KDE4 automoc")
-   endif(KDE4_AUTOMOC_EXECUTABLE)
+   if(AUTOMOC4_EXECUTABLE)
+      message(STATUS "Found automoc4: ${AUTOMOC4_EXECUTABLE}")
+   else(AUTOMOC4_EXECUTABLE)
+      message(STATUS "Didn't find the automoc4")
+   endif(AUTOMOC4_EXECUTABLE)
 endmacro (KDE4_PRINT_RESULTS)
 
 
--- trunk/KDE/kdelibs/cmake/modules/KDE4Macros.cmake #829249:829250
@@ -161,90 +161,13 @@
 
 
 macro (KDE4_MOC_HEADERS _target_NAME)
-   # if automoc4 from kdesupport has been found, use the macro provided there,
-   # otherwise fall back to the kdelibs one
-   if (AUTOMOC4_EXECUTABLE)
-      AUTOMOC4_MOC_HEADERS(${_target_NAME} ${ARGN})
-   else (AUTOMOC4_EXECUTABLE)
-      set (_headers_to_moc)
-      foreach (_current_FILE ${ARGN})
-         get_filename_component(_suffix "${_current_FILE}" EXT)
-         if (".h" STREQUAL "${_suffix}" OR ".hpp" STREQUAL "${_suffix}" OR ".hxx" STREQUAL "${_suffix}" OR ".H" STREQUAL "${_suffix}")
-            list(APPEND _headers_to_moc ${_current_FILE})
-         else (".h" STREQUAL "${_suffix}" OR ".hpp" STREQUAL "${_suffix}" OR ".hxx" STREQUAL "${_suffix}" OR ".H" STREQUAL "${_suffix}")
-            message(STATUS "KDE4_MOC_HEADERS: ignoring non-header file ${_current_FILE}")
-         endif (".h" STREQUAL "${_suffix}" OR ".hpp" STREQUAL "${_suffix}" OR ".hxx" STREQUAL "${_suffix}" OR ".H" STREQUAL "${_suffix}")
-      endforeach (_current_FILE)
-      # need to create moc_<filename>.cpp file using kde4automoc.cmake
-      # and add it to the target
-      if(_headers_to_moc)
-         _kde4_set_custom_target_property(${_target_NAME} AUTOMOC_HEADERS "${_headers_to_moc}")
-      endif(_headers_to_moc)
-   endif (AUTOMOC4_EXECUTABLE)
+   # if automoc4 from kdesupport has been found, use the macro provided there
+   automoc4_moc_headers(${_target_NAME} ${ARGN})
 endmacro (KDE4_MOC_HEADERS)
 
 macro(KDE4_HANDLE_AUTOMOC _target_NAME _SRCS)
-   # if automoc4 from kdesupport has been found, use the macro provided there,
-   # otherwise fall back to the kdelibs one
-   if (AUTOMOC4_EXECUTABLE)
-      AUTOMOC4(${_target_NAME} ${_SRCS})
-   else (AUTOMOC4_EXECUTABLE)
-      set(_moc_files)
-      set(_moc_headers)
-   
-      # first list all explicitly set headers
-      _kde4_get_custom_target_property(_headers_to_moc ${_target_NAME} AUTOMOC_HEADERS)
-      if(NOT _headers_to_moc STREQUAL "NOTFOUND")
-         foreach(_header_to_moc ${_headers_to_moc})
-            get_filename_component(_abs_header ${_header_to_moc} ABSOLUTE)
-            list(APPEND _moc_files ${_abs_header})
-            list(APPEND _moc_headers ${_abs_header})
-         endforeach(_header_to_moc)
-      endif(NOT _headers_to_moc STREQUAL "NOTFOUND")
-   
-      # now add all the sources for the automoc
-      foreach (_current_FILE ${${_SRCS}})
-         get_filename_component(_abs_current_FILE "${_current_FILE}" ABSOLUTE)
-         get_source_file_property(_skip "${_abs_current_FILE}" SKIP_AUTOMOC)
-         get_source_file_property(_generated "${_abs_current_FILE}" GENERATED)
-   
-         if(NOT _generated AND NOT _skip)
-            get_filename_component(_suffix "${_current_FILE}" EXT)
-            # skip every source file that's not C++
-            if(_suffix STREQUAL ".cpp" OR _suffix STREQUAL ".cc" OR _suffix STREQUAL ".cxx" OR _suffix STREQUAL ".C")
-               get_filename_component(_basename "${_current_FILE}" NAME_WE)
-               get_filename_component(_abs_path "${_abs_current_FILE}" PATH)
-               set(_header "${_abs_path}/${_basename}.h")
-               if(EXISTS "${_header}")
-                  list(APPEND _moc_headers ${_header})
-               endif(EXISTS "${_header}")
-               set(_pheader "${_abs_path}/${_basename}_p.h")
-               if(EXISTS "${_pheader}")
-                  list(APPEND _moc_headers ${_pheader})
-               endif(EXISTS "${_pheader}")
-               list(APPEND _moc_files ${_abs_current_FILE})
-            endif(_suffix STREQUAL ".cpp" OR _suffix STREQUAL ".cc" OR _suffix STREQUAL ".cxx" OR _suffix STREQUAL ".C")
-         endif(NOT _generated AND NOT _skip)
-      endforeach (_current_FILE)
-   
-      if(_moc_files)
-         set(_automoc_source "${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_automoc.cpp")
-         get_directory_property(_moc_incs INCLUDE_DIRECTORIES)
-         configure_file(${KDE4_MODULE_DIR}/kde4automoc.files.in ${_automoc_source}.files)
-         add_custom_command(OUTPUT ${_automoc_source}
-            COMMAND ${KDE4_AUTOMOC_EXECUTABLE}
-            ${_automoc_source}
-            ${CMAKE_CURRENT_SOURCE_DIR}
-            ${CMAKE_CURRENT_BINARY_DIR}
-            ${QT_MOC_EXECUTABLE}
-            DEPENDS ${${_SRCS}} ${_moc_headers} ${_automoc_source}.files ${_KDE4_AUTOMOC_EXECUTABLE_DEP}
-            )
-         # the OBJECT_DEPENDS is only necessary when a new moc file has to be generated that is included in a source file
-         # problem: the whole target is recompiled when the automoc.cpp file is touched
-         # set_source_files_properties(${${_SRCS}} PROPERTIES OBJECT_DEPENDS ${_automoc_source})
-         set(${_SRCS} ${_automoc_source} ${${_SRCS}})
-      endif(_moc_files)
-   endif (AUTOMOC4_EXECUTABLE)
+   # if automoc4 from kdesupport has been found, use the macro provided there
+   automoc4(${_target_NAME} ${_SRCS})
 endmacro(KDE4_HANDLE_AUTOMOC)
 
 macro(KDE4_INSTALL_TS_FILES _lang _sdir)


More information about the Kde-buildsystem mailing list