diff options
| -rw-r--r-- | CMakeLists.txt | 6 | ||||
| -rw-r--r-- | automoc/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | automoc/kde4automoc.cpp | 345 | ||||
| -rw-r--r-- | modules/FindAutomoc4.cmake | 48 | ||||
| -rw-r--r-- | modules/FindCarbon.cmake | 8 | ||||
| -rw-r--r-- | modules/FindFFmpeg.cmake | 38 | ||||
| -rw-r--r-- | modules/FindGStreamer.cmake | 17 | ||||
| -rw-r--r-- | modules/FindKDE4Internal.cmake | 170 | ||||
| -rw-r--r-- | modules/FindKDEWIN.cmake | 2 | ||||
| -rw-r--r-- | modules/FindKDEWIN32.cmake | 18 | ||||
| -rw-r--r-- | modules/FindPackageHandleStandardArgs.cmake | 60 | ||||
| -rw-r--r-- | modules/FindSoprano.cmake | 80 | ||||
| -rw-r--r-- | modules/KDE4Defaults.cmake | 4 | ||||
| -rw-r--r-- | modules/KDE4Macros.cmake | 35 | ||||
| -rw-r--r-- | modules/MacroEnsureOutOfSourceBuild.cmake | 4 | ||||
| -rw-r--r-- | modules/MacroOptionalAddSubdirectory.cmake | 6 | ||||
| -rw-r--r-- | modules/potential_problems | 2 | 
17 files changed, 269 insertions, 579 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a4b45da..a89a38bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,4 @@ - -#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) +# automoc comes now from kdesupport, Alex  add_subdirectory(modules) diff --git a/automoc/CMakeLists.txt b/automoc/CMakeLists.txt deleted file mode 100644 index 553aa1af..00000000 --- a/automoc/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -include_directories(${QT_INCLUDE_DIR}) -add_executable(kde4automoc kde4automoc.cpp) -kde4_handle_rpath_for_executable(kde4automoc "RUN_UNINSTALLED") -target_link_libraries(kde4automoc ${QT_QTCORE_LIBRARY}) -install(TARGETS kde4automoc DESTINATION ${BIN_INSTALL_DIR}) diff --git a/automoc/kde4automoc.cpp b/automoc/kde4automoc.cpp deleted file mode 100644 index 68ccdbdb..00000000 --- a/automoc/kde4automoc.cpp +++ /dev/null @@ -1,345 +0,0 @@ -/*  This file is part of the KDE project -    Copyright (C) 2007 Matthias Kretz <kretz@kde.org> - -    This program is free software; you can redistribute it and/or -    modify it under the terms of the GNU General Public License as -    published by the Free Software Foundation; either version 2 of -    the License, or (at your option) any later version. - -    This program is distributed in the hope that it will be useful, -    but WITHOUT ANY WARRANTY; without even the implied warranty of -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -    GNU General Public License for more details. - -    You should have received a copy of the GNU General Public License -    along with this program; if not, write to the Free Software -    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -    02110-1301, USA. - -*/ - -#include <QtCore/QCoreApplication> -#include <QtCore/QDateTime> -#include <QtCore/QFile> -#include <QtCore/QFileInfo> -#include <QtCore/QHash> -#include <QtCore/QProcess> -#include <QtCore/QQueue> -#include <QtCore/QRegExp> -#include <QtCore/QStringList> -#include <QtCore/QTextStream> -#include <QtCore/QtDebug> -#include <cstdlib> - -class AutoMoc -{ -    public: -        AutoMoc(); -        bool run(); - -    private: -        void generateMoc(const QString &sourceFile, const QString &mocFileName); -        void waitForProcesses(); -        void usage(const QString &); -        void echoColor(const QString &msg) -        { -            QProcess *cmakeEcho = new QProcess; -            cmakeEcho->setProcessChannelMode(QProcess::ForwardedChannels); -            QStringList args(cmakeEchoColorArgs); -            args << msg; -            cmakeEcho->start(QLatin1String("cmake"), args, QIODevice::NotOpen); -            processes.enqueue(Process(cmakeEcho, QString())); -        } - -        QString builddir; -        QString mocExe; -        QStringList mocIncludes; -        QStringList cmakeEchoColorArgs; -        const bool verbose; -        QTextStream cerr; -        QTextStream cout; -        struct Process -        { -            Process(QProcess *a, const QString &b) : qproc(a), mocFilePath(b) {} -            QProcess *qproc; -            QString mocFilePath; -        }; -        QQueue<Process> processes; -        bool failed; -}; - -void AutoMoc::usage(const QString &path) -{ -    cout << "usage: " << path << " <outfile> <srcdir> <builddir> <moc executable>" << endl; -    ::exit(EXIT_FAILURE); -} - -int main(int argc, char **argv) -{ -    QCoreApplication app(argc, argv); -    if (!AutoMoc().run()) { -        return EXIT_FAILURE; -    } -    return 0; -} - -AutoMoc::AutoMoc() -    : verbose(!qgetenv("VERBOSE").isEmpty()), cerr(stderr), cout(stdout), failed(false) -{ -    const QByteArray colorEnv = qgetenv("COLOR"); -    cmakeEchoColorArgs << QLatin1String("-E") << QLatin1String("cmake_echo_color")  -        << QLatin1String("--switch=") + colorEnv << QLatin1String("--blue") -        << QLatin1String("--bold"); -} - -bool AutoMoc::run() -{ -    const QStringList args = QCoreApplication::arguments(); -    Q_ASSERT(args.size() > 0); -    if (args.size() < 4) { -        usage(args[0]); -    } -    QFile outfile(args[1]); -    const QFileInfo outfileInfo(outfile); - -    QString srcdir(args[2]); -    if (!srcdir.endsWith('/')) { -        srcdir += '/'; -    } -    builddir = args[3]; -    if (!builddir.endsWith('/')) { -        builddir += '/'; -    } -    mocExe = args[4]; - -    QFile dotFiles(args[1] + ".files"); -    dotFiles.open(QIODevice::ReadOnly | QIODevice::Text); -    QByteArray line = dotFiles.readLine(); -    Q_ASSERT(line == "MOC_INCLUDES:\n"); -    line = dotFiles.readLine().trimmed(); -    const QStringList incPaths = QString::fromUtf8(line).split(';'); -    foreach (const QString &path, incPaths) { -        if (!path.isEmpty()) { -            mocIncludes << "-I" + path; -        } -    } -    line = dotFiles.readLine(); -    Q_ASSERT(line == "SOURCES:\n"); -    line = dotFiles.readLine().trimmed(); -    dotFiles.close(); -    const QStringList sourceFiles = QString::fromUtf8(line).split(';'); - -    // the program goes through all .cpp files to see which moc files are included. It is not really -    // interesting how the moc file is named, but what file the moc is created from. Once a moc is -    // included the same moc may not be included in the _automoc.cpp file anymore. OTOH if there's a -    // header containing Q_OBJECT where no corresponding moc file is included anywhere a -    // moc_<filename>.cpp file is created and included in the _automoc.cpp file. -    QHash<QString, QString> includedMocs;    // key = moc source filepath, value = moc output filepath -    QHash<QString, QString> notIncludedMocs; // key = moc source filepath, value = moc output filename - -    QRegExp mocIncludeRegExp(QLatin1String("[\n]\\s*#\\s*include\\s+[\"<](moc_[^ \">]+\\.cpp|[^ \">]+\\.moc)[\">]")); -    QRegExp qObjectRegExp(QLatin1String("[\n]\\s*Q_OBJECT\\b")); -    QStringList headerExtensions; -    headerExtensions << ".h" << ".hpp" << ".hxx" << ".H"; -    foreach (const QString &absFilename, sourceFiles) { -        //qDebug() << absFilename; -        const QFileInfo sourceFileInfo(absFilename); -        if (absFilename.endsWith(".cpp") || absFilename.endsWith(".cc") || -                absFilename.endsWith(".cxx") || absFilename.endsWith(".C")) { -            //qDebug() << "check .cpp file"; -            QFile sourceFile(absFilename); -            sourceFile.open(QIODevice::ReadOnly); -            const QByteArray contents = sourceFile.readAll(); -            if (contents.isEmpty()) { -                cerr << "kde4automoc: empty source file: " << absFilename << endl; -                continue; -            } -            const QString contentsString = QString::fromUtf8(contents); -            const QString absPath = sourceFileInfo.absolutePath() + '/'; -            Q_ASSERT(absPath.endsWith('/')); -            int matchOffset = mocIncludeRegExp.indexIn(contentsString); -            if (matchOffset < 0) { -                // no moc #include, look whether we need to create a moc from the .h nevertheless -                //qDebug() << "no moc #include in the .cpp file"; -                const QString basename = sourceFileInfo.completeBaseName(); -                const QString headername = absPath + basename + ".h"; -                if (QFile::exists(headername) && !includedMocs.contains(headername) && -                        !notIncludedMocs.contains(headername)) { -                    const QString currentMoc = "moc_" + basename + ".cpp"; -                    QFile header(headername); -                    header.open(QIODevice::ReadOnly); -                    const QByteArray contents = header.readAll(); -                    if (qObjectRegExp.indexIn(QString::fromUtf8(contents)) >= 0) { -                        //qDebug() << "header contains Q_OBJECT macro"; -                        notIncludedMocs.insert(headername, currentMoc); -                    } -                } -                const QString privateHeaderName = absPath + basename + "_p.h"; -                if (QFile::exists(privateHeaderName) && !includedMocs.contains(privateHeaderName) && -                        !notIncludedMocs.contains(privateHeaderName)) { -                    const QString currentMoc = "moc_" + basename + "_p.cpp"; -                    QFile header(privateHeaderName); -                    header.open(QIODevice::ReadOnly); -                    const QByteArray contents = header.readAll(); -                    if (qObjectRegExp.indexIn(QString::fromUtf8(contents)) >= 0) { -                        //qDebug() << "header contains Q_OBJECT macro"; -                        notIncludedMocs.insert(privateHeaderName, currentMoc); -                    } -                } -            } else { -                do { // call this for every moc include in the file -                    const QString currentMoc = mocIncludeRegExp.cap(1); -                    //qDebug() << "found moc include: " << currentMoc << " at offset " << matchOffset; -                    QString basename = QFileInfo(currentMoc).completeBaseName(); -                    const bool moc_style = currentMoc.startsWith("moc_"); -                    if (moc_style || qObjectRegExp.indexIn(contentsString) < 0) { -                        if (moc_style) { -                            basename = basename.right(basename.length() - 4); -                        } -                        bool headerFound = false; -                        foreach (const QString &ext, headerExtensions) { -                            QString sourceFilePath = absPath + basename + ext; -                            if (QFile::exists(sourceFilePath)) { -                                headerFound = true; -                                includedMocs.insert(sourceFilePath, currentMoc); -                                notIncludedMocs.remove(sourceFilePath); -                                break; -                            } -                        } -                        if (!headerFound) { -                                cerr << "kde4automoc: The file \"" << absFilename << -                                    "\" includes the moc file \"" << currentMoc << "\", but \"" << -                                    absPath + basename + "{" + headerExtensions.join(",") + "}" << -                                    "\" do not exist." << endl; -                                ::exit(EXIT_FAILURE); -                        } -                    } else { -                        includedMocs.insert(absFilename, currentMoc); -                        notIncludedMocs.remove(absFilename); -                    } - -                    matchOffset = mocIncludeRegExp.indexIn(contentsString, -                            matchOffset + currentMoc.length()); -                } while(matchOffset >= 0); -            } -        } else if (absFilename.endsWith(".h") || absFilename.endsWith(".hpp") || -                absFilename.endsWith(".hxx") || absFilename.endsWith(".H")) { -            if (!includedMocs.contains(absFilename) && !notIncludedMocs.contains(absFilename)) { -                // if this header is not getting processed yet and is explicitly mentioned for the -                // automoc the moc is run unconditionally on the header and the resulting file is -                // included in the _automoc.cpp file (unless there's a .cpp file later on that -                // includes the moc from this header) -                const QString currentMoc = "moc_" + sourceFileInfo.completeBaseName() + ".cpp"; -                notIncludedMocs.insert(absFilename, currentMoc); -            } -        } else { -            if (verbose) { -               cout << "kde4automoc: ignoring file '" << absFilename << "' with unknown suffix" << endl; -            } -        } -    } - -    // run moc on all the moc's that are #included in source files -    QHash<QString, QString>::ConstIterator end = includedMocs.constEnd(); -    QHash<QString, QString>::ConstIterator it = includedMocs.constBegin(); -    for (; it != end; ++it) { -        generateMoc(it.key(), it.value()); -    } - -    QByteArray automocSource; -    QTextStream outStream(&automocSource, QIODevice::WriteOnly); -    outStream << "/* This file is autogenerated, do not edit */\n"; - -    if (notIncludedMocs.isEmpty()) { -        outStream << "enum some_compilers { need_more_than_nothing };\n"; -    } else { -        // run moc on the remaining headers and include them in the _automoc.cpp file -        end = notIncludedMocs.constEnd(); -        it = notIncludedMocs.constBegin(); -        for (; it != end; ++it) { -            generateMoc(it.key(), it.value()); -            outStream << "#include \"" << it.value() << "\"\n"; -        } -    } - -    // let all remaining moc processes finish -    waitForProcesses(); - -    if (failed) { -        // if any moc process failed we don't want to touch the _automoc.cpp file so that -        // kde4automoc is rerun until the issue is fixed -        cerr << "returning failed.."<< endl; -        return false; -    } -    outStream.flush(); - -    // source file that includes all remaining moc files -    outfile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); -    outfile.write(automocSource); -    outfile.close(); - -    return true; -} - -void AutoMoc::waitForProcesses() -{ -    while (!processes.isEmpty()) { -        Process proc = processes.dequeue(); - -        bool result = proc.qproc->waitForFinished(-1); -        //ignore errors from the cmake echo process -        if (!proc.mocFilePath.isEmpty()) { -            if (!result || proc.qproc->exitCode()) { -                cerr << "kde4automoc: process for " << proc.mocFilePath -                     << " failed: " << proc.qproc->errorString() << endl; -                cerr << "pid to wait for: " << proc.qproc->pid() << endl; -                cerr << "processes in queue: " << processes.size() << endl; -                failed = true; -                QFile::remove(proc.mocFilePath); -            } -        } -        delete proc.qproc; -    } -} - -void AutoMoc::generateMoc(const QString &sourceFile, const QString &mocFileName) -{ -    //qDebug() << Q_FUNC_INFO << sourceFile << mocFileName; -    const QString mocFilePath = builddir + mocFileName; -    if (QFileInfo(mocFilePath).lastModified() < QFileInfo(sourceFile).lastModified()) { -        if (verbose) { -            echoColor("Generating " + mocFilePath + " from " + sourceFile); -        } else { -            echoColor("Generating " + mocFileName); -        } - -        // we don't want too many child processes -#ifdef Q_OS_FREEBSD -	static const int max_processes = 0; -#else -	static const int max_processes = 10; -#endif -	 -        if (processes.size() > max_processes) { -            waitForProcesses(); -        } - -        QProcess *mocProc = new QProcess; -        mocProc->setProcessChannelMode(QProcess::ForwardedChannels); -        QStringList args(mocIncludes); -#ifdef Q_OS_WIN -        args << "-DWIN32"; -#endif -        args << QLatin1String("-o") << mocFilePath << sourceFile; -        //qDebug() << "executing: " << mocExe << args; -        mocProc->start(mocExe, args, QIODevice::NotOpen); -        if (mocProc->waitForStarted()) -            processes.enqueue(Process(mocProc, mocFilePath)); -        else { -            cerr << "kde4automoc: process for " << mocFilePath << "failed to start: "  -                 << mocProc->errorString() << endl; -            failed = true; -            delete mocProc; -        } -    } -} diff --git a/modules/FindAutomoc4.cmake b/modules/FindAutomoc4.cmake index 88a34ce1..5cf75627 100644 --- a/modules/FindAutomoc4.cmake +++ b/modules/FindAutomoc4.cmake @@ -17,46 +17,40 @@  # Redistribution and use is allowed according to the terms of the BSD license.  # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# check if we are inside KDESupport and automoc is enabled +# enable the code below again when cmake also searches in lib64/ (should be 2.6.2), Alex +# # check if we are inside KDESupport and automoc is enabled +# if("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") +#    # when building this project as part of kdesupport +#    include("${KDESupport_SOURCE_DIR}/automoc/Automoc4Config.cmake") +# else("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") +#    # when building this project outside kdesupport +#    # use the new "config-mode" of cmake 2.6, which searches the installed Automoc4Config.cmake file +#    # see the man page for details +#    find_package(Automoc4 QUIET NO_MODULE) +# endif("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") +  if("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")     # when building this project as part of kdesupport     set(AUTOMOC4_CONFIG_FILE "${KDESupport_SOURCE_DIR}/automoc/Automoc4Config.cmake")  else("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")     # when building this project outside kdesupport -     # CMAKE_[SYSTEM_]PREFIX_PATH exists starting with cmake 2.6.0     file(TO_CMAKE_PATH "$ENV{CMAKE_PREFIX_PATH}" _env_CMAKE_PREFIX_PATH)     file(TO_CMAKE_PATH "$ENV{CMAKE_LIBRARY_PATH}" _env_CMAKE_LIBRARY_PATH) -     set(AUTOMOC4_SEARCH_PATHS -             ${_env_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${CMAKE_SYSTEM_PREFIX_PATH} -             ${_env_CMAKE_LIBRARY_PATH} ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} -             ${CMAKE_INSTALL_PREFIX}) - +       ${_env_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${CMAKE_SYSTEM_PREFIX_PATH} +       ${_env_CMAKE_LIBRARY_PATH} ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} +       ${CMAKE_INSTALL_PREFIX} +       )     find_file(AUTOMOC4_CONFIG_FILE NAMES Automoc4Config.cmake -             PATH_SUFFIXES automoc4 lib/automoc4 lib64/automoc4 -             PATHS ${AUTOMOC4_SEARCH_PATHS} -             NO_DEFAULT_PATH ) +                                  PATH_SUFFIXES automoc4 lib/automoc4 lib64/automoc4 +                                  PATHS ${AUTOMOC4_SEARCH_PATHS} +                                  NO_DEFAULT_PATH )  endif("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") -  if(AUTOMOC4_CONFIG_FILE)     include(${AUTOMOC4_CONFIG_FILE}) -   set(AUTOMOC4_FOUND TRUE) -else(AUTOMOC4_CONFIG_FILE) -   set(AUTOMOC4_FOUND FALSE)  endif(AUTOMOC4_CONFIG_FILE) -if (AUTOMOC4_FOUND) -   if (NOT Automoc4_FIND_QUIETLY) -      message(STATUS "Found Automoc4: ${AUTOMOC4_EXECUTABLE}") -   endif (NOT Automoc4_FIND_QUIETLY) -else (AUTOMOC4_FOUND) -   if (Automoc4_FIND_REQUIRED) -      message(FATAL_ERROR "Did not find Automoc4Config.cmake (part of kdesupport). Searched in ${AUTOMOC4_SEARCH_PATHS} using suffixes automoc4 lib/automoc4 lib64/automoc4.") -   else (Automoc4_FIND_REQUIRED) -      if (NOT Automoc4_FIND_QUIETLY) -         message(STATUS "Did not find Automoc4Config.cmake (part of kdesupport). Searched in ${AUTOMOC4_SEARCH_PATHS} using suffixes automoc4 lib/automoc4 lib64/automoc4.") -      endif (NOT Automoc4_FIND_QUIETLY) -   endif (Automoc4_FIND_REQUIRED) -endif (AUTOMOC4_FOUND) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Automoc4 "Did not find automoc4 (part of kdesupport). Searched for Automoc4Config.cmake in ${AUTOMOC4_SEARCH_PATHS} using suffixes automoc4 lib/automoc4 lib64/automoc4." AUTOMOC4_EXECUTABLE) diff --git a/modules/FindCarbon.cmake b/modules/FindCarbon.cmake index de788f74..2b0d979e 100644 --- a/modules/FindCarbon.cmake +++ b/modules/FindCarbon.cmake @@ -8,11 +8,15 @@  # Redistribution and use is allowed according to the terms of the BSD license.  # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -INCLUDE(CMakeFindFrameworks) +include(CMakeFindFrameworks) -CMAKE_FIND_FRAMEWORKS(Carbon) +cmake_find_frameworks(Carbon)  if (Carbon_FRAMEWORKS)     set(CARBON_LIBRARY "-framework Carbon" CACHE FILEPATH "Carbon framework" FORCE)     set(CARBON_FOUND 1)  endif (Carbon_FRAMEWORKS) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Carbon DEFAULT_MSG CARBON_LIBRARY) + diff --git a/modules/FindFFmpeg.cmake b/modules/FindFFmpeg.cmake index 8baf0af7..16233510 100644 --- a/modules/FindFFmpeg.cmake +++ b/modules/FindFFmpeg.cmake @@ -17,13 +17,14 @@ if (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS)    set(FFMPEG_FOUND TRUE)  else (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) -IF (NOT WIN32) + +if (NOT WIN32)    # use pkg-config to get the directories and then use these values    # in the FIND_PATH() and FIND_LIBRARY() calls -  INCLUDE(UsePkgConfig) +  include(UsePkgConfig) -  PKGCONFIG(libavcodec _FFMPEGIncDir _FFMPEGLinkDir _FFMPEGLinkFlags _FFMPEGCflags) -ENDIF (NOT WIN32) +  pkgconfig(libavcodec _FFMPEGIncDir _FFMPEGLinkDir _FFMPEGLinkFlags _FFMPEGCflags) +endif (NOT WIN32)    #set(FFMPEG_DEFINITIONS ${_FFMPEGCflags})    # @@ -39,6 +40,15 @@ ENDIF (NOT WIN32)      NO_DEFAULT_PATH    ) +  # also search for the old style include dir, just for the purpose +  # of giving a useful error message if an old libavcodec is installed +  # and the user might wonder why it is not found +  find_path(FFMPEG_INCLUDE_DIR_OLD_STYLE ffmpeg/avcodec.h +    PATHS +    ${_FFMPEGIncDir} +    NO_DEFAULT_PATH +  ) +    find_library(AVCODEC_LIBRARIES NAMES avcodec      PATHS      ${_FFMPEGLinkDir} @@ -70,21 +80,33 @@ ENDIF (NOT WIN32)      set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVUTIL_LIBRARIES})    endif (AVUTIL_LIBRARIES) -  if (FFMPEG_LIBRARIES) +  if (FFMPEG_LIBRARIES  AND  FFMPEG_INCLUDE_DIR)       set(FFMPEG_FOUND TRUE) -  endif (FFMPEG_LIBRARIES) +  endif (FFMPEG_LIBRARIES  AND  FFMPEG_INCLUDE_DIR)    if (FFMPEG_FOUND)      if (NOT FFmpeg_FIND_QUIETLY)        message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES} ${FFMPEG_INCLUDE_DIR}")      endif (NOT FFmpeg_FIND_QUIETLY)    else (FFMPEG_FOUND) +    # only an old libavcodec was found ? +    if (FFMPEG_INCLUDE_DIR_OLD_STYLE  AND NOT  FFMPEG_INCLUDE_DIR  AND NOT  FFmpeg_FIND_QUIETLY) +      message(STATUS "Found old version of libavcodec, but a newer version is required.") +    endif (FFMPEG_INCLUDE_DIR_OLD_STYLE  AND NOT  FFMPEG_INCLUDE_DIR  AND NOT  FFmpeg_FIND_QUIETLY) +      if (FFmpeg_FIND_REQUIRED)        message(FATAL_ERROR "Could NOT find FFMPEG") +    else (FFmpeg_FIND_REQUIRED) +      if (NOT FFmpeg_FIND_QUIETLY) +        message(STATUS "Could NOT find FFMPEG") +      endif (NOT FFmpeg_FIND_QUIETLY)      endif (FFmpeg_FIND_REQUIRED)    endif (FFMPEG_FOUND) -  MARK_AS_ADVANCED(FFMPEG_LIBRARIES) -  MARK_AS_ADVANCED(FFMPEG_INCLUDE_DIR) +  mark_as_advanced(AVCODEC_LIBRARIES  +                   AVFORMAT_LIBRARIES +                   AVUTIL_LIBRARIES +                   FFMPEG_INCLUDE_DIR +                   FFMPEG_INCLUDE_DIR_OLD_STYLE)  endif (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) diff --git a/modules/FindGStreamer.cmake b/modules/FindGStreamer.cmake index f75e92d9..5a94452b 100644 --- a/modules/FindGStreamer.cmake +++ b/modules/FindGStreamer.cmake @@ -68,20 +68,7 @@ ELSE (GSTREAMER_INTERFACE_LIBRARY)     MESSAGE(STATUS "GStreamer: WARNING: interface library not found")  ENDIF (GSTREAMER_INTERFACE_LIBRARY) -IF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) -   SET(GSTREAMER_FOUND TRUE) -ELSE (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) -   SET(GSTREAMER_FOUND FALSE) -ENDIF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) - -IF (GSTREAMER_FOUND) -   IF (NOT GStreamer_FIND_QUIETLY) -      MESSAGE(STATUS "Found GStreamer: ${GSTREAMER_LIBRARIES}") -   ENDIF (NOT GStreamer_FIND_QUIETLY) -ELSE (GSTREAMER_FOUND) -   IF (GStreamer_FIND_REQUIRED) -      MESSAGE(SEND_ERROR "Could NOT find GStreamer") -   ENDIF (GStreamer_FIND_REQUIRED) -ENDIF (GSTREAMER_FOUND) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer  DEFAULT_MSG  GSTREAMER_LIBRARIES GSTREAMER_INCLUDE_DIR GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY)  MARK_AS_ADVANCED(GSTREAMER_INCLUDE_DIR GSTREAMER_LIBRARIES GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY) diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index 70ce60ac..f3a1d93c 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -216,6 +216,12 @@  #  without going all over the place, but still produce better performance.  #  It's also important to note that gcc cannot detect all warning conditions  #  unless the optimiser is active. +# +#  This module allows to depend on a particular minimum version of kdelibs. +#  To acomplish that one should use the apropriate cmake syntax for +#  find_package. For example to depend on kdelibs >= 4.1.0 one should use +# +#  find_package(KDE4 4.1.0 REQUIRED)  #  _KDE4_PLATFORM_INCLUDE_DIRS is used only internally  #  _KDE4_PLATFORM_DEFINITIONS is used only internally @@ -228,26 +234,23 @@  # this is required now by cmake 2.6 and so must not be skipped by if(KDE4_FOUND) below -cmake_minimum_required(VERSION 2.4.5 FATAL_ERROR) - -# cmake 2.5, i.e. the cvs version between 2.4 and 2.6, is not supported -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.5") -   message(FATAL_ERROR "You are using CMake 2.5, which was the unreleased development version between 2.4 and 2.6. This is no longer supported. Please update to CMake 2.6 or current cvs HEAD.") -endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.5") +cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR) +# this second call will never fail +# it is here for the effect that it sets the cmake policies to the 2.4.x compatibility settings for now +cmake_minimum_required(VERSION 2.4.5)  # CMake 2.6, set compatibility behaviour to cmake 2.4  # this must be executed always, because the CMAKE_MINIMUM_REQUIRED() command above  # resets the policy settings, so we get a lot of warnings -if(COMMAND CMAKE_POLICY) -   # CMP0000: don't require cmake_minimum_version() directly in the top level CMakeLists.txt, FindKDE4Internal.cmake is good enough -   cmake_policy(SET CMP0000 OLD) -   # CMP0002: in KDE4 we have multiple targets with the same name for the unit tests -   cmake_policy(SET CMP0002 OLD) -   # CMP0003: add the link paths to the link command as with cmake 2.4 -   cmake_policy(SET CMP0003 OLD) -   # CMP0005: keep escaping behaviour for definitions added via add_definitions() -   cmake_policy(SET CMP0005 OLD) -endif(COMMAND CMAKE_POLICY) + +# CMP0000: don't require cmake_minimum_version() directly in the top level CMakeLists.txt, FindKDE4Internal.cmake is good enough +cmake_policy(SET CMP0000 OLD) +# CMP0002: in KDE4 we have multiple targets with the same name for the unit tests +cmake_policy(SET CMP0002 OLD) +# CMP0003: add the link paths to the link command as with cmake 2.4 +cmake_policy(SET CMP0003 OLD) +# CMP0005: keep escaping behaviour for definitions added via add_definitions() +cmake_policy(SET CMP0005 OLD)  # Only do something if it hasn't been found yet @@ -262,17 +265,15 @@ find_package(Qt4 REQUIRED)  # automoc4 (from kdesupport) is now required, Alex  find_package(Automoc4 REQUIRED) -if (CMAKE_MAJOR_VERSION GREATER 4) -   # cmake 2.6.0 and automoc4 0.9.83 didn't add the necessary definitions for backends to moc calls -   if (NOT AUTOMOC4_VERSION) -      # the version macro was added for 0.9.84 -      set(AUTOMOC4_VERSION "0.9.83") -   endif (NOT AUTOMOC4_VERSION) -   macro_ensure_version("0.9.84" "${AUTOMOC4_VERSION}" _automoc4_version_ok) -   if (NOT _automoc4_version_ok) -      message(FATAL_ERROR "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.84") -   endif (NOT _automoc4_version_ok) -endif (CMAKE_MAJOR_VERSION GREATER 4) +# cmake 2.6.0 and automoc4 < 0.9.84 don't work right for -D flags +if (NOT AUTOMOC4_VERSION) +   # the version macro was added for 0.9.84 +   set(AUTOMOC4_VERSION "0.9.83") +endif (NOT AUTOMOC4_VERSION) +macro_ensure_version("0.9.84" "${AUTOMOC4_VERSION}" _automoc4_version_ok) +if (NOT _automoc4_version_ok) +   message(FATAL_ERROR "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.84") +endif (NOT _automoc4_version_ok)  # use automoc4 from kdesupport  set(KDE4_AUTOMOC_EXECUTABLE        "${AUTOMOC4_EXECUTABLE}" ) @@ -357,7 +358,25 @@ else (_kdeBootStrapping)        # we need at least this version:        if (NOT KDE_MIN_VERSION) -         set(KDE_MIN_VERSION "3.9.0") +         if (KDE4_FIND_VERSION_MAJOR) +            message("${KDE4_FIND_VERSION_MAJOR}") +            if (${KDE4_FIND_VERSION_MAJOR} EQUAL 4) +               if (KDE4_FIND_VERSION_MINOR) +                 set(KDE_MIN_VERSION "4.${KDE4_FIND_VERSION_MINOR}") +               else (KDE4_FIND_VERSION_MINOR) +                 set(KDE_MIN_VERSION "4.0") +               endif (KDE4_FIND_VERSION_MINOR) +               if (KDE4_FIND_VERSION_PATCH) +                  set(KDE_MIN_VERSION "${KDE_MIN_VERSION}.${KDE4_FIND_VERSION_PATCH}") +               else (KDE4_FIND_VERSION_PATCH) +                  set(KDE_MIN_VERSION "${KDE_MIN_VERSION}.0") +               endif (KDE4_FIND_VERSION_PATCH) +            else (${KDE4_FIND_VERSION_MAJOR} EQUAL 4) +               message(FATAL_ERROR "FindKDE4 can only be used with KDE 4") +            endif (${KDE4_FIND_VERSION_MAJOR} EQUAL 4) +         else (KDE4_FIND_VERSION_MAJOR) +            set (KDE_MIN_VERSION "4.0.0") +         endif (KDE4_FIND_VERSION_MAJOR)        endif (NOT KDE_MIN_VERSION)        #message(STATUS "KDE_MIN_VERSION=${KDE_MIN_VERSION}  found ${KDEVERSION}") @@ -506,25 +525,32 @@ option(KDE4_ENABLE_FINAL "Enable final all-in-one compilation")  option(KDE4_BUILD_TESTS  "Build the tests")  option(KDE4_ENABLE_HTMLHANDBOOK  "Create targets htmlhandbook for creating the html versions of the docbook docs") -# This option enables the reduced link interface for libs on UNIX -# -# The purpose of the KDE4_DISABLE_PROPERTY_ variable is to be used as a prefix for  -# the target property LINK_INTERFACE_LIBRARIES. If it is empty, the property will have its -# correct name, if it's not empty, it will be a different name, i.e. the actual property -# will not be set, i.e. disabled. See kdelibs/kdecore/CMakeLists.txt for an example. -# -# By default (i.e. also for Windows) make it non-empty, so the property name will  -# change from "LINK_INTERFACE_LIBRARIES" to "DISABLED_LINK_INTERFACE_LIBRARIES",  -# which is a different (non-existing) target property, and so setting that property  -# won't have an effect -set(KDE4_DISABLE_PROPERTY_ "DISABLED_") +# Remove this below once it's sure it really works, Alex + +# # This option enables the reduced link interface for libs on UNIX +# # +# # The purpose of the KDE4_DISABLE_PROPERTY_ variable is to be used as a prefix for  +# # the target property LINK_INTERFACE_LIBRARIES. If it is empty, the property will have its +# # correct name, if it's not empty, it will be a different name, i.e. the actual property +# # will not be set, i.e. disabled. See kdelibs/kdecore/CMakeLists.txt for an example. +# # +# # By default (i.e. also for Windows) make it non-empty, so the property name will  +# # change from "LINK_INTERFACE_LIBRARIES" to "DISABLED_LINK_INTERFACE_LIBRARIES",  +# # which is a different (non-existing) target property, and so setting that property  +# # won't have an effect + +# disable this for now for Windows, since there is an issue with the use of "debug" and +# "optimized" in the LINK_INTERFACE_LIBRARIES target property, Alex +if (WIN32) +   set(KDE4_DISABLE_PROPERTY_ "DISABLED_") +endif(WIN32) -option(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT "Enable the experimental reduced library exports" FALSE) -# If enabled, make it empty, so the property will keep it's actual name. -# and the LINK_INTERFACE_LIBRARIES property will be set. -if (KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT) -   set(KDE4_DISABLE_PROPERTY_ ) -endif (KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT) +# option(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT "Enable the experimental reduced library exports" FALSE) +# # If enabled, make it empty, so the property will keep it's actual name. +# # and the LINK_INTERFACE_LIBRARIES property will be set. +# if (KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT) +#    set(KDE4_DISABLE_PROPERTY_ ) +# endif (KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT)  if( KDE4_ENABLE_FINAL) @@ -537,7 +563,19 @@ endif(KDE4_ENABLE_FINAL)  # info from "http://www.linuxfromscratch.org/hlfs/view/unstable/glibc/chapter02/pie.html"  option(KDE4_ENABLE_FPIE  "Enable platform supports PIE linking") -set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) +# If we are building ! kdelibs, check where kdelibs are installed. +# If they are installed in a directory which contains "lib64", we default to "64" for LIB_SUFFIX, +# so the current project will by default also go into lib64. +# The same for lib32. Alex +set(_Init_LIB_SUFFIX "") +if ("${KDE4_LIB_DIR}" MATCHES lib64) +   set(_Init_LIB_SUFFIX 64) +endif ("${KDE4_LIB_DIR}" MATCHES lib64) +if ("${KDE4_LIB_DIR}" MATCHES lib32) +   set(_Init_LIB_SUFFIX 32) +endif ("${KDE4_LIB_DIR}" MATCHES lib32) + +set(LIB_SUFFIX "${_Init_LIB_SUFFIX}" CACHE STRING "Define suffix of directory name (32/64)" )  ########## the following are directories where stuff will be installed to  ########### @@ -687,40 +725,24 @@ set(INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION "${BIN_INSTALL_DIR}"  # on the Mac support an extra install directory for application bundles starting with cmake 2.6  if(APPLE) -   if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER "2.5") -      set(INSTALL_TARGETS_DEFAULT_ARGS  ${INSTALL_TARGETS_DEFAULT_ARGS} -                                  BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" ) -   endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER "2.5") +   set(INSTALL_TARGETS_DEFAULT_ARGS  ${INSTALL_TARGETS_DEFAULT_ARGS} +                               BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" )  endif(APPLE)  ##############  add some more default search paths  ###############  # -# always search in the directory where cmake is installed  -# and in the current installation prefix  # the KDE4_xxx_INSTALL_DIR variables are empty when building kdelibs itself  # and otherwise point to the kde4 install dirs -# they will be set by default starting with cmake 2.6.0, maybe already 2.4.8 - -# also add the install directory of the running cmake to the search directories -# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up -get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) -get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)  set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} -                              "${KDE4_INCLUDE_INSTALL_DIR}" -                              "${_CMAKE_INSTALL_DIR}/include" -                              "${CMAKE_INSTALL_PREFIX}/include" ) +                              "${KDE4_INCLUDE_INSTALL_DIR}")  set(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH} -                              "${KDE4_BIN_INSTALL_DIR}" -                              "${_CMAKE_INSTALL_DIR}/bin" -                              "${CMAKE_INSTALL_PREFIX}/bin" ) +                              "${KDE4_BIN_INSTALL_DIR}" )  set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH}  -                              "${KDE4_LIB_INSTALL_DIR}" -                              "${_CMAKE_INSTALL_DIR}/lib"  -                              "${CMAKE_INSTALL_PREFIX}/lib" ) +                              "${KDE4_LIB_INSTALL_DIR}" )  # under Windows dlls may be also installed in bin/  if(WIN32) @@ -946,9 +968,7 @@ endif(MSVC)  if (CMAKE_COMPILER_IS_GNUCXX) -   if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.5) -      set (CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} "Debugfull") -   endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.5) +   set (CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} "Debugfull")     set (KDE4_ENABLE_EXCEPTIONS -fexceptions)     # Select flags. @@ -1057,9 +1077,7 @@ endif (CMAKE_COMPILER_IS_GNUCXX)  if (CMAKE_C_COMPILER MATCHES "icc") -   if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.5) -      set (CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} "Debugfull") -   endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.5) +   set (CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} "Debugfull")     set (KDE4_ENABLE_EXCEPTIONS -fexceptions)     # Select flags. @@ -1104,13 +1122,13 @@ macro (KDE4_PRINT_RESULTS)     # inside kdelibs the include dir and lib dir are internal, not "found"     if (NOT _kdeBootStrapping)         if(KDE4_INCLUDE_DIR) -          message(STATUS "Found KDE 4.1 include dir: ${KDE4_INCLUDE_DIR}") +          message(STATUS "Found KDE 4.2 include dir: ${KDE4_INCLUDE_DIR}")         else(KDE4_INCLUDE_DIR)            message(STATUS "ERROR: unable to find KDE 4 headers")         endif(KDE4_INCLUDE_DIR)         if(KDE4_LIB_DIR) -          message(STATUS "Found KDE 4.1 library dir: ${KDE4_LIB_DIR}") +          message(STATUS "Found KDE 4.2 library dir: ${KDE4_LIB_DIR}")         else(KDE4_LIB_DIR)            message(STATUS "ERROR: unable to find KDE 4 core library")         endif(KDE4_LIB_DIR) diff --git a/modules/FindKDEWIN.cmake b/modules/FindKDEWIN.cmake index 550d11d3..dfd7d071 100644 --- a/modules/FindKDEWIN.cmake +++ b/modules/FindKDEWIN.cmake @@ -1,4 +1,4 @@ -# - Try to find the directory in which the kdewin32 library and other win32 related libraries lives +# - Try to find the directory in which the kde windows supplementary libraries are living  #   # used environment vars   #  KDEWIN_DIR  - kdewin root dir  diff --git a/modules/FindKDEWIN32.cmake b/modules/FindKDEWIN32.cmake index 589b1531..d22a85a7 100644 --- a/modules/FindKDEWIN32.cmake +++ b/modules/FindKDEWIN32.cmake @@ -7,15 +7,13 @@  #  KDEWIN32_LIBRARIES - The libraries needed to use KDEWIN32  # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> -# Copyright (c) 2007, Ralf Habacker, <ralf.habacker@freenet.de> +# Copyright (c) 2007-2008, Ralf Habacker, <ralf.habacker@freenet.de>  #  # Redistribution and use is allowed according to the terms of the BSD license.  # For details see the accompanying COPYING-CMAKE-SCRIPTS file.  if (WIN32) -  include(FindLibraryWithDebug) -    if (NOT KDEWIN32_DIR)      if(NOT KDEWIN_FOUND)        find_package(KDEWIN) @@ -28,17 +26,21 @@ if (WIN32)      # search for kdewin32 in the default install directory for applications (default of (n)make install)      FILE(TO_CMAKE_PATH "${CMAKE_LIBRARY_PATH}" _cmakeLibraryPathCmakeStyle) -    find_library_with_debug(KDEWIN32_LIBRARY -      WIN32_DEBUG_POSTFIX d -      NAMES kdewin32 + +    if (CMAKE_BUILD_TYPE STREQUAL "Debug") +        set (LIBRARY_NAME kdewin32d) +    else (CMAKE_BUILD_TYPE STREQUAL "Debug") +        set (LIBRARY_NAME kdewin32) +    endif (CMAKE_BUILD_TYPE STREQUAL "Debug") + +    find_library(KDEWIN32_LIBRARY +      NAMES ${LIBRARY_NAME}        PATHS           ${_cmakeLibraryPathCmakeStyle}          ${CMAKE_INSTALL_PREFIX}/lib        NO_SYSTEM_ENVIRONMENT_PATH      ) -    # kdelibs/win/ has to be built before the rest of kdelibs/ -    # eventually it will be moved out from kdelibs/      if (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR)        set(KDEWIN32_FOUND TRUE)        # add needed system libs diff --git a/modules/FindPackageHandleStandardArgs.cmake b/modules/FindPackageHandleStandardArgs.cmake deleted file mode 100644 index 7f122edc..00000000 --- a/modules/FindPackageHandleStandardArgs.cmake +++ /dev/null @@ -1,60 +0,0 @@ -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... ) -# -# This macro is intended to be used in FindXXX.cmake modules files. -# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and -# it also sets the <UPPERCASED_NAME>_FOUND variable. -# The package is found if all variables listed are TRUE. -# Example: -# -#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) -# -# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and  -# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. -# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,  -# independent whether QUIET was used or not. -# -# If it is found, the location is reported using the VAR1 argument, so  -# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out. -# If the second argument is DEFAULT_MSG, the message in the failure case will  -# be "Could NOT find LibXml2", if you don't like this message you can specify -# your own custom failure message there. - -MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) - -  IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") -    IF (${_NAME}_FIND_REQUIRED) -      SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}") -    ELSE (${_NAME}_FIND_REQUIRED) -      SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}") -    ENDIF (${_NAME}_FIND_REQUIRED) -  ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") -    SET(_FAIL_MESSAGE "${_FAIL_MSG}") -  ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") - -  STRING(TOUPPER ${_NAME} _NAME_UPPER) - -  SET(${_NAME_UPPER}_FOUND TRUE) -  IF(NOT ${_VAR1}) -    SET(${_NAME_UPPER}_FOUND FALSE) -  ENDIF(NOT ${_VAR1}) - -  FOREACH(_CURRENT_VAR ${ARGN}) -    IF(NOT ${_CURRENT_VAR}) -      SET(${_NAME_UPPER}_FOUND FALSE) -    ENDIF(NOT ${_CURRENT_VAR}) -  ENDFOREACH(_CURRENT_VAR) - -  IF (${_NAME_UPPER}_FOUND) -    IF (NOT ${_NAME}_FIND_QUIETLY) -        MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}") -    ENDIF (NOT ${_NAME}_FIND_QUIETLY) -  ELSE (${_NAME_UPPER}_FOUND) -    IF (${_NAME}_FIND_REQUIRED) -        MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}") -    ELSE (${_NAME}_FIND_REQUIRED) -      IF (NOT ${_NAME}_FIND_QUIETLY) -        MESSAGE(STATUS "${_FAIL_MESSAGE}") -      ENDIF (NOT ${_NAME}_FIND_QUIETLY) -    ENDIF (${_NAME}_FIND_REQUIRED) -  ENDIF (${_NAME_UPPER}_FOUND) -ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS) diff --git a/modules/FindSoprano.cmake b/modules/FindSoprano.cmake index 0cc278b0..84581a3f 100644 --- a/modules/FindSoprano.cmake +++ b/modules/FindSoprano.cmake @@ -10,6 +10,13 @@  #  SOPRANO_SERVER_LIBRARIES - The Soprano server library (libsopranoserver)  #  SOPRANO_VERSION          - The Soprano version (string value)  # +# SOPRANO_PLUGIN_NQUADPARSER_FOUND      - true if the nquadparser plugin is found +# SOPRANO_PLUGIN_NQUADSERIALIZER_FOUND  - true if the nquadserializer plugin is found +# SOPRANO_PLUGIN_RAPTORPARSER_FOUND     - true if the raptorparser plugin is found +# SOPRANO_PLUGIN_RAPTORSERIALIZER_FOUND - true if the raptorserializer plugin is found +# SOPRANO_PLUGIN_REDLANDBACKEND_FOUND   - true if the redlandbackend plugin is found +# SOPRANO_PLUGIN_SESAME2BACKEND_FOUND   - true if the sesame2backend plugin is found +  # Options:  #  Set SOPRANO_MIN_VERSION to set the minimum required Soprano version (default: 1.99)  # @@ -23,9 +30,9 @@  #  set(SopranoIndex_FOUND TRUE)  #else(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES AND SOPRANO_INDEX_LIBRARIES AND SOPRANO_SERVER_LIBRARIES) -  INCLUDE(FindLibraryWithDebug) +  include(FindLibraryWithDebug) -  FIND_PATH(SOPRANO_INCLUDE_DIR  +  find_path(SOPRANO_INCLUDE_DIR       NAMES      soprano/soprano.h      PATHS @@ -33,7 +40,7 @@      ${INCLUDE_INSTALL_DIR}      ) -  FIND_LIBRARY_WITH_DEBUG(SOPRANO_INDEX_LIBRARIES  +  find_library_with_debug(SOPRANO_INDEX_LIBRARIES       WIN32_DEBUG_POSTFIX d      NAMES      sopranoindex @@ -42,7 +49,7 @@      ${LIB_INSTALL_DIR}      ) -  FIND_LIBRARY_WITH_DEBUG(SOPRANO_CLIENT_LIBRARIES  +  find_library_with_debug(SOPRANO_CLIENT_LIBRARIES       WIN32_DEBUG_POSTFIX d      NAMES      sopranoclient @@ -51,7 +58,7 @@      ${LIB_INSTALL_DIR}      ) -  FIND_LIBRARY_WITH_DEBUG(SOPRANO_LIBRARIES +  find_library_with_debug(SOPRANO_LIBRARIES      WIN32_DEBUG_POSTFIX d      NAMES soprano      PATHS @@ -59,7 +66,7 @@      ${LIB_INSTALL_DIR}    ) -  FIND_LIBRARY_WITH_DEBUG(SOPRANO_SERVER_LIBRARIES  +  find_library_with_debug(SOPRANO_SERVER_LIBRARIES       WIN32_DEBUG_POSTFIX d      NAMES      sopranoserver @@ -89,15 +96,15 @@    # check Soprano version    # We set a default for the minimum required version to be backwards compatible -  IF(NOT SOPRANO_MIN_VERSION) -    SET(SOPRANO_MIN_VERSION "1.99") -  ENDIF(NOT SOPRANO_MIN_VERSION) +  if(NOT SOPRANO_MIN_VERSION) +    set(SOPRANO_MIN_VERSION "1.99") +  endif(NOT SOPRANO_MIN_VERSION)    if(Soprano_FOUND) -    FILE(READ ${SOPRANO_INCLUDE_DIR}/soprano/version.h SOPRANO_VERSION_CONTENT) -    STRING(REGEX MATCH "SOPRANO_VERSION_STRING \".*\"\n" SOPRANO_VERSION_MATCH ${SOPRANO_VERSION_CONTENT}) -    IF (SOPRANO_VERSION_MATCH) -      STRING(REGEX REPLACE "SOPRANO_VERSION_STRING \"(.*)\"\n" "\\1" SOPRANO_VERSION ${SOPRANO_VERSION_MATCH}) +    file(READ ${SOPRANO_INCLUDE_DIR}/soprano/version.h SOPRANO_VERSION_CONTENT) +    string(REGEX MATCH "SOPRANO_VERSION_STRING \".*\"\n" SOPRANO_VERSION_MATCH ${SOPRANO_VERSION_CONTENT}) +    if(SOPRANO_VERSION_MATCH) +      string(REGEX REPLACE "SOPRANO_VERSION_STRING \"(.*)\"\n" "\\1" SOPRANO_VERSION ${SOPRANO_VERSION_MATCH})        if(SOPRANO_VERSION STRLESS "${SOPRANO_MIN_VERSION}")          set(Soprano_FOUND FALSE)          if(Soprano_FIND_REQUIRED) @@ -106,15 +113,60 @@            message(STATUS "Soprano version ${SOPRANO_VERSION} is too old. Please install ${SOPRANO_MIN_VERSION} or newer")          endif(Soprano_FIND_REQUIRED)        endif(SOPRANO_VERSION STRLESS "${SOPRANO_MIN_VERSION}") -    ENDIF (SOPRANO_VERSION_MATCH) +    endif(SOPRANO_VERSION_MATCH)    endif(Soprano_FOUND) +  #look for parser plugins +  if(Soprano_FOUND) +    find_path(SOPRANO_PLUGIN_DIR  +      NAMES +      soprano/plugins +      PATHS +      ${SHARE_INSTALL_PREFIX} /usr/share /usr/local/share +      NO_DEFAULT_PATH +      NO_SYSTEM_ENVIRONMENT_PATH +      ) +    set(SOPRANO_PLUGIN_DIR "${SOPRANO_PLUGIN_DIR}/soprano/plugins") + +    if(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadparser.desktop) +      set(SOPRANO_PLUGIN_NQUADPARSER_FOUND TRUE) +      set(_plugins "${_plugins} nquadparser") +    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadparser.desktop) + +    if(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadserializer.desktop) +      set(SOPRANO_PLUGIN_NQUADSERIALIZER_FOUND TRUE) +      set(_plugins "${_plugins} nquadserializer") +    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadserializer.desktop) + +    if(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorparser.desktop) +      set(SOPRANO_PLUGIN_RAPTORPARSER_FOUND TRUE) +      set(_plugins "${_plugins} raptorparser") +    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorparser.desktop) + +    if(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorserializer.desktop) +      set(SOPRANO_PLUGIN_RAPTORSERIALIZER_FOUND TRUE) +      set(_plugins "${_plugins} raptorserializer") +    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorserializer.desktop) + +    if(EXISTS ${SOPRANO_PLUGIN_DIR}/redlandbackend.desktop) +      set(SOPRANO_PLUGIN_REDLANDBACKEND_FOUND TRUE) +      set(_plugins "${_plugins} redlandbackend") +    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/redlandbackend.desktop) + +    if(EXISTS ${SOPRANO_PLUGIN_DIR}/sesame2backend.desktop) +      set(SOPRANO_PLUGIN_SESAME2BACKEND_FOUND TRUE) +      set(_plugins "${_plugins} sesame2backend") +    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/sesame2backend.desktop) + +  endif(Soprano_FOUND) +    if(Soprano_FOUND)      if(NOT Soprano_FIND_QUIETLY)        message(STATUS "Found Soprano: ${SOPRANO_LIBRARIES}")        message(STATUS "Found Soprano includes: ${SOPRANO_INCLUDE_DIR}")        message(STATUS "Found Soprano Index: ${SOPRANO_INDEX_LIBRARIES}")        message(STATUS "Found Soprano Client: ${SOPRANO_CLIENT_LIBRARIES}") +      message(STATUS "Found Soprano Plugins:${_plugins}")      endif(NOT Soprano_FIND_QUIETLY)    else(Soprano_FOUND)      if(Soprano_FIND_REQUIRED) diff --git a/modules/KDE4Defaults.cmake b/modules/KDE4Defaults.cmake index 60c62e35..e2af0acd 100644 --- a/modules/KDE4Defaults.cmake +++ b/modules/KDE4Defaults.cmake @@ -29,10 +29,10 @@ endif (NOT CMAKE_SKIP_RPATH)  # define the generic version of the libraries here  # this makes it easy to advance it when the next KDE release comes -set(GENERIC_LIB_VERSION "4.1.0") +set(GENERIC_LIB_VERSION "4.2.0")  set(GENERIC_LIB_SOVERSION "4") -set(KDE_NON_GENERIC_LIB_VERSION "5.1.0") +set(KDE_NON_GENERIC_LIB_VERSION "5.2.0")  set(KDE_NON_GENERIC_LIB_SOVERSION "5")  # windows does not support LD_LIBRARY_PATH or similar diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index 768a36e2..7c57e6a4 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -552,13 +552,20 @@ macro (KDE4_ADD_PLUGIN _target_NAME _with_PREFIX)     endif (${_with_PREFIX} STREQUAL "WITH_PREFIX")     set(_SRCS ${_first_SRC} ${ARGN}) -   kde4_handle_automoc(${_target_NAME} _SRCS) +   if(MSVC) +      add_automoc4_target("${_target_NAME}_automoc" _SRCS) +   else(MSVC) +      automoc4(${_target_NAME} _SRCS) +   endif(MSVC)     if (KDE4_ENABLE_FINAL)        kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_SRCS})        add_library(${_target_NAME} MODULE  ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files})     else (KDE4_ENABLE_FINAL)        add_library(${_target_NAME} MODULE ${_SRCS})     endif (KDE4_ENABLE_FINAL) +   if(MSVC) +      add_dependencies(${_target_NAME} "${_target_NAME}_automoc") +   endif(MSVC)     if (_first_SRC)        set_target_properties(${_target_NAME} PROPERTIES PREFIX "") @@ -802,13 +809,20 @@ macro (KDE4_ADD_EXECUTABLE _target_NAME)        set(_add_executable_param ${_add_executable_param} EXCLUDE_FROM_ALL)     endif (_test AND NOT KDE4_BUILD_TESTS) -   kde4_handle_automoc(${_target_NAME} _SRCS) +   if(MSVC) +      add_automoc4_target("${_target_NAME}_automoc" _SRCS) +   else(MSVC) +      automoc4(${_target_NAME} _SRCS) +   endif(MSVC)     if (KDE4_ENABLE_FINAL)        kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_SRCS})        add_executable(${_target_NAME} ${_add_executable_param} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files})     else (KDE4_ENABLE_FINAL)        add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS})     endif (KDE4_ENABLE_FINAL) +   if(MSVC) +      add_dependencies(${_target_NAME} "${_target_NAME}_automoc") +   endif(MSVC)     if (_test)        set_target_properties(${_target_NAME} PROPERTIES COMPILE_FLAGS -DKDESRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}\\"") @@ -843,13 +857,20 @@ macro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE)     endif (${_lib_TYPE} STREQUAL "MODULE")     set(_SRCS ${_first_SRC} ${ARGN}) -   kde4_handle_automoc(${_target_NAME} _SRCS) +   if(MSVC) +      add_automoc4_target("${_target_NAME}_automoc" _SRCS) +   else(MSVC) +      automoc4(${_target_NAME} _SRCS) +   endif(MSVC)     if (KDE4_ENABLE_FINAL)        kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_SRCS})        add_library(${_target_NAME} ${_add_lib_param}  ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files})     else (KDE4_ENABLE_FINAL)        add_library(${_target_NAME} ${_add_lib_param} ${_SRCS})     endif (KDE4_ENABLE_FINAL) +   if(MSVC) +      add_dependencies(${_target_NAME} "${_target_NAME}_automoc") +   endif(MSVC)     kde4_handle_rpath_for_library(${_target_NAME}) @@ -1086,7 +1107,7 @@ endmacro (KDE4_ADD_APP_ICON)  macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES _append_or_write _filename) -   if(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX )# AND NOT APPLE) +#   if(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX )# AND NOT APPLE)        # get all cmake variables which end in _LIB_DEPENDS        # then parse the target name out of them @@ -1098,9 +1119,7 @@ macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES _append_or_write _filename)        # Alex        file(${_append_or_write} "${_filename}" "# The following variables have been created by kde4_export_library_dependencies() -# The contents have been determined from the LINK_INTERFACE_LIBRARIES target property of the respective libraries. -# The option KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT has been enabled to create the file this way. -# You can modify KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT using \"make edit_cache\"\n\n") +# The contents have been determined from the LINK_INTERFACE_LIBRARIES target property of the respective libraries.\n\n")        get_cmake_property(allVars VARIABLES)        set(allLibs "")        foreach(currentVar ${allVars}) @@ -1113,7 +1132,7 @@ macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES _append_or_write _filename)           endif(NOT "${target}" STREQUAL "${currentVar}")        endforeach(currentVar ${allVars}) -   endif(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX)#  AND NOT APPLE) +#   endif(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX)#  AND NOT APPLE)  endmacro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES)  macro (_KDE4_TARGET_LINK_INTERFACE_LIBRARIES _target _interface_libs) diff --git a/modules/MacroEnsureOutOfSourceBuild.cmake b/modules/MacroEnsureOutOfSourceBuild.cmake index ef4d525f..cb26e0c3 100644 --- a/modules/MacroEnsureOutOfSourceBuild.cmake +++ b/modules/MacroEnsureOutOfSourceBuild.cmake @@ -1,5 +1,9 @@  # - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)  # MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>) +#    Call this macro in your project if you want to enforce out-of-source builds. +#    If an in-source build is detected, it will abort with the given error message. +#    This macro works in any of the CMakeLists.txt of your project, but the recommended +#    location to call this is close to the beginning of the top level CMakeLists.txt  # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>  # diff --git a/modules/MacroOptionalAddSubdirectory.cmake b/modules/MacroOptionalAddSubdirectory.cmake index b0d565c2..9566bb4c 100644 --- a/modules/MacroOptionalAddSubdirectory.cmake +++ b/modules/MacroOptionalAddSubdirectory.cmake @@ -19,7 +19,11 @@  MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )     GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)     IF(EXISTS ${_fullPath}) -      OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE) +      SET(_DEFAULT_OPTION_VALUE TRUE) +      IF(DISABLE_ALL_OPTIONAL_SUBDIRS) +         SET(_DEFAULT_OPTION_VALUE FALSE) +      ENDIF(DISABLE_ALL_OPTIONAL_SUBDIRS) +      OPTION(BUILD_${_dir} "Build directory ${_dir}" ${_DEFAULT_OPTION_VALUE})        IF(BUILD_${_dir})           ADD_SUBDIRECTORY(${_dir})        ENDIF(BUILD_${_dir}) diff --git a/modules/potential_problems b/modules/potential_problems deleted file mode 100644 index b4558a21..00000000 --- a/modules/potential_problems +++ /dev/null @@ -1,2 +0,0 @@ -/CMakeLists.txt find_package(Perl REQUIRED) -KDE4_AUTOMOC: -DQ_WS_X11 | 
