diff options
-rw-r--r-- | modules/KDE3Macros.cmake | 20 | ||||
-rw-r--r-- | modules/KDE4Macros.cmake | 11 | ||||
-rw-r--r-- | modules/UsePkgConfig.cmake | 20 |
3 files changed, 29 insertions, 22 deletions
diff --git a/modules/KDE3Macros.cmake b/modules/KDE3Macros.cmake index eb3f2c01..5924b39d 100644 --- a/modules/KDE3Macros.cmake +++ b/modules/KDE3Macros.cmake @@ -189,13 +189,21 @@ MACRO(KDE3_AUTOMOC) SET(_matching_FILES ) FOREACH (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) + + # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. + # here. this is required to make bouic work correctly: + # we need to add generated .cpp files to the sources (to compile them), + # but we cannot let automoc handle them, as the .cpp files don't exist yet when + # cmake is run for the very first time on them -> however the .cpp files might + # exist at a later run. at that time we need to skip them, so that we don't add two + # different rules for the same moc file + GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) - IF (EXISTS ${_tmp_FILE}) + IF (EXISTS ${_abs_FILE} AND NOT _skip) - FILE(READ ${_tmp_FILE} _contents) + FILE(READ ${_abs_FILE} _contents) - GET_FILENAME_COMPONENT(_abs_FILE ${_tmp_FILE} ABSOLUTE) GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}") @@ -214,12 +222,12 @@ MACRO(KDE3_AUTOMOC) DEPENDS ${_header} ) - MACRO_ADD_FILE_DEPENDENCIES(${_tmp_FILE} ${_moc}) + MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) ENDFOREACH (_current_MOC_INC) ENDIF(_match) - ENDIF (EXISTS ${_tmp_FILE}) + ENDIF (EXISTS ${_abs_FILE} AND NOT _skip) ENDFOREACH (_current_FILE) ENDMACRO(KDE3_AUTOMOC) diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index b34c021d..b6933d26 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -223,13 +223,12 @@ MACRO(KDE4_AUTOMOC) set(_matching_FILES ) foreach (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) - if (EXISTS ${_tmp_FILE}) + if (EXISTS ${_abs_FILE}) - FILE(READ ${_tmp_FILE} _contents) + FILE(READ ${_abs_FILE} _contents) - GET_FILENAME_COMPONENT(_abs_FILE ${_tmp_FILE} ABSOLUTE) GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}") @@ -247,12 +246,12 @@ MACRO(KDE4_AUTOMOC) DEPENDS ${_header} ) - MACRO_ADD_FILE_DEPENDENCIES(${_tmp_FILE} ${_moc}) + MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) endforeach (_current_MOC_INC) endif(_match) - endif (EXISTS ${_tmp_FILE}) + endif (EXISTS ${_abs_FILE}) endforeach (_current_FILE) ENDMACRO(KDE4_AUTOMOC) diff --git a/modules/UsePkgConfig.cmake b/modules/UsePkgConfig.cmake index aafe7942..4490d2c1 100644 --- a/modules/UsePkgConfig.cmake +++ b/modules/UsePkgConfig.cmake @@ -10,18 +10,18 @@ FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config PATHS /usr/local/bin ) MACRO(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) # reset the variables at the beginning - set(${_include_DIR}) - set(${_link_DIR}) - set(${_link_FLAGS}) - set(${_cflags}) + SET(${_include_DIR}) + SET(${_link_DIR}) + SET(${_link_FLAGS}) + SET(${_cflags}) -# if pkg-config has been found - if(PKGCONFIG_EXECUTABLE) + # if pkg-config has been found + IF(PKGCONFIG_EXECUTABLE) EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull ) -# and if the package of interest also exists for pkg-config, then get the information - if(NOT _return_VALUE) + # and if the package of interest also exists for pkg-config, then get the information + IF(NOT _return_VALUE) EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=includedir OUTPUT_VARIABLE ${_include_DIR} ) @@ -31,9 +31,9 @@ MACRO(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags OUTPUT_VARIABLE ${_cflags} ) - endif(NOT _return_VALUE) + ENDIF(NOT _return_VALUE) - endif(PKGCONFIG_EXECUTABLE) + ENDIF(PKGCONFIG_EXECUTABLE) ENDMACRO(PKGCONFIG _include_DIR _link_DIR _link_FLAGS _cflags) |