summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake14
-rw-r--r--Modules/CTest.cmake3
-rw-r--r--Modules/DartConfiguration.tcl.in5
-rw-r--r--Modules/DeployQt4.cmake274
-rw-r--r--Modules/FindQt4.cmake8
-rw-r--r--Modules/UseQt4.cmake2
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx9
-rw-r--r--Source/cmDocumentVariables.cxx9
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx208
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h10
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmQtAutomoc.cxx178
-rw-r--r--Source/cmQtAutomoc.h16
-rw-r--r--Source/cmTarget.cxx4
-rw-r--r--Source/kwsys/SystemTools.hxx.in4
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake2
-rw-r--r--Tests/QtAutomoc/CMakeLists.txt2
-rw-r--r--Tests/QtAutomoc/foo.cpp39
-rw-r--r--Tests/QtAutomoc/foo.h28
-rw-r--r--Tests/QtAutomoc/main.cpp4
21 files changed, 697 insertions, 129 deletions
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index cf0984e..f7a6e29 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -54,8 +54,20 @@ ENDFUNCTION()
_FIND_ECLIPSE_VERSION()
+# Try to find out how many CPUs we have and set the -j argument for make accordingly
+SET(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "")
+
+INCLUDE(ProcessorCount)
+PROCESSORCOUNT(_CMAKE_ECLIPSE_PROCESSOR_COUNT)
+
+# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name
+# (we may also get here in the future e.g. for ninja)
+IF("${_CMAKE_ECLIPSE_PROCESSOR_COUNT}" GREATER 1 AND UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make)
+ SET(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "-j${_CMAKE_ECLIPSE_PROCESSOR_COUNT}")
+ENDIF()
+
# This variable is used by the Eclipse generator and appended to the make invocation commands.
-SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
+SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
# This variable is used by the Eclipse generator in out-of-source builds only.
SET(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index c261eb3..ec9dbeb 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -189,6 +189,8 @@ IF(BUILD_TESTING)
FIND_PROGRAM(COVERAGE_COMMAND gcov DOC
"Path to the coverage program that CTest uses for performing coverage inspection"
)
+ SET(COVERAGE_EXTRA_FLAGS "-l" CACHE STRING
+ "Extra command line flags to pass to the coverage tool")
# set the site name
SITE_NAME(SITE)
@@ -257,6 +259,7 @@ IF(BUILD_TESTING)
BZRCOMMAND
BZR_UPDATE_OPTIONS
COVERAGE_COMMAND
+ COVERAGE_EXTRA_FLAGS
CTEST_SUBMIT_RETRY_DELAY
CTEST_SUBMIT_RETRY_COUNT
CVSCOMMAND
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index caf0afe..ad7f805 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -59,14 +59,17 @@ UpdateType: @UPDATE_TYPE@
# Compiler info
Compiler: @CMAKE_CXX_COMPILER@
-# Dynamic analysis and coverage
+# Dynamic analysis (MemCheck)
PurifyCommand: @PURIFYCOMMAND@
ValgrindCommand: @VALGRIND_COMMAND@
ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
MemoryCheckCommand: @MEMORYCHECK_COMMAND@
MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@
MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
+
+# Coverage
CoverageCommand: @COVERAGE_COMMAND@
+CoverageExtraFlags: @COVERAGE_EXTRA_FLAGS@
# Cluster commands
SlurmBatchCommand: @SLURM_SBATCH_COMMAND@
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
new file mode 100644
index 0000000..bdf8360
--- /dev/null
+++ b/Modules/DeployQt4.cmake
@@ -0,0 +1,274 @@
+# - Functions to help assemble a standalone Qt4 executable.
+# A collection of CMake utility functions useful for deploying
+# Qt4 executables.
+#
+# The following functions are provided by this module:
+# write_qt4_conf
+# resolve_qt4_paths
+# fixup_qt4_executable
+# install_qt4_plugin_path
+# install_qt4_plugin
+# install_qt4_executable
+# Requires CMake 2.6 or greater because it uses function and
+# PARENT_SCOPE. Also depends on BundleUtilities.cmake.
+#
+# WRITE_QT4_CONF(<qt_conf_dir> <qt_conf_contents>)
+# Writes a qt.conf file with the <qt_conf_contents> into <qt_conf_dir>.
+#
+# RESOLVE_QT4_PATHS(<paths_var> [<executable_path>])
+# Loop through <paths_var> list and if any don't exist resolve them
+# relative to the <executable_path> (if supplied) or the CMAKE_INSTALL_PREFIX.
+#
+# FIXUP_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
+# Copies Qt plugins, writes a Qt configuration file (if needed) and fixes up a
+# Qt4 executable using BundleUtilities so it is standalone and can be
+# drag-and-drop copied to another machine as long as all of the system
+# libraries are compatible.
+#
+# <executable> should point to the executable to be fixed-up.
+#
+# <qtplugins> should contain a list of the names or paths of any Qt plugins
+# to be installed.
+#
+# <libs> will be passed to BundleUtilities and should be a list of any already
+# installed plugins, libraries or executables to also be fixed-up.
+#
+# <dirs> will be passed to BundleUtilities and should contain and directories
+# to be searched to find library dependencies.
+#
+# <plugins_dir> allows an custom plugins directory to be used.
+#
+# <request_qt_conf> will force a qt.conf file to be written even if not needed.
+#
+# INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var <plugins_dir> <component> <configurations>)
+# Install (or copy) a resolved <plugin> to the default plugins directory
+# (or <plugins_dir>) relative to <executable> and store the result in
+# <installed_plugin_path_var>.
+#
+# If <copy> is set to TRUE then the plugins will be copied rather than
+# installed. This is to allow this module to be used at CMake time rather than
+# install time.
+#
+# If <component> is set then anything installed will use this COMPONENT.
+#
+# INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var <plugins_dir> <component>)
+# Install (or copy) an unresolved <plugin> to the default plugins directory
+# (or <plugins_dir>) relative to <executable> and store the result in
+# <installed_plugin_path_var>. See documentation of INSTALL_QT4_PLUGIN_PATH.
+#
+# INSTALL_QT4_EXECUTABLE(<executable> <qtplugins> [<libs> <dirs> <plugins_dir> <request_qt_conf>])
+# Installs Qt plugins, writes a Qt configuration file (if needed) and fixes up
+# a Qt4 executable using BundleUtilities so it is standalone and can be
+# drag-and-drop copied to another machine as long as all of the system
+# libraries are compatible. The executable will be fixed-up at install time.
+# See documentation of FIXUP_QT4_BUNDLE.
+
+#=============================================================================
+# Copyright 2011 Mike McQuaid <mike@mikemcquaid.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# The functions defined in this file depend on the fixup_bundle function
+# (and others) found in BundleUtilities.cmake
+
+include(BundleUtilities)
+set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
+
+function(write_qt4_conf qt_conf_dir qt_conf_contents)
+ set(qt_conf_path "${qt_conf_dir}/qt.conf")
+ message(STATUS "Writing ${qt_conf_path}")
+ file(WRITE "${qt_conf_path}" "${qt_conf_contents}")
+endfunction()
+
+function(resolve_qt4_paths paths_var)
+ set(executable_path ${ARGV1})
+
+ set(paths_resolved)
+ foreach(path ${${paths_var}})
+ if(EXISTS "${path}")
+ list(APPEND paths_resolved "${path}")
+ else()
+ if(${executable_path})
+ list(APPEND paths_resolved "${executable_path}/${path}")
+ else()
+ list(APPEND paths_resolved "\${CMAKE_INSTALL_PREFIX}/${path}")
+ endif()
+ endif()
+ endforeach()
+ set(${paths_var} ${paths_resolved} PARENT_SCOPE)
+endfunction()
+
+function(fixup_qt4_executable executable qtplugins)
+ set(libs ${ARGV2})
+ set(dirs ${ARGV3})
+ set(plugins_dir ${ARGV4})
+ set(request_qt_conf ${ARGV5})
+
+ message(STATUS "fixup_qt4_executable")
+ message(STATUS " executable='${executable}'")
+ message(STATUS " qtplugins='${qtplugins}'")
+ message(STATUS " libs='${libs}'")
+ message(STATUS " dirs='${dirs}'")
+ message(STATUS " plugins_dir='${plugins_dir}'")
+ message(STATUS " request_qt_conf='${request_qt_conf}'")
+
+ if(QT_LIBRARY_DIR)
+ list(APPEND dirs "${QT_LIBRARY_DIR}")
+ endif()
+
+ if(APPLE)
+ set(qt_conf_dir "${executable}/Contents/Resources")
+ set(executable_path "${executable}")
+ set(write_qt_conf TRUE)
+ else()
+ get_filename_component(executable_path "${executable}" PATH)
+ if(NOT executable_path)
+ set(executable_path ".")
+ endif()
+ set(qt_conf_dir "${executable_path}")
+ set(write_qt_conf ${request_qt_conf})
+ endif()
+
+ foreach(plugin ${qtplugins})
+ set(installed_plugin_path "")
+ install_qt4_plugin("${plugin}" "${plugins_dir}" "${executable}" 1 installed_plugin_path)
+ list(APPEND libs ${installed_plugin_path})
+ endforeach()
+
+ foreach(lib ${libs})
+ if(NOT EXISTS "${lib}")
+ message(FATAL_ERROR "Library does not exist: ${lib}")
+ endif()
+ endforeach()
+
+ resolve_qt4_paths(libs "${executable_path}")
+ resolve_qt4_paths(dirs "${executable_path}")
+
+ if(write_qt_conf)
+ set(qt_conf_contents "[Paths]\nPlugins = ${plugins_dir}")
+ write_qt4_conf("${qt_conf_dir}" "${qt_conf_contents}")
+ endif()
+
+ fixup_bundle("${executable}" "${libs}" "${dirs}")
+endfunction()
+
+function(install_qt4_plugin_path plugin executable copy installed_plugin_path_var)
+ set(plugins_dir ${ARGV4})
+ set(component ${ARGV5})
+ set(configurations ${ARGV6})
+ if(EXISTS "${plugin}")
+ if(plugins_dir)
+ set(plugins_dir "${plugins_dir}")
+ else()
+ if(APPLE)
+ set(plugins_dir "PlugIns")
+ else()
+ set(plugins_dir "plugins")
+ endif()
+ endif()
+ if(APPLE)
+ set(plugins_path "${executable}/Contents/${plugins_dir}")
+ else()
+ get_filename_component(executable_path "${executable}" PATH)
+ if(NOT executable_path)
+ set(executable_path ".")
+ endif()
+ set(plugins_path "${executable_path}/${plugins_dir}")
+ endif()
+
+ set(plugin_group "")
+
+ get_filename_component(plugin_path "${plugin}" PATH)
+ get_filename_component(plugin_parent_path "${plugin_path}" PATH)
+ get_filename_component(plugin_parent_dir_name "${plugin_parent_path}" NAME)
+ get_filename_component(plugin_name "${plugin}" NAME)
+ string(TOLOWER "${plugin_parent_dir_name}" plugin_parent_dir_name)
+
+ if("${plugin_parent_dir_name}" STREQUAL "plugins")
+ get_filename_component(plugin_group "${plugin_path}" NAME)
+ set(${plugin_group_var} "${plugin_group}")
+ endif()
+ set(plugins_path "${plugins_path}/${plugin_group}")
+
+ if(${copy})
+ file(MAKE_DIRECTORY "${plugins_path}")
+ file(COPY "${plugin}" DESTINATION "${plugins_path}")
+ else()
+ if(configurations AND (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE))
+ set(configurations CONFIGURATIONS ${configurations})
+ endif()
+ if(component)
+ set(component COMPONENT ${component})
+ endif()
+ install(FILES "${plugin}" DESTINATION "${plugins_path}" ${configurations} ${component})
+ endif()
+ set(${installed_plugin_path_var} ${${installed_path_var}} "${plugins_path}/${plugin_name}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
+ set(plugins_dir ${ARGV4})
+ set(component ${ARGV5})
+ if(EXISTS "${plugin}")
+ install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
+ else()
+ if(QT_IS_STATIC)
+ string(TOUPPER "QT_${plugin}_LIBRARY" plugin_var)
+ else()
+ string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var)
+ endif()
+ set(plugin_release "${${plugin_var}_RELEASE}")
+ set(plugin_debug "${${plugin_var}_DEBUG}")
+ if(NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}")
+ message(WARNING "Qt plugin \"${plugin}\" not recognized or found.")
+ endif()
+ install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel")
+ install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Debug")
+ endif()
+ set(installed_plugin_path_var "${installed_plugin_path_var}" PARENT_SCOPE)
+endfunction()
+
+function(install_qt4_executable executable)
+ set(qtplugins ${ARGV1})
+ set(libs ${ARGV2})
+ set(dirs ${ARGV3})
+ set(plugins_dir ${ARGV4})
+ set(request_qt_conf ${ARGV5})
+ set(plugin_component ${ARGV6})
+ if(QT_LIBRARY_DIR)
+ list(APPEND dirs "${QT_LIBRARY_DIR}")
+ endif()
+
+ get_filename_component(executable_absolute "${executable}" ABSOLUTE)
+ gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY}" qtcore_type)
+ if(qtcore_type STREQUAL "system")
+ set(qt_plugins_dir "")
+ endif()
+
+ if(NOT qtplugins AND QT_LIBRARIES_PLUGINS)
+ set(qtplugins "${QT_LIBRARIES_PLUGINS}")
+ endif()
+
+ foreach(plugin ${qtplugins})
+ set(installed_plugin_paths "")
+ install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${plugin_component}")
+ list(APPEND libs ${installed_plugin_paths})
+ endforeach()
+
+ resolve_qt4_paths(libs)
+ resolve_qt4_paths(dirs)
+
+ install(CODE
+ " INCLUDE( \"${DeployQt4_cmake_dir}/DeployQt4.cmake\" )
+ SET( BU_CHMOD_BUNDLE_ITEMS TRUE )
+ FIXUP_QT4_EXECUTABLE( \"\${CMAKE_INSTALL_PREFIX}/${executable}\" \"\" \"${libs}\" \"${dirs}\" \"${plugins_dir}\" \"${request_qt_conf}\" ) "
+ )
+endfunction()
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 3b05c2b..c56827e 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1062,6 +1062,14 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION)
SET( QT_SCRIPT_PLUGINS qtscriptdbus )
SET( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds )
+ SET( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} )
+ SET( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets )
+ SET( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} )
+ SET( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} )
+ SET( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} )
+ SET( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} )
+ SET( QT_QTSVG_PLUGINS qsvg qsvgicon )
+
IF(QT_QMAKE_CHANGED)
FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
index dbe28ac..b824392 100644
--- a/Modules/UseQt4.cmake
+++ b/Modules/UseQt4.cmake
@@ -28,6 +28,7 @@ ENDIF()
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
SET(QT_LIBRARIES "")
+SET(QT_LIBRARIES_PLUGINS "")
IF (QT_USE_QTMAIN)
IF (Q_WS_WIN)
@@ -91,6 +92,7 @@ FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR})
ENDIF(QT_USE_${module})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
+ SET(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
IF(QT_IS_STATIC)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
ENDIF(QT_IS_STATIC)
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 005651f..0b1c9fe 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -751,12 +751,15 @@ int cmCTestCoverageHandler::HandlePHPCoverage(
}
return static_cast<int>(cont->TotalCoverage.size());
}
+
//----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestCoverageHandlerContainer* cont)
{
std::string gcovCommand
= this->CTest->GetCTestConfiguration("CoverageCommand");
+ std::string gcovExtraFlags
+ = this->CTest->GetCTestConfiguration("CoverageExtraFlags");
// Style 1
std::string st1gcovOutputRex1
@@ -825,8 +828,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// Call gcov to get coverage data for this *.gcda file:
//
std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str());
- std::string command = "\"" + gcovCommand + "\" -l -p -o \"" + fileDir
- + "\" \"" + *it + "\"";
+ std::string command = "\"" + gcovCommand + "\" " +
+ gcovExtraFlags + " " +
+ "-o \"" + fileDir + "\" " +
+ "\"" + *it + "\"";
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
<< std::endl);
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index f2b01f1..f4d4e7c 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1219,7 +1219,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Therefore a specific build configuration must be chosen even "
"if the generated build system supports multiple configurations.",false,
"Variables that Control the Build");
-
+ cm->DefineProperty
+ ("CMAKE_LINK_INTERFACE_LIBRARIES", cmProperty::VARIABLE,
+ "Default value for LINK_INTERFACE_LIBRARIES of targets.",
+ "This variable is used to initialize the "
+ "LINK_INTERFACE_LIBRARIES property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
// Variables defined when the a language is enabled These variables will
// also be defined whenever CMake has loaded its support for compiling (LANG)
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index f303f16..785e85a 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -17,6 +17,7 @@
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmTarget.h"
+#include "cmSourceFile.h"
#include "cmSystemTools.h"
#include <stdlib.h>
@@ -414,7 +415,8 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
linkSourceDirectory.c_str()))
{
this->AppendLinkedResource(fout, sourceLinkedResourceName,
- this->GetEclipsePath(linkSourceDirectory));
+ this->GetEclipsePath(linkSourceDirectory),
+ LinkToFolder);
this->SrcLinkedResources.push_back(sourceLinkedResourceName);
}
@@ -422,31 +424,9 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
if (this->SupportsVirtualFolders)
{
- // for each sub project create a linked resource to the source dir
- // - only if it is an out-of-source build
- this->AppendLinkedResource(fout, "[Subprojects]",
- "virtual:/virtual", true);
-
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
- it = this->GlobalGenerator->GetProjectMap().begin();
- it != this->GlobalGenerator->GetProjectMap().end();
- ++it)
- {
- std::string linkSourceDirectory = this->GetEclipsePath(
- it->second[0]->GetMakefile()->GetStartDirectory());
- // a linked resource must not point to a parent directory of .project or
- // .project itself
- if ((this->HomeOutputDirectory != linkSourceDirectory) &&
- !cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
- linkSourceDirectory.c_str()))
- {
- std::string linkName = "[Subprojects]/";
- linkName += it->first;
- this->AppendLinkedResource(fout, linkName,
- this->GetEclipsePath(linkSourceDirectory));
- this->SrcLinkedResources.push_back(it->first);
- }
- }
+ this->CreateLinksToSubprojects(fout);
+
+ this->CreateLinksForTargets(fout);
}
// I'm not sure this makes too much sense. There can be different
@@ -466,6 +446,123 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
fout << "</projectDescription>\n";
}
+
+//----------------------------------------------------------------------------
+void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
+ cmGeneratedFileStream& fout)
+{
+ std::string linkName = "[Targets]";
+ this->AppendLinkedResource(fout, linkName, "virtual:/virtual",VirtualFolder);
+
+ for (std::vector<cmLocalGenerator*>::const_iterator
+ lgIt = this->GlobalGenerator->GetLocalGenerators().begin();
+ lgIt != this->GlobalGenerator->GetLocalGenerators().end();
+ ++lgIt)
+ {
+ cmMakefile* makefile = (*lgIt)->GetMakefile();
+ const cmTargets& targets = makefile->GetTargets();
+
+ for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti)
+ {
+ std::string linkName2 = linkName;
+ linkName2 += "/";
+ switch(ti->second.GetType())
+ {
+ case cmTarget::EXECUTABLE:
+ case cmTarget::STATIC_LIBRARY:
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ {
+ const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ?
+ "[exe] " : "[lib] ");
+ linkName2 += prefix;
+ linkName2 += ti->first;
+ this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
+ VirtualFolder);
+ std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups();
+ // get the files from the source lists then add them to the groups
+ cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
+ std::vector<cmSourceFile*>const & files = tgt->GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
+ sfIt != files.end();
+ sfIt++)
+ {
+ // Add the file to the list of sources.
+ std::string source = (*sfIt)->GetFullPath();
+ cmSourceGroup& sourceGroup =
+ makefile->FindSourceGroup(source.c_str(), sourceGroups);
+ sourceGroup.AssignSource(*sfIt);
+ }
+
+ for(std::vector<cmSourceGroup>::iterator sgIt = sourceGroups.begin();
+ sgIt != sourceGroups.end();
+ ++sgIt)
+ {
+ std::string linkName3 = linkName2;
+ linkName3 += "/";
+ linkName3 += sgIt->GetFullName();
+ this->AppendLinkedResource(fout, linkName3, "virtual:/virtual",
+ VirtualFolder);
+
+ std::vector<const cmSourceFile*> sFiles = sgIt->GetSourceFiles();
+ for(std::vector<const cmSourceFile*>::const_iterator fileIt =
+ sFiles.begin();
+ fileIt != sFiles.end();
+ ++fileIt)
+ {
+ std::string linkName4 = linkName3;
+ linkName4 += "/";
+ linkName4 +=
+ cmSystemTools::GetFilenameName((*fileIt)->GetFullPath());
+ this->AppendLinkedResource(fout, linkName4,
+ (*fileIt)->GetFullPath(), LinkToFile);
+ }
+ }
+ }
+ break;
+ // ignore all others:
+ default:
+ break;
+ }
+ }
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
+ cmGeneratedFileStream& fout)
+{
+ // for each sub project create a linked resource to the source dir
+ // - only if it is an out-of-source build
+ this->AppendLinkedResource(fout, "[Subprojects]",
+ "virtual:/virtual", VirtualFolder);
+
+ for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ it = this->GlobalGenerator->GetProjectMap().begin();
+ it != this->GlobalGenerator->GetProjectMap().end();
+ ++it)
+ {
+ std::string linkSourceDirectory = this->GetEclipsePath(
+ it->second[0]->GetMakefile()->GetStartDirectory());
+ // a linked resource must not point to a parent directory of .project or
+ // .project itself
+ if ((this->HomeOutputDirectory != linkSourceDirectory) &&
+ !cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
+ linkSourceDirectory.c_str()))
+ {
+ std::string linkName = "[Subprojects]/";
+ linkName += it->first;
+ this->AppendLinkedResource(fout, linkName,
+ this->GetEclipsePath(linkSourceDirectory),
+ LinkToFolder
+ );
+ this->SrcLinkedResources.push_back(it->first);
+ }
+ }
+}
+
+
//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
cmGeneratedFileStream& fout,
@@ -598,6 +695,18 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// - make it type 'src'
// - and exclude it from type 'out'
std::string excludeFromOut;
+/* I don't know what the pathentry kind="src" are good for, e.g. autocompletion
+ * works also without them. Done wrong, the indexer complains, see #12417
+ * and #12213.
+ * The CDT documentation is very terse on that:
+ * "CDT_SOURCE: Entry kind constant describing a path entry identifying a
+ * folder containing source code to be compiled."
+ * Also on the cdt-dev list didn't bring any information:
+ * http://web.archiveorange.com/archive/v/B4NlJDNIpYoOS1SbxFNy
+ * So I'm disabling them for now, hoping that somebody will report if something
+ * is not workging anymore.
+ * Alex */
+#ifdef DO_CREATE_SRC_PATH_ENTRIES
for (std::vector<std::string>::const_iterator
it = this->SrcLinkedResources.begin();
it != this->SrcLinkedResources.end();
@@ -614,6 +723,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
excludeFromOut += this->EscapeForXML(*it) + "/|";
}
}
+#endif
excludeFromOut += "**/CMakeFiles/";
fout << "<pathentry excluding=\"" << excludeFromOut
<< "\" kind=\"out\" path=\"\"/>\n";
@@ -791,6 +901,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
const std::string makeArgs = mf->GetSafeDefinition(
"CMAKE_ECLIPSE_MAKE_ARGUMENTS");
+ const std::string cmake = mf->GetRequiredDefinition("CMAKE_COMMAND");
+
cmGlobalGenerator* generator
= const_cast<cmGlobalGenerator*>(this->GlobalGenerator);
@@ -879,6 +991,25 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
std::string fastTarget = ti->first;
fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix);
+
+ // Add Build and Clean targets in the virtual folder of targets:
+ if (this->SupportsVirtualFolders)
+ {
+ std::string virtDir = "[Targets]/";
+ virtDir += prefix;
+ virtDir += ti->first;
+ this->AppendTarget(fout, "Build", make, makeArgs, virtDir, "",
+ ti->first.c_str());
+
+ std::string cleanArgs = "-E chdir \"";
+ cleanArgs += makefile->GetCurrentOutputDirectory();
+ cleanArgs += "\" \"";
+ cleanArgs += cmake;
+ cleanArgs += "\" -P \"";
+ cleanArgs += (*it)->GetTargetDirectory(ti->second);
+ cleanArgs += "/cmake_clean.cmake\"";
+ this->AppendTarget(fout, "Clean", cmake, cleanArgs, virtDir, "", "");
+ }
}
break;
// ignore these:
@@ -1063,9 +1194,17 @@ void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout,
const std::string& make,
const std::string& makeArgs,
const std::string& path,
- const char* prefix)
+ const char* prefix,
+ const char* makeTarget
+ )
{
std::string targetXml = cmExtraEclipseCDT4Generator::EscapeForXML(target);
+ std::string makeTargetXml = targetXml;
+ if (makeTarget != NULL)
+ {
+ makeTargetXml = cmExtraEclipseCDT4Generator::EscapeForXML(makeTarget);
+ }
+ cmExtraEclipseCDT4Generator::EscapeForXML(target);
std::string pathXml = cmExtraEclipseCDT4Generator::EscapeForXML(path);
fout <<
"<target name=\"" << prefix << targetXml << "\""
@@ -1075,7 +1214,7 @@ void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout,
<< cmExtraEclipseCDT4Generator::GetEclipsePath(make)
<< "</buildCommand>\n"
"<buildArguments>" << makeArgs << "</buildArguments>\n"
- "<buildTarget>" << targetXml << "</buildTarget>\n"
+ "<buildTarget>" << makeTargetXml << "</buildTarget>\n"
"<stopOnError>true</stopOnError>\n"
"<useDefaultCommand>false</useDefaultCommand>\n"
"</target>\n"
@@ -1115,20 +1254,25 @@ void cmExtraEclipseCDT4Generator
::AppendLinkedResource (cmGeneratedFileStream& fout,
const std::string& name,
const std::string& path,
- bool isVirtualFolder)
+ LinkType linkType)
{
const char* locationTag = "location";
- if (isVirtualFolder) // ... and not a linked folder
+ const char* typeTag = "2";
+ if (linkType == VirtualFolder) // ... and not a linked folder
{
locationTag = "locationURI";
}
+ if (linkType == LinkToFile)
+ {
+ typeTag = "1";
+ }
fout <<
"\t\t<link>\n"
"\t\t\t<name>"
<< cmExtraEclipseCDT4Generator::EscapeForXML(name)
<< "</name>\n"
- "\t\t\t<type>2</type>\n"
+ "\t\t\t<type>" << typeTag << "</type>\n"
"\t\t\t<" << locationTag << ">"
<< cmExtraEclipseCDT4Generator::EscapeForXML(path)
<< "</" << locationTag << ">\n"
@@ -1177,7 +1321,7 @@ bool cmExtraEclipseCDT4Generator
else
{
this->AppendLinkedResource(fout, name,
- this->GetEclipsePath(outputPath));
+ this->GetEclipsePath(outputPath), LinkToFolder);
this->OutLinkedResources.push_back(name);
return true;
}
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index b866619..61302e7 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -25,6 +25,8 @@ class cmGeneratedFileStream;
class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
{
public:
+ enum LinkType {VirtualFolder, LinkToFolder, LinkToFile };
+
cmExtraEclipseCDT4Generator();
static cmExternalMakefileProjectGenerator* New() {
@@ -73,7 +75,8 @@ private:
const std::string& make,
const std::string& makeArguments,
const std::string& path,
- const char* prefix = "");
+ const char* prefix = "",
+ const char* makeTarget = NULL);
static void AppendScannerProfile (cmGeneratedFileStream& fout,
const std::string& profileID,
bool openActionEnabled,
@@ -88,7 +91,7 @@ private:
static void AppendLinkedResource (cmGeneratedFileStream& fout,
const std::string& name,
const std::string& path,
- bool isVirtualFolder = false);
+ LinkType linkType);
bool AppendOutLinkedResource(cmGeneratedFileStream& fout,
const std::string& defname,
@@ -101,6 +104,9 @@ private:
static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
cmMakefile* mf);
+ void CreateLinksToSubprojects(cmGeneratedFileStream& fout);
+ void CreateLinksForTargets(cmGeneratedFileStream& fout);
+
std::vector<std::string> SrcLinkedResources;
std::vector<std::string> OutLinkedResources;
std::string HomeDirectory;
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index a70427a..97308bb 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -32,7 +32,7 @@ void cmGlobalVisualStudio11Generator::AddPlatformDefinitions(cmMakefile* mf)
void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
{
fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
- fout << "# Visual Studio 2011\n";
+ fout << "# Visual Studio 11\n";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 09265ae..32eaef8 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1328,6 +1328,8 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ ");
buildphase->AddAttribute("shellScript",
this->CreateString(makecmd.c_str()));
+ buildphase->AddAttribute("showEnvVarsInLog",
+ this->CreateString("0"));
}
//----------------------------------------------------------------------------
@@ -2065,6 +2067,9 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
shellBuildPhase->AddAttribute("shellScript",
this->CreateString(
"# shell script goes here\nexit 0"));
+ shellBuildPhase->AddAttribute("showEnvVarsInLog",
+ this->CreateString("0"));
+
cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXAggregateTarget);
target->SetComment(cmtarget.GetName());
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index abda47e..a839489 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -1,3 +1,16 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -377,9 +390,8 @@ bool cmQtAutomoc::RunAutomocQt4()
// key = moc source filepath, value = moc output filepath
std::map<std::string, std::string> includedMocs;
- // key = moc source filepath, value = moc output filename
- std::map<std::string, std::string> notIncludedMocs;
-
+ // collect all headers which may need to be mocced
+ std::set<std::string> headerFiles;
std::vector<std::string> sourceFiles;
cmSystemTools::ExpandListArgument(this->Sources, sourceFiles);
@@ -393,34 +405,22 @@ bool cmQtAutomoc::RunAutomocQt4()
{
std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
}
- this->ParseCppFile(absFilename, includedMocs, notIncludedMocs);
+ this->ParseCppFile(absFilename, includedMocs, headerFiles);
}
- std::vector<std::string> headerFiles;
- cmSystemTools::ExpandListArgument(this->Headers, headerFiles);
- for (std::vector<std::string>::const_iterator it = headerFiles.begin();
- it != headerFiles.end();
+ std::vector<std::string> headerFilesVec;
+ cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec);
+ for (std::vector<std::string>::const_iterator it = headerFilesVec.begin();
+ it != headerFilesVec.end();
++it)
{
- const std::string &absFilename = *it;
- if (this->Verbose)
- {
- std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
- }
- if (includedMocs.find(absFilename) == includedMocs.end()
- && notIncludedMocs.find(absFilename) == notIncludedMocs.end())
- {
- // 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 std::string currentMoc = "moc_" + cmsys::SystemTools::
- GetFilenameWithoutLastExtension(absFilename) + ".cpp";
- notIncludedMocs[absFilename] = currentMoc;
- }
+ headerFiles.insert(*it);
}
+ // key = moc source filepath, value = moc output filename
+ std::map<std::string, std::string> notIncludedMocs;
+ this->ParseHeaders(headerFiles, includedMocs, notIncludedMocs);
+
// run moc on all the moc's that are #included in source files
for(std::map<std::string, std::string>::const_iterator
it = includedMocs.begin();
@@ -487,12 +487,11 @@ bool cmQtAutomoc::RunAutomocQt4()
void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
std::map<std::string, std::string>& includedMocs,
- std::map<std::string, std::string>& notIncludedMocs)
+ std::set<std::string>& absHeaders)
{
cmsys::RegularExpression mocIncludeRegExp(
"[\n][ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
- cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
std::list<std::string> headerExtensions;
headerExtensions.push_back(".h");
headerExtensions.push_back(".hpp");
@@ -520,52 +519,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
std::string::size_type matchOffset = 0;
- if (!mocIncludeRegExp.find(contentsString.c_str()))
- {
- // no moc #include, look whether we need to create a moc from
- // the .h nevertheless
- const std::string basename =
- cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
- for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
- ext != headerExtensions.end();
- ++ext)
- {
- const std::string headername = absPath + basename + (*ext);
- if (cmsys::SystemTools::FileExists(headername.c_str())
- && includedMocs.find(headername) == includedMocs.end()
- && notIncludedMocs.find(headername) == notIncludedMocs.end())
- {
- const std::string currentMoc = "moc_" + basename + ".cpp";
- const std::string contents = this->ReadAll(headername);
- if (qObjectRegExp.find(contents))
- {
- //std::cout << "header contains Q_OBJECT macro";
- notIncludedMocs[headername] = currentMoc;
- }
- break;
- }
- }
- for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
- ext != headerExtensions.end();
- ++ext)
- {
- const std::string privateHeaderName = absPath+basename+"_p"+(*ext);
- if (cmsys::SystemTools::FileExists(privateHeaderName.c_str())
- && includedMocs.find(privateHeaderName) == includedMocs.end()
- && notIncludedMocs.find(privateHeaderName) == notIncludedMocs.end())
- {
- const std::string currentMoc = "moc_" + basename + "_p.cpp";
- const std::string contents = this->ReadAll(privateHeaderName);
- if (qObjectRegExp.find(contents))
- {
- //std::cout << "header contains Q_OBJECT macro";
- notIncludedMocs[privateHeaderName] = currentMoc;
- }
- break;
- }
- }
- }
- else
+ if (mocIncludeRegExp.find(contentsString.c_str()))
{
// for every moc include in the file
do
@@ -581,17 +535,13 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
// the Q_OBJECT class declaration in a header file.
// If the moc include is of the foo.moc style we need to look for
// a Q_OBJECT macro in the current source file, if it contains the
- // macro we generate the moc file from the source file, else from the
- // header.
+ // macro we generate the moc file from the source file.
// Q_OBJECT
- if (moc_style || !qObjectRegExp.find(contentsString))
+ if (moc_style)
{
- if (moc_style)
- {
- // basename should be the part of the moc filename used for
- // finding the correct header, so we need to remove the moc_ part
- basename = basename.substr(4);
- }
+ // basename should be the part of the moc filename used for
+ // finding the correct header, so we need to remove the moc_ part
+ basename = basename.substr(4);
bool headerFound = false;
for(std::list<std::string>::const_iterator ext =
@@ -604,7 +554,6 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
{
headerFound = true;
includedMocs[sourceFilePath] = currentMoc;
- notIncludedMocs.erase(sourceFilePath);
break;
}
}
@@ -628,7 +577,6 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
{
headerFound = true;
includedMocs[sourceFilePath] = currentMoc;
- notIncludedMocs.erase(sourceFilePath);
break;
}
}
@@ -658,11 +606,71 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
else
{
includedMocs[absFilename] = currentMoc;
- notIncludedMocs.erase(absFilename);
}
matchOffset += mocIncludeRegExp.end();
} while(mocIncludeRegExp.find(contentsString.c_str() + matchOffset));
}
+
+ // search for header files and private header files we may need to moc:
+ const std::string basename =
+ cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
+ for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string headerName = absPath + basename + (*ext);
+ if (cmsys::SystemTools::FileExists(headerName.c_str()))
+ {
+ absHeaders.insert(headerName);
+ break;
+ }
+ }
+ for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string privateHeaderName = absPath+basename+"_p"+(*ext);
+ if (cmsys::SystemTools::FileExists(privateHeaderName.c_str()))
+ {
+ absHeaders.insert(privateHeaderName);
+ break;
+ }
+ }
+
+}
+
+
+void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders,
+ const std::map<std::string, std::string>& includedMocs,
+ std::map<std::string, std::string>& notIncludedMocs)
+{
+ cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
+ for(std::set<std::string>::const_iterator hIt=absHeaders.begin();
+ hIt!=absHeaders.end();
+ ++hIt)
+ {
+ const std::string& headerName = *hIt;
+
+ if (includedMocs.find(headerName) == includedMocs.end())
+ {
+ if (this->Verbose)
+ {
+ std::cout << "AUTOMOC: Checking " << headerName << std::endl;
+ }
+
+ const std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(headerName);
+
+ const std::string currentMoc = "moc_" + basename + ".cpp";
+ const std::string contents = this->ReadAll(headerName);
+ if (qObjectRegExp.find(contents))
+ {
+ //std::cout << "header contains Q_OBJECT macro";
+ notIncludedMocs[headerName] = currentMoc;
+ }
+ }
+ }
+
}
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
index 4fd9041..c3550a4 100644
--- a/Source/cmQtAutomoc.h
+++ b/Source/cmQtAutomoc.h
@@ -1,3 +1,16 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
#ifndef cmQtAutomoc_h
#define cmQtAutomoc_h
@@ -27,6 +40,9 @@ private:
const std::string& mocFileName);
void ParseCppFile(const std::string& absFilename,
std::map<std::string, std::string>& includedMocs,
+ std::set<std::string>& absHeaders);
+ void ParseHeaders(const std::set<std::string>& absHeaders,
+ const std::map<std::string, std::string>& includedMocs,
std::map<std::string, std::string>& notIncludedMocs);
void Init();
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e74e70c..f7d3ba9 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -642,6 +642,9 @@ void cmTarget::DefineProperties(cmake *cm)
"If the list is empty then no transitive link dependencies will be "
"incorporated when this target is linked into another target even if "
"the default set is non-empty. "
+ "This property is initialized by the value of the variable "
+ "CMAKE_LINK_INTERFACE_LIBRARIES if it is set when a target is "
+ "created. "
"This property is ignored for STATIC libraries.");
cm->DefineProperty
@@ -1176,6 +1179,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
this->SetPropertyDefault("AUTOMOC", 0);
+ this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);
// Collect the set of configuration types.
std::vector<std::string> configNames;
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index fd2ed19..04f1978 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -612,7 +612,7 @@ public:
* Up to 'length' bytes are read from the file, if more than 'percent_bin' %
* of the bytes are non-textual elements, the file is considered binary,
* otherwise textual. Textual elements are bytes in the ASCII [0x20, 0x7E]
- * range, but also \n, \r, \t.
+ * range, but also \\n, \\r, \\t.
* The algorithm is simplistic, and should probably check for usual file
* extensions, 'magic' signature, unicode, etc.
*/
@@ -812,7 +812,7 @@ public:
* Convert windows-style arguments given as a command-line string
* into more traditional argc/argv arguments.
* Note that argv[0] will be assigned the executable name using
- * the ::GetModuleFileName function.
+ * the GetModuleFileName() function.
*/
static void ConvertWindowsCommandLineToUnixArguments(
const char *cmd_line, int *argc, char ***argv);
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 0294f5b..b452f6d 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2011)
SET(KWSYS_DATE_STAMP_MONTH 10)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 23)
+SET(KWSYS_DATE_STAMP_DAY 25)
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt
index 4a5ff10..01f6bea 100644
--- a/Tests/QtAutomoc/CMakeLists.txt
+++ b/Tests/QtAutomoc/CMakeLists.txt
@@ -13,7 +13,7 @@ add_definitions(-DFOO)
# create an executable and a library target, both requiring automoc:
add_library(codeeditorLib STATIC codeeditor.cpp)
-add_executable(foo main.cpp calwidget.cpp )
+add_executable(foo main.cpp calwidget.cpp foo.cpp)
set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE)
diff --git a/Tests/QtAutomoc/foo.cpp b/Tests/QtAutomoc/foo.cpp
new file mode 100644
index 0000000..699ba09
--- /dev/null
+++ b/Tests/QtAutomoc/foo.cpp
@@ -0,0 +1,39 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "foo.h"
+
+#include <stdio.h>
+
+class FooFoo : public QObject
+{
+ Q_OBJECT
+ public:
+ FooFoo():QObject() {}
+ public slots:
+ int getValue() const { return 12; }
+};
+
+Foo::Foo()
+:QObject()
+{
+}
+
+
+void Foo::doFoo()
+{
+ FooFoo ff;
+ printf("Hello automoc: %d\n", ff.getValue());
+}
+
+#include "foo.moc"
diff --git a/Tests/QtAutomoc/foo.h b/Tests/QtAutomoc/foo.h
new file mode 100644
index 0000000..32d4c8d
--- /dev/null
+++ b/Tests/QtAutomoc/foo.h
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef FOO_H
+#define FOO_H
+
+#include <QObject>
+
+class Foo : public QObject
+{
+ Q_OBJECT
+ public:
+ Foo();
+ public slots:
+ void doFoo();
+};
+
+#endif
diff --git a/Tests/QtAutomoc/main.cpp b/Tests/QtAutomoc/main.cpp
index 7bf4a5d..b7cfb41 100644
--- a/Tests/QtAutomoc/main.cpp
+++ b/Tests/QtAutomoc/main.cpp
@@ -42,6 +42,7 @@
#include "codeeditor.h"
#include "calwidget.h"
+#include "foo.h"
int main(int argv, char **args)
{
@@ -54,5 +55,8 @@ int main(int argv, char **args)
Window w;
w.show();
+ Foo foo;
+ foo.doFoo();
+
return app.exec();
}