diff options
27 files changed, 429 insertions, 1061 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/FindBoost.cmake b/modules/FindBoost.cmake index 7f3aff9e..171409c6 100644 --- a/modules/FindBoost.cmake +++ b/modules/FindBoost.cmake @@ -12,7 +12,7 @@ # when new boost versions are released. # # Currently this module searches for the following version numbers: -# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, 1.36.0, 1.36.1 +# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, 1.36, 1.36.0, 1.36.1 # # The components list needs to be the actual names of boost libraries, that is # the part of the actual library files that differ on different libraries. So @@ -93,7 +93,7 @@ OPTION(Boost_USE_MULTITHREADED "Use the multithreaded versions of the boost libraries" ON) -SET( _boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS} "1.36.1" "1.36.0" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33" ) +SET( _boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS} "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33" ) ############################################ 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/FindEigen2.cmake b/modules/FindEigen2.cmake index 59eb1dfc..d5ffc2c2 100644 --- a/modules/FindEigen2.cmake +++ b/modules/FindEigen2.cmake @@ -19,6 +19,8 @@ find_path(EIGEN2_INCLUDE_DIR NAMES Eigen/Core PATHS ${INCLUDE_INSTALL_DIR}/eigen2 ${KDE4_INCLUDE_DIR}/eigen2 + ${CMAKE_INCLUDE_PATH}/eigen2 + /usr/include/eigen2 ) include(FindPackageHandleStandardArgs) 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 a5451d13..3b3952ba 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -217,12 +217,15 @@ # It's also important to note that gcc cannot detect all warning conditions # unless the optimiser is active. # -# You can set the variable KDE_MIN_VERSION before calling find_package() -# to depend on a particular kdelibs version. For example to depend on -# KDE 4.1.0 you can use +# 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 # -# set(KDE_MIN_VERSION "4.1.0") -# find_package(KDE4 REQUIRED) +# find_package(KDE4 4.1.0 REQUIRED) +# +# In earlier versions of KDE you could use the variable KDE_MIN_VERSION to +# have such a dependency. This variable is deprecated with KDE 4.2.0, but +# will still work to make the module backwards-compatible. # _KDE4_PLATFORM_INCLUDE_DIRS is used only internally # _KDE4_PLATFORM_DEFINITIONS is used only internally @@ -235,26 +238,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,30 +262,68 @@ if(NOT KDE4_FOUND) include (MacroEnsureVersion) +# We may only search for other packages with "REQUIRED" if we are required ourselves. +# This file can be processed either (usually) included in FindKDE4.cmake or +# (when building kdelibs) directly via FIND_PACKAGE(KDE4Internal), that's why +# we have to check for both KDE4_FIND_REQUIRED and KDE4Internal_FIND_REQUIRED. +if(KDE4_FIND_REQUIRED OR KDE4Internal_FIND_REQUIRED) + set(_REQ_STRING_KDE4 "REQUIRED") + set(_REQ_STRING_KDE4_MESSAGE "FATAL_ERROR") +else(KDE4_FIND_REQUIRED OR KDE4Internal_FIND_REQUIRED) + set(_REQ_STRING_KDE4 ) + set(_REQ_STRING_KDE4_MESSAGE "STATUS") +endif(KDE4_FIND_REQUIRED OR KDE4Internal_FIND_REQUIRED) + set(QT_MIN_VERSION "4.4.0") #this line includes FindQt4.cmake, which searches the Qt library and headers -find_package(Qt4 REQUIRED) +find_package(Qt4 ${_REQ_STRING_KDE4}) # 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) - -# use automoc4 from kdesupport +find_package(Automoc4 ${_REQ_STRING_KDE4}) + +# 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.87" "${AUTOMOC4_VERSION}" _automoc4_version_ok) + +# for compatibility with KDE 4.0.x set(KDE4_AUTOMOC_EXECUTABLE "${AUTOMOC4_EXECUTABLE}" ) -# Perl is required for building KDE software, -find_package(Perl REQUIRED) +# Perl is required for building KDE software +find_package(Perl ${_REQ_STRING_KDE4}) + +# Check that we really found everything. +# If KDE4 was searched with REQUIRED, we error out with FATAL_ERROR if something wasn't found +# already above in the other FIND_PACKAGE() calls. +# If KDE4 was searched without REQUIRED and something in the FIND_PACKAGE() calls above wasn't found, +# then we get here and must check that everything has actually been found. If something is missing, +# we must not fail with FATAL_ERROR, but only not set KDE4_FOUND. +if(NOT PERL_FOUND) + message(STATUS "KDE4 not found, because Perl not found") + return() +endif(NOT PERL_FOUND) + +if(NOT QT4_FOUND) + message(STATUS "KDE4 not found, because Qt4 not found") + return() +endif(NOT QT4_FOUND) + +if(NOT AUTOMOC4_FOUND OR NOT _automoc4_version_ok) + if(NOT AUTOMOC4_FOUND) + message(${_REQ_STRING_KDE4_MESSAGE} "KDE4 not found, because Automoc4 not found.") + return() + else(NOT AUTOMOC4_FOUND) + if(NOT _automoc4_version_ok) + message(${_REQ_STRING_KDE4_MESSAGE} "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.87") + return() + endif(NOT _automoc4_version_ok) + endif(NOT AUTOMOC4_FOUND) +endif(NOT AUTOMOC4_FOUND OR NOT _automoc4_version_ok) + + +# now we are sure we have everything we need include (MacroLibrary) include (CheckCXXCompilerFlag) @@ -364,7 +402,24 @@ 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) + 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 for finding KDE 4 (not for KDE ${KDE4_FIND_VERSION_MAJOR}).") + 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}") @@ -513,25 +568,39 @@ 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_") - -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) +# 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 + +# disable the reduced linking temporarily for Windows, cmake HEAD and the soon-to-be-released cmake 2.6.2 +# With 2.6.0 and 2.6.1 it can happen that the "debug", "optimized" and "general" keywords are +# misinterpreted by cmake as library names, the linking fails. Usually this happens under Windows. +# In 2.6.2 this will be an error at cmake time, so we disable it for now and once we require +# 2.6.2 we'll fix it the right way (using TARGET_LINK_LIBRARIES(foo LINK_INTERFACE_LIBRARIES ...) +if (WIN32 OR "${CMAKE_MINOR_VERSION}" EQUAL 7 OR "${CMAKE_PATCH_VERSION}" EQUAL 2) + set(KDE4_DISABLE_PROPERTY_ "DISABLED_") +endif (WIN32 OR "${CMAKE_MINOR_VERSION}" EQUAL 7 OR "${CMAKE_PATCH_VERSION}" EQUAL 2) +#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) if( KDE4_ENABLE_FINAL) @@ -544,7 +613,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 ########### @@ -694,40 +775,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) @@ -953,9 +1018,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. @@ -1043,10 +1106,10 @@ if (CMAKE_COMPILER_IS_GNUCXX) file(WRITE "${_source_file}" "${_source}") set(_include_dirs "-DINCLUDE_DIRECTORIES:STRING=${QT_INCLUDES}") - try_run(_run_result _compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${_include_dirs}") + try_run(_run_result _compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${_include_dirs}" COMPILE_OUTPUT_VARIABLE _compile_output_var) if(NOT _compile_result) - message(FATAL_ERROR "Could not compile simple test program:\n ${_source}") + message(FATAL_ERROR "Could not compile simple test program:\n ${_source}\n${_compile_output_var}") endif(NOT _compile_result) if(_run_result) message(FATAL_ERROR "Qt compiled without support for -fvisibility=hidden. This will break plugins and linking of some applications. Please fix your Qt installation.") @@ -1064,9 +1127,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. @@ -1111,13 +1172,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/FindKdepimLibs.cmake b/modules/FindKdepimLibs.cmake index e9cc7302..759ccfa0 100644 --- a/modules/FindKdepimLibs.cmake +++ b/modules/FindKdepimLibs.cmake @@ -31,13 +31,16 @@ if( KDEPIMLIBS_INCLUDE_DIR ) # this file contains all dependencies of all libraries of kdepimlibs, Alex include(KDEPimLibsDependencies) - + find_library(KDE4_AKONADI_LIBRARY NAMES akonadi-kde PATHS ${KDE4_LIB_DIR} NO_DEFAULT_PATH ) set(KDE4_AKONADI_LIBS ${akonadi_LIB_DEPENDS} ${KDE4_AKONADI_LIBRARY} ) find_library(KDE4_AKONADI_KMIME_LIBRARY NAMES akonadi-kmime PATHS ${KDE4_LIB_DIR} NO_DEFAULT_PATH ) set(KDE4_AKONADI_KMIME_LIBS ${akonadi_kmime_LIB_DEPENDS} ${KDE4_AKONADI_KMIME_LIBRARY} ) + find_library(KDE4_AKONADI_KABC_LIBRARY NAMES akonadi-kabc PATHS ${KDE4_LIB_DIR} NO_DEFAULT_PATH ) + set(KDE4_AKONADI_KABC_LIBS ${akonadi_kabc_LIB_DEPENDS} ${KDE4_AKONADI_KABC_LIBRARY} ) + find_library(KDE4_GPGMEPP_LIBRARY NAMES gpgme++ PATHS ${KDE4_LIB_DIR} NO_DEFAULT_PATH ) set(KDE4_GPGMEPP_LIBS ${gpgmepp_LIB_DEPENDS} ${KDE4_GPGMEPP_LIBRARY} ) diff --git a/modules/FindLibXslt.cmake b/modules/FindLibXslt.cmake index f84f4c26..41443d07 100644 --- a/modules/FindLibXslt.cmake +++ b/modules/FindLibXslt.cmake @@ -5,7 +5,7 @@ # LIBXSLT_INCLUDE_DIR - the LibXslt include directory # LIBXSLT_LIBRARIES - Link these to LibXslt # LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt -# XSLTPROC_EXECUTABLE - path to the xsltproc tool +# LIBXSLT_XSLTPROC_EXECUTABLE - path to the xsltproc tool # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> # @@ -46,7 +46,9 @@ ELSE (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) SET(LIBXSLT_FOUND FALSE) ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) -FIND_PROGRAM(XSLTPROC_EXECUTABLE xsltproc) +FIND_PROGRAM(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc) +# For compatibility with FindLibXslt.cmake from KDE 4.[01].x +SET(XSLTPROC_EXECUTABLE ${LIBXSLT_XSLTPROC_EXECUTABLE}) IF (LIBXSLT_FOUND) IF (NOT LibXslt_FIND_QUIETLY) @@ -58,5 +60,5 @@ ELSE (LIBXSLT_FOUND) ENDIF (LibXslt_FIND_REQUIRED) ENDIF (LIBXSLT_FOUND) -MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES LIBEXSLT_LIBRARIES XSLTPROC_EXECUTABLE) +MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES LIBEXSLT_LIBRARIES LIBXSLT_XSLTPROC_EXECUTABLE) 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/FindPkgConfig.cmake b/modules/FindPkgConfig.cmake deleted file mode 100644 index 34ef039a..00000000 --- a/modules/FindPkgConfig.cmake +++ /dev/null @@ -1,360 +0,0 @@ -# - a pkg-config module for CMake -# -# Usage: -# pkg_check_modules(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*) -# checks for all the given modules -# -# pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*) -# checks for given modules and uses the first working one -# -# When the 'REQUIRED' argument was set, macros will fail with an error -# when module(s) could not be found -# -# It sets the following variables: -# PKG_CONFIG_FOUND ... true if pkg-config works on the system -# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program -# <PREFIX>_FOUND ... set to 1 if module(s) exist -# -# For the following variables two sets of values exist; first one is the -# common one and has the given PREFIX. The second set contains flags -# which are given out when pkgconfig was called with the '--static' -# option. -# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l') -# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') -# <XPREFIX>_LDFLAGS ... all required linker flags -# <XPREFIX>_LDFLAGS_OTHERS ... all other linker flags -# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I') -# <XPREFIX>_CFLAGS ... all required cflags -# <XPREFIX>_CFLAGS_OTHERS ... the other compiler flags -# -# <XPREFIX> = <PREFIX> for common case -# <XPREFIX> = <PREFIX>_STATIC for static linking -# -# There are some special variables whose prefix depends on the count -# of given modules. When there is only one module, <PREFIX> stays -# unchanged. When there are multiple modules, the prefix will be -# changed to <PREFIX>_<MODNAME>: -# <XPREFIX>_VERSION ... version of the module -# <XPREFIX>_PREFIX ... prefix-directory of the module -# <XPREFIX>_INCLUDEDIR ... include-dir of the module -# <XPREFIX>_LIBDIR ... lib-dir of the module -# -# <XPREFIX> = <PREFIX> when |MODULES| == 1, else -# <XPREFIX> = <PREFIX>_<MODNAME> -# -# A <MODULE> parameter can have the following formats: -# {MODNAME} ... matches any version -# {MODNAME}>={VERSION} ... at least version <VERSION> is required -# {MODNAME}={VERSION} ... exactly version <VERSION> is required -# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION> -# -# Examples -# pkg_check_modules (GLIB2 glib-2.0) -# -# pkg_check_modules (GLIB2 glib-2.0>=2.10) -# requires at least version 2.10 of glib2 and defines e.g. -# GLIB2_VERSION=2.10.3 -# -# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0) -# requires both glib2 and gtk2, and defines e.g. -# FOO_glib-2.0_VERSION=2.10.3 -# FOO_gtk+-2.0_VERSION=2.8.20 -# -# pkg_check_modules (XRENDER REQUIRED xrender) -# defines e.g.: -# XRENDER_LIBRARIES=Xrender;X11 -# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp -# -# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) - - -# Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> -# -# Redistribution and use, with or without modification, are permitted -# provided that the following conditions are met: -# -# 1. Redistributions must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# 2. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -### Common stuff #### -set(PKG_CONFIG_VERSION 1) -set(PKG_CONFIG_FOUND 0) - -find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") -mark_as_advanced(PKG_CONFIG_EXECUTABLE) - -if(PKG_CONFIG_EXECUTABLE) - set(PKG_CONFIG_FOUND 1) -endif(PKG_CONFIG_EXECUTABLE) - - -# Unsets the given variables -macro(_pkgconfig_unset var) - set(${var} "" CACHE INTERNAL "") -endmacro(_pkgconfig_unset) - -macro(_pkgconfig_set var value) - set(${var} ${value} CACHE INTERNAL "") -endmacro(_pkgconfig_set) - -# Invokes pkgconfig, cleans up the result and sets variables -macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) - set(_pkgconfig_invoke_result) - - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist} - OUTPUT_VARIABLE _pkgconfig_invoke_result - RESULT_VARIABLE _pkgconfig_failed) - - if (_pkgconfig_failed) - set(_pkgconfig_${_varname} "") - _pkgconfig_unset(${_prefix}_${_varname}) - else(_pkgconfig_failed) - string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - - if (NOT ${_regexp} STREQUAL "") - string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - endif(NOT ${_regexp} STREQUAL "") - - separate_arguments(_pkgconfig_invoke_result) - - #message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}") - set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result}) - _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}") - endif(_pkgconfig_failed) -endmacro(_pkgconfig_invoke) - -# Invokes pkgconfig two times; once without '--static' and once with -# '--static' -macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) - _pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN}) - _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN}) -endmacro(_pkgconfig_invoke_dyn) - -# Splits given arguments into options and a package list -macro(_pkgconfig_parse_options _result _is_req) - set(${_is_req} 0) - - foreach(_pkg ${ARGN}) - if (_pkg STREQUAL "REQUIRED") - set(${_is_req} 1) - endif (_pkg STREQUAL "REQUIRED") - endforeach(_pkg ${ARGN}) - - set(${_result} ${ARGN}) - list(REMOVE_ITEM ${_result} "REQUIRED") -endmacro(_pkgconfig_parse_options) - -### -macro(_pkg_check_modules_internal _is_required _is_silent _prefix) - _pkgconfig_unset(${_prefix}_FOUND) - _pkgconfig_unset(${_prefix}_VERSION) - _pkgconfig_unset(${_prefix}_PREFIX) - _pkgconfig_unset(${_prefix}_INCLUDEDIR) - _pkgconfig_unset(${_prefix}_LIBDIR) - _pkgconfig_unset(${_prefix}_LIBS) - _pkgconfig_unset(${_prefix}_LIBS_L) - _pkgconfig_unset(${_prefix}_LIBS_PATHS) - _pkgconfig_unset(${_prefix}_LIBS_OTHER) - _pkgconfig_unset(${_prefix}_CFLAGS) - _pkgconfig_unset(${_prefix}_CFLAGS_I) - _pkgconfig_unset(${_prefix}_CFLAGS_OTHER) - _pkgconfig_unset(${_prefix}_STATIC_LIBDIR) - _pkgconfig_unset(${_prefix}_STATIC_LIBS) - _pkgconfig_unset(${_prefix}_STATIC_LIBS_L) - _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS) - _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER) - _pkgconfig_unset(${_prefix}_STATIC_CFLAGS) - _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I) - _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER) - - # create a better addressable variable of the modules and calculate its size - set(_pkg_check_modules_list ${ARGN}) - list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt) - - if(PKG_CONFIG_EXECUTABLE) - # give out status message telling checked module - if (NOT ${_is_silent}) - if (_pkg_check_modules_cnt EQUAL 1) - message(STATUS "checking for module '${_pkg_check_modules_list}'") - else(_pkg_check_modules_cnt EQUAL 1) - message(STATUS "checking for modules '${_pkg_check_modules_list}'") - endif(_pkg_check_modules_cnt EQUAL 1) - endif(NOT ${_is_silent}) - - set(_pkg_check_modules_packages) - set(_pkg_check_modules_failed) - - # iterate through module list and check whether they exist and match the required version - foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list}) - set(_pkg_check_modules_exist_query) - - # check whether version is given - if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}") - else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") - set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") - set(_pkg_check_modules_pkg_op) - set(_pkg_check_modules_pkg_ver) - endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") - - # handle the operands - if (_pkg_check_modules_pkg_op STREQUAL ">=") - list(APPEND _pkg_check_modules_exist_query --atleast-version) - endif(_pkg_check_modules_pkg_op STREQUAL ">=") - - if (_pkg_check_modules_pkg_op STREQUAL "=") - list(APPEND _pkg_check_modules_exist_query --exact-version) - endif(_pkg_check_modules_pkg_op STREQUAL "=") - - if (_pkg_check_modules_pkg_op STREQUAL "<=") - list(APPEND _pkg_check_modules_exist_query --max-version) - endif(_pkg_check_modules_pkg_op STREQUAL "<=") - - # create the final query which is of the format: - # * --atleast-version <version> <pkg-name> - # * --exact-version <version> <pkg-name> - # * --max-version <version> <pkg-name> - # * --exists <pkg-name> - if (_pkg_check_modules_pkg_op) - list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}") - else(_pkg_check_modules_pkg_op) - list(APPEND _pkg_check_modules_exist_query --exists) - endif(_pkg_check_modules_pkg_op) - - _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION) - _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX) - _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR) - _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR) - - list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}") - list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}") - - # execute the query - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query} - RESULT_VARIABLE _pkgconfig_retval) - - # evaluate result and tell failures - if (_pkgconfig_retval) - if(NOT ${_is_silent}) - message(STATUS " package '${_pkg_check_modules_pkg}' not found") - endif(NOT ${_is_silent}) - - set(_pkg_check_modules_failed 1) - endif(_pkgconfig_retval) - endforeach(_pkg_check_modules_pkg) - - if(_pkg_check_modules_failed) - # fail when requested - if (${_is_required}) - message(SEND_ERROR "A required package was not found") - endif (${_is_required}) - else(_pkg_check_modules_failed) - # when we are here, we checked whether requested modules - # exist. Now, go through them and set variables - - _pkgconfig_set(${_prefix}_FOUND 1) - list(LENGTH _pkg_check_modules_packages pkg_count) - - # iterate through all modules again and set individual variables - foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages}) - # handle case when there is only one package required - if (pkg_count EQUAL 1) - set(_pkg_check_prefix "${_prefix}") - else(pkg_count EQUAL 1) - set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}") - endif(pkg_count EQUAL 1) - - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) - - message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") - endforeach(_pkg_check_modules_pkg) - - # set variables which are combined for multiple modules - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) - - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) - endif(_pkg_check_modules_failed) - else(PKG_CONFIG_EXECUTABLE) - if (${_is_required}) - message(SEND_ERROR "pkg-config tool not found") - endif (${_is_required}) - endif(PKG_CONFIG_EXECUTABLE) -endmacro(_pkg_check_modules_internal) - -### -### User visible macros start here -### - -### -macro(pkg_check_modules _prefix _module0) - # check cached value - if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION}) - _pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN}) - _pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules}) - - _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) - endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION}) -endmacro(pkg_check_modules) - -### -macro(pkg_search_module _prefix _module0) - # check cached value - if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION}) - set(_pkg_modules_found 0) - _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN}) - - message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") - - # iterate through all modules and stop at the first working one. - foreach(_pkg_alt ${_pkg_modules_alt}) - if(NOT _pkg_modules_found) - _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}") - endif(NOT _pkg_modules_found) - - if (${_prefix}_FOUND) - set(_pkg_modules_found 1) - endif(${_prefix}_FOUND) - endforeach(_pkg_alt) - - if (NOT ${_prefix}_FOUND) - if(${_pkg_is_required}) - message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found") - endif(${_pkg_is_required}) - endif(NOT ${_prefix}_FOUND) - - _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) - endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION}) -endmacro(pkg_search_module) - -### Local Variables: -### mode: cmake -### End: diff --git a/modules/FindQt4.cmake b/modules/FindQt4.cmake index 55c44dfd..513b0cfe 100644 --- a/modules/FindQt4.cmake +++ b/modules/FindQt4.cmake @@ -85,6 +85,10 @@ # the list of sources. # To disable generating a namespace header, set the source file property # NO_NAMESPACE to TRUE on the interface file. +# To include a header in the interface header, set the source file property +# INCLUDE to the name of the header. +# To specify a class name to use, set the source file property CLASSNAME +# to the name of the class. # # macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... ) # create the interface header and implementation files @@ -92,6 +96,10 @@ # the name will be automatically determined from the name of the xml file # To disable generating namespace headers, set the source file property # NO_NAMESPACE to TRUE for these inputfiles. +# To include a header in the interface header, set the source file property +# INCLUDE to the name of the header. +# To specify a class name to use, set the source file property CLASSNAME +# to the name of the class. # # macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname]) # create a dbus adaptor (header and implementation file) from the xml file @@ -259,10 +267,24 @@ # Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. -if (QT4_QMAKE_FOUND) - # Check already done in this cmake run, nothing more to do -else (QT4_QMAKE_FOUND) +# If Qt3 has already been found, fail. +IF(QT_QT_LIBRARY) + IF(Qt4_FIND_REQUIRED) + MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project.") + ELSE(Qt4_FIND_REQUIRED) + IF(NOT Qt4_FIND_QUIETLY) + MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project.") + ENDIF(NOT Qt4_FIND_QUIETLY) + RETURN() + ENDIF(Qt4_FIND_REQUIRED) +ENDIF(QT_QT_LIBRARY) + + +IF (QT4_QMAKE_FOUND) + # Check already done in this cmake run, nothing more to do + RETURN() +ENDIF (QT4_QMAKE_FOUND) # check that QT_NO_DEBUG is defined for release configurations MACRO(QT_CHECK_FLAG_EXISTS FLAG VAR DOC) @@ -501,9 +523,9 @@ IF (QT4_QMAKE_FOUND) ENDIF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) IF( NOT QT_INCLUDE_DIR) - IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) + IF(Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could NOT find QtGlobal header") - ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) + ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_INCLUDE_DIR) ############################################# @@ -925,9 +947,9 @@ IF (QT4_QMAKE_FOUND) ENDIF (QT_USE_FRAMEWORKS) IF( NOT QT_QTCORE_LIBRARY ) - IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) + IF(Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") - ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) + ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_QTCORE_LIBRARY ) # Set QT_QTASSISTANT_LIBRARY @@ -1254,6 +1276,11 @@ IF (QT4_QMAKE_FOUND) SET(_params -m) ENDIF ( _nonamespace ) + GET_SOURCE_FILE_PROPERTY(_classname ${_interface} CLASSNAME) + IF ( _classname ) + SET(_params ${_params} -c ${_classname}) + ENDIF ( _classname ) + GET_SOURCE_FILE_PROPERTY(_include ${_interface} INCLUDE) IF ( _include ) SET(_params ${_params} -i ${_include}) @@ -1449,7 +1476,7 @@ IF (QT4_QMAKE_FOUND) SET( QT_QT_LIBRARY "") ELSE(QT4_QMAKE_FOUND) - + SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) IF(Qt4_FIND_REQUIRED) IF(QT4_INSTALLED_VERSION_TOO_OLD) @@ -1462,7 +1489,6 @@ ELSE(QT4_QMAKE_FOUND) MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY) ENDIF(Qt4_FIND_REQUIRED) - -ENDIF (QT4_QMAKE_FOUND) + ENDIF (QT4_QMAKE_FOUND) 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/FindStrigi.cmake b/modules/FindStrigi.cmake index 094be9b9..e9746292 100644 --- a/modules/FindStrigi.cmake +++ b/modules/FindStrigi.cmake @@ -1,4 +1,4 @@ -# - Try to find Strigi +# - Try to find Strigi, a fast and small desktop search program (http://strigi.sourceforge.net ) # Once done this will define # # STRIGI_FOUND - system has Strigi @@ -15,11 +15,8 @@ include(FindLibraryWithDebug) if(NOT STRIGI_MIN_VERSION) - set(STRIGI_MIN_VERSION "0.5.9") + set(STRIGI_MIN_VERSION "0.6.0") endif(NOT STRIGI_MIN_VERSION) -if(NOT STRIGI_MAX_VERSION) - set(STRIGI_MAX_VERSION "0.5.99") -endif(NOT STRIGI_MAX_VERSION) if (WIN32) file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR) @@ -85,8 +82,7 @@ if (NOT WIN32 AND NOT HAVE_STRIGI_VERSION) # if pkgconfig found strigi, check the version, otherwise print a warning if(_dummyLinkFlags) - ## TODO find out why --max-version does not work! - exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${STRIGI_MIN_VERSION} --max-version=${STRIGI_MAX_VERSION} + exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${STRIGI_MIN_VERSION} libstreamanalyzer RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull ) if(NOT _return_VALUE STREQUAL "0") @@ -126,7 +122,7 @@ endif (NOT WIN32 AND NOT HAVE_STRIGI_VERSION) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Strigi - "Couldn't find Strigi streams and streamanalyzer libraries. Set the environment variable STRIGI_HOME (or CMAKE_FIND_PREFIX_PATH if using CMake >=2.5) to the strigi install dir." + "Couldn't find Strigi streams and streamanalyzer libraries. Set the environment variable STRIGI_HOME (or CMAKE_PREFIX_PATH if using CMake >=2.6) to the strigi install dir." STRIGI_STREAMS_LIBRARY STRIGI_STREAMANALYZER_LIBRARY STRIGI_INCLUDE_DIR) if(WIN32) diff --git a/modules/FindTIFF.cmake b/modules/FindTIFF.cmake index 24b75b9f..829a3485 100644 --- a/modules/FindTIFF.cmake +++ b/modules/FindTIFF.cmake @@ -3,8 +3,8 @@ # This module defines # TIFF_INCLUDE_DIR, where to find tiff.h, etc. # TIFF_LIBRARIES, libraries to link against to use TIFF. -# TIFF_FOUND, If false, do NOT try to use TIFF. -# also defined, but NOT for general use are +# TIFF_FOUND, If false, do not try to use TIFF. +# also defined, but not for general use are # TIFF_LIBRARY, where to find the TIFF library. # Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. diff --git a/modules/FindX11.cmake b/modules/FindX11.cmake index 27702886..2d6d24e9 100644 --- a/modules/FindX11.cmake +++ b/modules/FindX11.cmake @@ -48,7 +48,6 @@ IF (UNIX) SET(CMAKE_FIND_FRAMEWORK NEVER) SET(X11_INC_SEARCH_PATH /usr/pkg/xorg/include - /usr/pkg/include /usr/X11R6/include /usr/X11R7/include /usr/include/X11 @@ -59,7 +58,6 @@ IF (UNIX) SET(X11_LIB_SEARCH_PATH /usr/pkg/xorg/lib - /usr/pkg/lib /usr/X11R6/lib /usr/X11R7/lib /usr/openwin/lib @@ -134,6 +132,7 @@ IF (UNIX) GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ${X11_X11_LIB} PATH) ENDIF(X11_X11_LIB) + SET(X11_INCLUDE_DIR) # start with empty list IF(X11_X11_INCLUDE_PATH) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH}) ENDIF(X11_X11_INCLUDE_PATH) @@ -152,6 +151,7 @@ IF (UNIX) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) ENDIF(X11_Xshape_INCLUDE_PATH) + SET(X11_LIBRARIES) # start with empty list IF(X11_X11_LIB) SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB}) ENDIF(X11_X11_LIB) 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..a17c1d4c 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -369,10 +369,12 @@ macro (KDE4_INSTALL_ICONS _defaultpath ) # first the png icons file(GLOB _icons *.png) foreach (_current_ICON ${_icons} ) - string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _type "${_current_ICON}") - string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _size "${_current_ICON}") - string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _group "${_current_ICON}") - string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\4" _name "${_current_ICON}") + # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty + string(REGEX MATCH "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" _dummy "${_current_ICON}") + set(_type "${CMAKE_MATCH_1}") + set(_size "${CMAKE_MATCH_2}") + set(_group "${CMAKE_MATCH_3}") + set(_name "${CMAKE_MATCH_4}") set(_theme_GROUP ${_KDE4_ICON_THEME_${_type}}) if( _theme_GROUP) @@ -385,10 +387,12 @@ macro (KDE4_INSTALL_ICONS _defaultpath ) # mng icons file(GLOB _icons *.mng) foreach (_current_ICON ${_icons} ) - string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\1" _type "${_current_ICON}") - string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\2" _size "${_current_ICON}") - string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\3" _group "${_current_ICON}") - string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\4" _name "${_current_ICON}") + # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty + string(REGEX MATCH "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" _dummy "${_current_ICON}") + set(_type "${CMAKE_MATCH_1}") + set(_size "${CMAKE_MATCH_2}") + set(_group "${CMAKE_MATCH_3}") + set(_name "${CMAKE_MATCH_4}") set(_theme_GROUP ${_KDE4_ICON_THEME_${_type}}) if( _theme_GROUP) @@ -401,9 +405,11 @@ macro (KDE4_INSTALL_ICONS _defaultpath ) # and now the svg icons file(GLOB _icons *.svgz) foreach (_current_ICON ${_icons} ) - string(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _type "${_current_ICON}") - string(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _group "${_current_ICON}") - string(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\3" _name "${_current_ICON}") + # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty + string(REGEX MATCH "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" _dummy "${_current_ICON}") + set(_type "${CMAKE_MATCH_1}") + set(_group "${CMAKE_MATCH_2}") + set(_name "${CMAKE_MATCH_3}") set(_theme_GROUP ${_KDE4_ICON_THEME_${_type}}) if( _theme_GROUP) @@ -552,13 +558,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 +815,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 +863,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}) @@ -859,14 +886,14 @@ macro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE) set(_symbol "MAKE_${_symbol}_LIB") set_target_properties(${_target_NAME} PROPERTIES DEFINE_SYMBOL ${_symbol}) - # if that option is enabled, by default don't add any linked libraries to the "exported" - # link interfaces, so that executables linking against this library won't get additional - # indirect dependencies. This makes work easier for packagers and should make application - # startup somewhat faster, if I understood Dirk correctly. + # 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") - if(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT AND UNIX )# AND NOT APPLE) - set_target_properties(${_target_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "" ) - endif(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT AND UNIX)# AND NOT APPLE) + set_target_properties(${_target_NAME} PROPERTIES ${KDE4_DISABLE_PROPERTY_}LINK_INTERFACE_LIBRARIES "" ) endif(NOT "${_add_lib_param}" STREQUAL "STATIC") endmacro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE) @@ -1086,7 +1113,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 +1125,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,9 +1138,30 @@ 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) +# In cmake 2.6.2 a new keyword "LINK_INTERFACE_LIBRARIES is added to TARGET_LINK_LIBRARIES(). +# We will use this to reduce the link interface of libraries. As opposed to setting the +# respective target property, here the "debug" and "optimized" keywords are supported +# (this is actually the reason why we will use this). +# The problem is, once we add this call to our cmake files, cmake 2.6.0 and 2.6.1 would not +# work anymore, since they would fail when trying to link against -lLINK_INTERFACE_LIBRARIES +# That's for cmake 2.6.0 and 2.6.1 we redefine TARGET_LINK_LIBRARIES() here. +# If the first argument after the target name if "LINK_INTERFACE_LIBRARIES", then +# nothing is done, otherwise the original TARGET_LINK_LIBRARIES() is called. +# This can be done by calling _target_link_libraries(), since if a command is +# "overloaded" by a macro, the original command gets a "_" prepended, so it +# is still available. +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.6\\.[01]$") + macro(TARGET_LINK_LIBRARIES) + if(NOT "${ARGV1}" STREQUAL "LINK_INTERFACE_LIBRARIES") + _target_link_libraries(${ARGN}) + endif() + endmacro(TARGET_LINK_LIBRARIES) +endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.6\\.[01]$") + + macro (_KDE4_TARGET_LINK_INTERFACE_LIBRARIES _target _interface_libs) message(FATAL_ERROR "_KDE4_TARGET_LINK_INTERFACE_LIBRARIES() doesn't exist anymore. Set the LINK_INTERFACE_LIBRARIES target property instead. See kdelibs/kdecore/CMakeLists.txt for an example.") endmacro (_KDE4_TARGET_LINK_INTERFACE_LIBRARIES) 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..32e25141 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 AND NOT DEFINED BUILD_${_dir}) + SET(_DEFAULT_OPTION_VALUE FALSE) + ENDIF(DISABLE_ALL_OPTIONAL_SUBDIRS AND NOT DEFINED BUILD_${_dir}) + OPTION(BUILD_${_dir} "Build directory ${_dir}" ${_DEFAULT_OPTION_VALUE}) IF(BUILD_${_dir}) ADD_SUBDIRECTORY(${_dir}) ENDIF(BUILD_${_dir}) diff --git a/modules/UsePkgConfig.cmake b/modules/UsePkgConfig.cmake deleted file mode 100644 index 8d6e0d34..00000000 --- a/modules/UsePkgConfig.cmake +++ /dev/null @@ -1,61 +0,0 @@ - -# THIS IS A SLIGHTLY ENHANCED COPY OVER THE ONE OF CMAKE 2.4.7. DO NOT MODIFY IT FURTHER - -# - pkg-config module for CMake -# -# Defines the following macros: -# -# PKGCONFIG(package includedir libdir linkflags cflags) -# -# Calling PKGCONFIG will fill the desired information into the 4 given arguments, -# e.g. PKGCONFIG(libart-2.0 LIBART_INCLUDE_DIR LIBART_LINK_DIR LIBART_LINK_FLAGS LIBART_CFLAGS) -# if pkg-config was NOT found or the specified software package doesn't exist, the -# variable will be empty when the function returns, otherwise they will contain the respective information -# - -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}) - - # 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) - - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=includedir - OUTPUT_VARIABLE ${_include_DIR} ) - string(REGEX REPLACE "[\r\n]" " " ${_include_DIR} "${${_include_DIR}}") - - - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=libdir - OUTPUT_VARIABLE ${_link_DIR} ) - string(REGEX REPLACE "[\r\n]" " " ${_link_DIR} "${${_link_DIR}}") - - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --libs - OUTPUT_VARIABLE ${_link_FLAGS} ) - string(REGEX REPLACE "[\r\n]" " " ${_link_FLAGS} "${${_link_FLAGS}}") - - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags - OUTPUT_VARIABLE ${_cflags} ) - string(REGEX REPLACE "[\r\n]" " " ${_cflags} "${${_cflags}}") - - ELSE( NOT _return_VALUE) - - MESSAGE(STATUS "KDE CMake PKGCONFIG macro indicates that ${_package} is not installed on your computer.") - MESSAGE(STATUS "Install the package which contains ${_package}.pc if you want to support this feature.") - - ENDIF(NOT _return_VALUE) - - ENDIF(PKGCONFIG_EXECUTABLE) - -ENDMACRO(PKGCONFIG _include_DIR _link_DIR _link_FLAGS _cflags) - -MARK_AS_ADVANCED(PKGCONFIG_EXECUTABLE) 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 |