summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt24
-rwxr-xr-xSource/CMakeVersion.bash7
-rw-r--r--Source/CMakeVersion.cmake6
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx15
-rw-r--r--Source/CPack/cmCPackDebGenerator.h11
-rw-r--r--Source/CPack/cmCPackDocumentVariables.cxx31
-rw-r--r--Source/CPack/cmCPackGenerator.cxx72
-rw-r--r--Source/CPack/cmCPackGenerator.h42
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx106
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx18
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h2
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h11
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx84
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx2
-rw-r--r--Source/CTest/cmCTestRunTest.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx6
-rw-r--r--Source/CTest/cmParseCacheCoverage.cxx220
-rw-r--r--Source/CTest/cmParseCacheCoverage.h42
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx272
-rw-r--r--Source/CTest/cmParseGTMCoverage.h49
-rw-r--r--Source/CTest/cmParseMumpsCoverage.cxx165
-rw-r--r--Source/CTest/cmParseMumpsCoverage.h52
-rw-r--r--Source/CTest/cmParsePHPCoverage.h3
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx2
-rw-r--r--Source/cmAddLibraryCommand.cxx15
-rw-r--r--Source/cmArchiveWrite.cxx1
-rw-r--r--Source/cmCTest.cxx23
-rw-r--r--Source/cmCoreTryCompile.cxx5
-rw-r--r--Source/cmDependsFortranLexer.cxx552
-rw-r--r--Source/cmDependsFortranLexer.h25
-rw-r--r--Source/cmDependsFortranLexer.in.l5
-rw-r--r--Source/cmDependsFortranParser.cxx810
-rw-r--r--Source/cmDependsFortranParser.y8
-rw-r--r--Source/cmDependsFortranParserTokens.h20
-rw-r--r--Source/cmDocumentVariables.cxx48
-rw-r--r--Source/cmDocumentationFormatterHTML.cxx12
-rw-r--r--Source/cmExportFileGenerator.cxx16
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx46
-rw-r--r--Source/cmExtraCodeBlocksGenerator.h2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx13
-rw-r--r--Source/cmFileCommand.cxx8
-rw-r--r--Source/cmFindPackageCommand.cxx121
-rw-r--r--Source/cmFindPackageCommand.h2
-rw-r--r--Source/cmGeneratorTarget.cxx7
-rw-r--r--Source/cmGeneratorTarget.h1
-rw-r--r--Source/cmGlobalGenerator.cxx49
-rw-r--r--Source/cmGlobalGenerator.h8
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx3
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx216
-rw-r--r--Source/cmGlobalNinjaGenerator.h23
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx21
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx72
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h21
-rw-r--r--Source/cmGlobalVisualStudio11ARMGenerator.cxx32
-rw-r--r--Source/cmGlobalVisualStudio11ARMGenerator.h37
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx14
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx28
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx25
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmIfCommand.cxx13
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx67
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h12
-rw-r--r--Source/cmInstallCommand.cxx77
-rw-r--r--Source/cmInstallCommand.h4
-rw-r--r--Source/cmInstallCommandArguments.cxx19
-rw-r--r--Source/cmInstallCommandArguments.h11
-rw-r--r--Source/cmInstallFilesCommand.cxx32
-rw-r--r--Source/cmInstallGenerator.cxx12
-rw-r--r--Source/cmInstallProgramsCommand.cxx26
-rw-r--r--Source/cmInstallTargetsCommand.cxx3
-rw-r--r--Source/cmListCommand.cxx15
-rw-r--r--Source/cmLocalGenerator.cxx157
-rw-r--r--Source/cmLocalGenerator.h14
-rw-r--r--Source/cmLocalNinjaGenerator.cxx18
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx51
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx8
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx6
-rw-r--r--Source/cmMakefile.cxx88
-rw-r--r--Source/cmMakefile.h38
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx32
-rw-r--r--Source/cmMakefileTargetGenerator.h1
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx152
-rw-r--r--Source/cmNinjaNormalTargetGenerator.h2
-rw-r--r--Source/cmNinjaTargetGenerator.cxx140
-rw-r--r--Source/cmNinjaTargetGenerator.h3
-rw-r--r--Source/cmPolicies.cxx28
-rw-r--r--Source/cmPolicies.h3
-rw-r--r--Source/cmQtAutomoc.cxx12
-rw-r--r--Source/cmSetCommand.h88
-rw-r--r--Source/cmSystemTools.cxx52
-rw-r--r--Source/cmSystemTools.h12
-rw-r--r--Source/cmTarget.cxx60
-rw-r--r--Source/cmTarget.h3
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h3
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx144
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h16
-rw-r--r--Source/cmake.cxx7
-rw-r--r--Source/cmcldeps.cxx736
-rw-r--r--Source/kwsys/CMakeLists.txt86
-rw-r--r--Source/kwsys/DateStamp.h.in42
-rw-r--r--Source/kwsys/SystemInformation.cxx2
-rw-r--r--Source/kwsys/SystemTools.cxx232
-rw-r--r--Source/kwsys/SystemTools.hxx.in6
-rw-r--r--Source/kwsys/hash_fun.hxx.in5
-rw-r--r--Source/kwsys/hashtable.hxx.in2
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake21
-rwxr-xr-xSource/kwsys/kwsysDateStamp.py54
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx35
-rw-r--r--Source/kwsys/testSystemTools.cxx54
115 files changed, 4762 insertions, 1504 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index f9d1c03..2c6bc76 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -337,6 +337,8 @@ IF (WIN32)
cmGlobalVisualStudio11Generator.cxx
cmGlobalVisualStudio11Win64Generator.h
cmGlobalVisualStudio11Win64Generator.cxx
+ cmGlobalVisualStudio11ARMGenerator.h
+ cmGlobalVisualStudio11ARMGenerator.cxx
cmGlobalVisualStudioGenerator.cxx
cmGlobalVisualStudioGenerator.h
cmGlobalWatcomWMakeGenerator.cxx
@@ -355,18 +357,18 @@ IF (WIN32)
ENDIF(NOT UNIX)
ENDIF (WIN32)
-# turn on Ninja by default
+# Turn on Ninja by default, but disable it
+# on platforms where it does not pass all tests.
+# Enforce Ninja support by setting CMAKE_USE_NINJA
set(_CMAKE_DEFAULT_NINJA_VALUE TRUE)
-# turn it off for platforms where it does not pass all the
-# tests
-if(WIN32 OR APPLE)
+if(APPLE)
SET(_CMAKE_DEFAULT_NINJA_VALUE FALSE)
endif()
SET(CMAKE_ENABLE_NINJA ${_CMAKE_DEFAULT_NINJA_VALUE} CACHE BOOL
- "Enable the ninja generator for CMake. currently not fully working for Windows or OSX")
+ "Enable the ninja generator for CMake. When enabled, some CMake tests still fail on OSX")
MARK_AS_ADVANCED(CMAKE_ENABLE_NINJA)
IF(CMAKE_ENABLE_NINJA)
- MESSAGE(STATUS "Enable ninja generator.")
+ MESSAGE(STATUS "Ninja generator enabled.")
SET(SRCS ${SRCS}
cmGlobalNinjaGenerator.cxx
cmGlobalNinjaGenerator.h
@@ -381,8 +383,13 @@ IF(CMAKE_ENABLE_NINJA)
cmNinjaUtilityTargetGenerator.h
)
ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
+ IF(WIN32 AND NOT CYGWIN AND NOT BORLAND)
+ SET_SOURCE_FILES_PROPERTIES(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
+ ADD_EXECUTABLE(cmcldeps cmcldeps.cxx)
+ INSTALL_TARGETS(/bin cmcldeps)
+ ENDIF()
ELSE()
- MESSAGE(STATUS "Disable ninja generator.")
+ MESSAGE(STATUS "Ninja generator disabled, enable it with -DCMAKE_ENABLE_NINJA=ON")
ENDIF()
# create a library used by the command line and the GUI
@@ -423,6 +430,9 @@ SET(CTEST_SRCS cmCTest.cxx
CTest/cmCTestConfigureHandler.cxx
CTest/cmCTestCoverageCommand.cxx
CTest/cmCTestCoverageHandler.cxx
+ CTest/cmParseMumpsCoverage.cxx
+ CTest/cmParseCacheCoverage.cxx
+ CTest/cmParseGTMCoverage.cxx
CTest/cmParsePHPCoverage.cxx
CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
CTest/cmCTestGenericHandler.cxx
diff --git a/Source/CMakeVersion.bash b/Source/CMakeVersion.bash
new file mode 100755
index 0000000..126adba
--- /dev/null
+++ b/Source/CMakeVersion.bash
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+# Update the version component if it looks like a date or -f is given.
+if test "x$1" = "x-f"; then shift ; n='*' ; else n='\{8\}' ; fi
+if test "$#" -gt 0; then echo 1>&2 "usage: CMakeVersion.bash [-f]"; exit 1; fi
+sed -i -e '
+s/\(^SET(CMake_VERSION_TWEAK\) [0-9]'"$n"'\(.*\)/\1 '"$(date +%Y%m%d)"'\2/
+' "${BASH_SOURCE%/*}/CMakeVersion.cmake"
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
new file mode 100644
index 0000000..8dd5b7f
--- /dev/null
+++ b/Source/CMakeVersion.cmake
@@ -0,0 +1,6 @@
+# CMake version number components.
+SET(CMake_VERSION_MAJOR 2)
+SET(CMake_VERSION_MINOR 8)
+SET(CMake_VERSION_PATCH 8)
+SET(CMake_VERSION_TWEAK 20120621)
+#SET(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 178a18d..fa456de 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -480,11 +480,16 @@ int cmCPackDebGenerator::createDeb()
// Do not end the md5sum file with yet another (invalid)
}
- cmd = "\"";
- cmd += cmakeExecutable;
- cmd += "\" -E tar cfz control.tar.gz ./control ./md5sums";
- const char* controlExtra =
- this->GetOption("CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA");
+ cmd = "";
+ if (NULL != this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE"))
+ {
+ cmd = this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
+ }
+ cmd += " \"";
+ cmd += cmakeExecutable;
+ cmd += "\" -E tar cfz control.tar.gz ./control ./md5sums";
+ const char* controlExtra =
+ this->GetOption("CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA");
if( controlExtra )
{
std::vector<std::string> controlExtraList;
diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h
index f536c47..7f2352f 100644
--- a/Source/CPack/cmCPackDebGenerator.h
+++ b/Source/CPack/cmCPackDebGenerator.h
@@ -31,6 +31,17 @@ public:
cmCPackDebGenerator();
virtual ~cmCPackDebGenerator();
+ static bool CanGenerate()
+ {
+#ifdef __APPLE__
+ // on MacOS enable CPackDeb iff dpkg is found
+ return cmSystemTools::FindProgram("dpkg") != "" ? true : false;
+#else
+ // legacy behavior on other systems
+ return true;
+#endif
+ }
+
protected:
virtual int InitializeInternal();
/**
diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx
index d2e3802..edbef45 100644
--- a/Source/CPack/cmCPackDocumentVariables.cxx
+++ b/Source/CPack/cmCPackDocumentVariables.cxx
@@ -77,4 +77,35 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm)
"which is done right before packaging the files."
" The script is not called by e.g.: make install.", false,
"Variables common to all CPack generators");
+
+ cm->DefineProperty
+ ("CPACK_ABSOLUTE_DESTINATION_FILES", cmProperty::VARIABLE,
+ "List of files which have been installed using "
+ " an ABSOLUTE DESTINATION path.",
+ "This variable is a Read-Only variable which is set internally"
+ " by CPack during installation and before packaging using"
+ " CMAKE_ABSOLUTE_DESTINATION_FILES defined in cmake_install.cmake "
+ "scripts. The value can be used within CPack project configuration"
+ " file and/or CPack<GEN>.cmake file of <GEN> generator.", false,
+ "Variables common to all CPack generators");
+
+ cm->DefineProperty
+ ("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", cmProperty::VARIABLE,
+ "Ask CPack to warn each time a file with absolute INSTALL"
+ " DESTINATION is encountered.",
+ "This variable triggers the definition of "
+ "CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION when CPack runs"
+ " cmake_install.cmake scripts.", false,
+ "Variables common to all CPack generators");
+
+ cm->DefineProperty
+ ("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", cmProperty::VARIABLE,
+ "Ask CPack to error out as soon as a file with absolute INSTALL"
+ " DESTINATION is encountered.",
+ "The fatal error is emitted before the installation of "
+ "the offending file takes place. Some CPack generators, like NSIS,"
+ "enforce this internally. "
+ "This variable triggers the definition of"
+ "CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION when CPack runs"
+ "Variables common to all CPack generators");
}
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 0f832b3..0177653 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -62,10 +62,31 @@ void cmCPackGenerator::DisplayVerboseOutput(const char* msg,
//----------------------------------------------------------------------
int cmCPackGenerator::PrepareNames()
-{
+{
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Create temp directory." << std::endl);
+ // checks CPACK_SET_DESTDIR support
+ if (IsOn("CPACK_SET_DESTDIR"))
+ {
+ if (SETDESTDIR_UNSUPPORTED==SupportsSetDestdir())
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "CPACK_SET_DESTDIR is set to ON but the '"
+ << Name << "' generator does NOT support it."
+ << std::endl);
+ return 0;
+ }
+ else if (SETDESTDIR_SHOULD_NOT_BE_USED==SupportsSetDestdir())
+ {
+ cmCPackLogger(cmCPackLog::LOG_WARNING,
+ "CPACK_SET_DESTDIR is set to ON but it is "
+ << "usually a bad idea to do that with '"
+ << Name << "' generator. Use at your own risk."
+ << std::endl);
+ }
+ }
+
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
tempDirectory += "/_CPack_Packages/";
const char* toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
@@ -388,8 +409,11 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
std::string>(targetFile,inFileRelative));
}
/* If it is not a symlink then do a plain copy */
- else if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
- filePath.c_str()) )
+ else if (!(
+ cmSystemTools::CopyFileIfDifferent(inFile.c_str(),filePath.c_str())
+ &&
+ cmSystemTools::CopyFileTime(inFile.c_str(),filePath.c_str())
+ ) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: "
<< inFile.c_str() << " -> " << filePath.c_str() << std::endl);
@@ -828,8 +852,35 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
filesBefore = glB.GetFiles();
std::sort(filesBefore.begin(),filesBefore.end());
}
+
+ // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION
+ // then forward request to cmake_install.cmake script
+ if (this->GetOption("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION"))
+ {
+ mf->AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION",
+ "1");
+ }
+ // If current CPack generator does support
+ // ABSOLUTE INSTALL DESTINATION or CPack has been asked for
+ // then ask cmake_install.cmake script to error out
+ // as soon as it occurs (before installing file)
+ if (!SupportsAbsoluteDestination() ||
+ this->GetOption("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION"))
+ {
+ mf->AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION",
+ "1");
+ }
// do installation
int res = mf->ReadListFile(0, installFile.c_str());
+ // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
+ // to CPack (may be used by generators like CPack RPM or DEB)
+ // in order to transparently handle ABSOLUTE PATH
+ if (mf->GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES"))
+ {
+ mf->AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES",
+ mf->GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES"));
+ }
+
// Now rebuild the list of files after installation
// of the current component (if we are in component install)
if (componentInstall)
@@ -953,6 +1004,8 @@ int cmCPackGenerator::DoPackage()
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Create package using " << this->Name.c_str() << std::endl);
+ // Prepare CPack internal name and check
+ // values for many CPACK_xxx vars
if ( !this->PrepareNames() )
{
return 0;
@@ -1431,6 +1484,19 @@ std::string cmCPackGenerator::GetComponentPackageFileName(
}
//----------------------------------------------------------------------
+enum cmCPackGenerator::CPackSetDestdirSupport
+cmCPackGenerator::SupportsSetDestdir() const
+{
+ return cmCPackGenerator::SETDESTDIR_SUPPORTED;
+}
+
+//----------------------------------------------------------------------
+bool cmCPackGenerator::SupportsAbsoluteDestination() const
+{
+ return true;
+}
+
+//----------------------------------------------------------------------
bool cmCPackGenerator::SupportsComponentInstallation() const
{
return false;
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 55afb44..6748512 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -63,6 +63,16 @@ public:
cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; }
/**
+ * Returns true if the generator may work on this system.
+ * Rational:
+ * Some CPack generator may run on some host and may not on others
+ * (with the same system) because some tools are missing. If the tool
+ * is missing then CPack won't activate (in the CPackGeneratorFactory)
+ * this particular generator.
+ */
+ static bool CanGenerate() { return true; }
+
+ /**
* Do the actual whole package processing.
* Subclass may redefine it but its usually enough
* to redefine @ref PackageFiles, because in fact
@@ -190,6 +200,38 @@ protected:
bool setDestDir, const char* tempInstallDirectory);
/**
+ * The various level of support of
+ * CPACK_SET_DESTDIR used by the generator.
+ */
+ enum CPackSetDestdirSupport {
+ /* the generator works with or without it */
+ SETDESTDIR_SUPPORTED,
+ /* the generator works best if automatically handled */
+ SETDESTDIR_INTERNALLY_SUPPORTED,
+ /* no official support, use at your own risk */
+ SETDESTDIR_SHOULD_NOT_BE_USED,
+ /* officially NOT supported */
+ SETDESTDIR_UNSUPPORTED
+ };
+
+ /**
+ * Does the CPack generator support CPACK_SET_DESTDIR?
+ * The default legacy value is 'SETDESTDIR_SUPPORTED' generator
+ * have to override it in order change this.
+ * @return CPackSetDestdirSupport
+ */
+ virtual enum CPackSetDestdirSupport SupportsSetDestdir() const;
+
+ /**
+ * Does the CPack generator support absolute path
+ * in INSTALL DESTINATION?
+ * The default legacy value is 'true' generator
+ * have to override it in order change this.
+ * @return true if supported false otherwise
+ */
+ virtual bool SupportsAbsoluteDestination() const;
+
+ /**
* Does the CPack generator support component installation?.
* Some Generators requires the user to set
* CPACK_<GENNAME>_COMPONENT_INSTALL in order to make this
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index a04b403..37ff460 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -31,7 +31,7 @@
# include "cmCPackCygwinSourceGenerator.h"
#endif
-#if !defined(_WIN32) && !defined(__APPLE__) \
+#if !defined(_WIN32) \
&& !defined(__QNXNTO__) && !defined(__BEOS__)
# include "cmCPackDebGenerator.h"
# include "cmCPackRPMGenerator.h"
@@ -40,44 +40,90 @@
#include "cmCPackLog.h"
+#if defined(__BORLANDC__)
+# pragma warn -8008 /* condition is always true */
+#endif
+
//----------------------------------------------------------------------
cmCPackGeneratorFactory::cmCPackGeneratorFactory()
{
- this->RegisterGenerator("TGZ", "Tar GZip compression",
- cmCPackTGZGenerator::CreateGenerator);
- this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
- cmCPackSTGZGenerator::CreateGenerator);
- this->RegisterGenerator("NSIS", "Null Soft Installer",
- cmCPackNSISGenerator::CreateGenerator);
+ if (cmCPackTGZGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("TGZ", "Tar GZip compression",
+ cmCPackTGZGenerator::CreateGenerator);
+ }
+ if (cmCPackSTGZGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
+ cmCPackSTGZGenerator::CreateGenerator);
+ }
+ if (cmCPackNSISGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("NSIS", "Null Soft Installer",
+ cmCPackNSISGenerator::CreateGenerator);
+ }
#ifdef __CYGWIN__
- this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
- cmCPackCygwinBinaryGenerator::CreateGenerator);
- this->RegisterGenerator("CygwinSource", "Cygwin Source Installer",
- cmCPackCygwinSourceGenerator::CreateGenerator);
+ if (cmCPackCygwinBinaryGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
+ cmCPackCygwinBinaryGenerator::CreateGenerator);
+ }
+ if (cmCPackCygwinSourceGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("CygwinSource", "Cygwin Source Installer",
+ cmCPackCygwinSourceGenerator::CreateGenerator);
+ }
#endif
- this->RegisterGenerator("ZIP", "ZIP file format",
- cmCPackZIPGenerator::CreateGenerator);
- this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
- cmCPackTarBZip2Generator::CreateGenerator);
- this->RegisterGenerator("TZ", "Tar Compress compression",
- cmCPackTarCompressGenerator::CreateGenerator);
+ if (cmCPackZIPGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("ZIP", "ZIP file format",
+ cmCPackZIPGenerator::CreateGenerator);
+ }
+ if (cmCPackTarBZip2Generator::CanGenerate())
+ {
+ this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
+ cmCPackTarBZip2Generator::CreateGenerator);
+ }
+ if (cmCPackTarCompressGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("TZ", "Tar Compress compression",
+ cmCPackTarCompressGenerator::CreateGenerator);
+ }
#ifdef __APPLE__
- this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop",
- cmCPackDragNDropGenerator::CreateGenerator);
- this->RegisterGenerator("Bundle", "Mac OSX bundle",
- cmCPackBundleGenerator::CreateGenerator);
- this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer",
- cmCPackPackageMakerGenerator::CreateGenerator);
- this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle",
- cmCPackOSXX11Generator::CreateGenerator);
+ if (cmCPackDragNDropGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop",
+ cmCPackDragNDropGenerator::CreateGenerator);
+ }
+ if (cmCPackBundleGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("Bundle", "Mac OSX bundle",
+ cmCPackBundleGenerator::CreateGenerator);
+ }
+ if (cmCPackPackageMakerGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer",
+ cmCPackPackageMakerGenerator::CreateGenerator);
+ }
+ if (cmCPackOSXX11Generator::CanGenerate())
+ {
+ this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle",
+ cmCPackOSXX11Generator::CreateGenerator);
+ }
#endif
-#if !defined(_WIN32) && !defined(__APPLE__) \
+#if !defined(_WIN32) \
&& !defined(__QNXNTO__) && !defined(__BEOS__)
- this->RegisterGenerator("DEB", "Debian packages",
- cmCPackDebGenerator::CreateGenerator);
- this->RegisterGenerator("RPM", "RPM packages",
- cmCPackRPMGenerator::CreateGenerator);
+ if (cmCPackDebGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("DEB", "Debian packages",
+ cmCPackDebGenerator::CreateGenerator);
+ }
+ if (cmCPackRPMGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("RPM", "RPM packages",
+ cmCPackRPMGenerator::CreateGenerator);
+ }
#endif
}
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 0787ef9..7b52511 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -64,6 +64,7 @@ int cmCPackNSISGenerator::PackageFiles()
<< std::endl);
return false;
}
+
std::string nsisFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string tmpFile = nsisFileName;
tmpFile += "/NSISOutput.log";
@@ -542,8 +543,8 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str,
{
cmCPackLogger(
cmCPackLog::LOG_ERROR,
- "CPACK_PACKAGE_EXECUTABLES should contain pairs of <executable> and "
- "<icon name>." << std::endl);
+ "CPACK_NSIS_MENU_LINKS should contain pairs of <shortcut target> and "
+ "<shortcut label>." << std::endl);
return;
}
@@ -631,6 +632,19 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(const char* topdir,
}
//----------------------------------------------------------------------
+enum cmCPackGenerator::CPackSetDestdirSupport
+cmCPackNSISGenerator::SupportsSetDestdir() const
+{
+ return cmCPackGenerator::SETDESTDIR_SHOULD_NOT_BE_USED;
+}
+
+//----------------------------------------------------------------------
+bool cmCPackNSISGenerator::SupportsAbsoluteDestination() const
+{
+ return false;
+}
+
+//----------------------------------------------------------------------
bool cmCPackNSISGenerator::SupportsComponentInstallation() const
{
return true;
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index 7bccb89..8224854 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -44,6 +44,8 @@ protected:
bool GetListOfSubdirectories(const char* dir,
std::vector<std::string>& dirs);
+ enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
+ virtual bool SupportsAbsoluteDestination() const;
virtual bool SupportsComponentInstallation() const;
/// Produce a string that contains the NSIS code to describe a
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index 4883a0d..eec8204 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -35,6 +35,17 @@ public:
cmCPackRPMGenerator();
virtual ~cmCPackRPMGenerator();
+ static bool CanGenerate()
+ {
+#ifdef __APPLE__
+ // on MacOS enable CPackRPM iff rpmbuild is found
+ return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false;
+#else
+ // legacy behavior on other systems
+ return true;
+#endif
+ }
+
protected:
virtual int InitializeInternal();
virtual int PackageFiles();
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 309abb1..81d3669 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmCTestCoverageHandler.h"
#include "cmParsePHPCoverage.h"
+#include "cmParseGTMCoverage.h"
+#include "cmParseCacheCoverage.h"
#include "cmCTest.h"
#include "cmake.h"
#include "cmMakefile.h"
@@ -373,21 +375,29 @@ int cmCTestCoverageHandler::ProcessHandler()
}
int file_count = 0;
file_count += this->HandleGCovCoverage(&cont);
+ error = cont.Error;
if ( file_count < 0 )
{
return error;
}
file_count += this->HandleTracePyCoverage(&cont);
+ error = cont.Error;
if ( file_count < 0 )
{
return error;
}
file_count += this->HandlePHPCoverage(&cont);
+ error = cont.Error;
if ( file_count < 0 )
{
return error;
}
+ file_count += this->HandleMumpsCoverage(&cont);
error = cont.Error;
+ if ( file_count < 0 )
+ {
+ return error;
+ }
std::set<std::string> uncovered = this->FindUncoveredFiles(&cont);
@@ -751,6 +761,73 @@ int cmCTestCoverageHandler::HandlePHPCoverage(
}
return static_cast<int>(cont->TotalCoverage.size());
}
+//----------------------------------------------------------------------
+int cmCTestCoverageHandler::HandleMumpsCoverage(
+ cmCTestCoverageHandlerContainer* cont)
+{
+ // try gtm coverage
+ cmParseGTMCoverage cov(*cont, this->CTest);
+ std::string coverageFile = this->CTest->GetBinaryDir() +
+ "/gtm_coverage.mcov";
+ if(cmSystemTools::FileExists(coverageFile.c_str()))
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Parsing Cache Coverage: " << coverageFile
+ << std::endl);
+ cov.ReadCoverageFile(coverageFile.c_str());
+ return static_cast<int>(cont->TotalCoverage.size());
+ }
+ else
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ " Cannot find foobar GTM coverage file: " << coverageFile
+ << std::endl);
+ }
+ cmParseCacheCoverage ccov(*cont, this->CTest);
+ coverageFile = this->CTest->GetBinaryDir() +
+ "/cache_coverage.cmcov";
+ if(cmSystemTools::FileExists(coverageFile.c_str()))
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Parsing Cache Coverage: " << coverageFile
+ << std::endl);
+ ccov.ReadCoverageFile(coverageFile.c_str());
+ }
+ else
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ " Cannot find Cache coverage file: " << coverageFile
+ << std::endl);
+ }
+ return static_cast<int>(cont->TotalCoverage.size());
+}
+
+struct cmCTestCoverageHandlerLocale
+{
+ cmCTestCoverageHandlerLocale()
+ {
+ if(const char* l = cmSystemTools::GetEnv("LC_ALL"))
+ {
+ lc_all = l;
+ }
+ if(lc_all != "C")
+ {
+ cmSystemTools::PutEnv("LC_ALL=C");
+ }
+ }
+ ~cmCTestCoverageHandlerLocale()
+ {
+ if(!lc_all.empty())
+ {
+ cmSystemTools::PutEnv(("LC_ALL=" + lc_all).c_str());
+ }
+ else
+ {
+ cmSystemTools::UnsetEnv("LC_ALL");
+ }
+ }
+ std::string lc_all;
+};
//----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleGCovCoverage(
@@ -773,7 +850,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
std::string st2gcovOutputRex1 = "^File *[`'](.*)'$";
std::string st2gcovOutputRex2
= "Lines executed: *[0-9]+\\.[0-9]+% of [0-9]+$";
- std::string st2gcovOutputRex3 = "^(.*):creating [`'](.*\\.gcov)'";
+ std::string st2gcovOutputRex3 = "^(.*)reating [`'](.*\\.gcov)'";
std::string st2gcovOutputRex4 = "^(.*):unexpected EOF *$";
std::string st2gcovOutputRex5 = "^(.*):cannot open source file*$";
std::string st2gcovOutputRex6
@@ -815,7 +892,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
int file_count = 0;
// make sure output from gcov is in English!
- cmSystemTools::PutEnv("LC_ALL=POSIX");
+ cmCTestCoverageHandlerLocale locale_C;
+ static_cast<void>(locale_C);
// files is a list of *.da and *.gcda files with coverage data in them.
// These are binary files that you give as input to gcov so that it will
@@ -1778,7 +1856,7 @@ int cmCTestCoverageHandler::HandleBullseyeCoverage(
cmCTestCoverageHandlerContainer* cont)
{
const char* covfile = cmSystemTools::GetEnv("COVFILE");
- if(!covfile)
+ if(!covfile || strlen(covfile) == 0)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" COVFILE environment variable not found, not running "
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index d3e8503..92b0b22 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -70,6 +70,8 @@ private:
//! Handle coverage using xdebug php coverage
int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont);
+ //! Handle coverage for mumps
+ int HandleMumpsCoverage(cmCTestCoverageHandlerContainer* cont);
//! Handle coverage using Bullseye
int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont);
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 035aaa9..3e4ecdd 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -358,7 +358,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
os
<< "\t\t</Results>\n"
- << logTag << memcheckstr << std::endl
+ << logTag << cmXMLSafe(memcheckstr) << std::endl
<< "\t</Log>\n";
this->WriteTestResultFooter(os, result);
if ( current < cc )
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 81f18b0..c3de5dc 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -671,7 +671,7 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout,
if (environment && environment->size()>0)
{
- cmSystemTools::AppendEnv(environment);
+ cmSystemTools::AppendEnv(*environment);
}
return this->TestProcess->StartProcess();
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 5841b8d..d3ab2ef 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -643,11 +643,7 @@ int cmCTestScriptHandler::RunCurrentScript()
{
std::vector<std::string> envArgs;
cmSystemTools::ExpandListArgument(this->CTestEnv.c_str(),envArgs);
- // for each variable/argument do a putenv
- for (unsigned i = 0; i < envArgs.size(); ++i)
- {
- cmSystemTools::PutEnv(envArgs[i].c_str());
- }
+ cmSystemTools::AppendEnv(envArgs);
}
// now that we have done most of the error checking finally run the
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx
new file mode 100644
index 0000000..137f344
--- /dev/null
+++ b/Source/CTest/cmParseCacheCoverage.cxx
@@ -0,0 +1,220 @@
+#include "cmStandardIncludes.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "cmSystemTools.h"
+#include "cmParseCacheCoverage.h"
+#include <cmsys/Directory.hxx>
+#include <cmsys/Glob.hxx>
+
+
+cmParseCacheCoverage::cmParseCacheCoverage(
+ cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest)
+ :cmParseMumpsCoverage(cont, ctest)
+{
+}
+
+
+bool cmParseCacheCoverage::LoadCoverageData(const char* d)
+{
+ // load all the .mcov files in the specified directory
+ cmsys::Directory dir;
+ if(!dir.Load(d))
+ {
+ return false;
+ }
+ size_t numf;
+ unsigned int i;
+ numf = dir.GetNumberOfFiles();
+ for (i = 0; i < numf; i++)
+ {
+ std::string file = dir.GetFile(i);
+ if(file != "." && file != ".."
+ && !cmSystemTools::FileIsDirectory(file.c_str()))
+ {
+ std::string path = d;
+ path += "/";
+ path += file;
+ if(cmSystemTools::GetFilenameLastExtension(path) == ".cmcov")
+ {
+ if(!this->ReadCMCovFile(path.c_str()))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+}
+
+// not currently used, but leave it in case we want it in the future
+void cmParseCacheCoverage::RemoveUnCoveredFiles()
+{
+ // loop over the coverage data computed and remove all files
+ // that only have -1 or 0 for the lines.
+ cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator ci =
+ this->Coverage.TotalCoverage.begin();
+ while(ci != this->Coverage.TotalCoverage.end())
+ {
+ cmCTestCoverageHandlerContainer::SingleFileCoverageVector& v =
+ ci->second;
+ bool nothing = true;
+ for(cmCTestCoverageHandlerContainer::SingleFileCoverageVector::iterator i=
+ v.begin(); i != v.end(); ++i)
+ {
+ if(*i > 0)
+ {
+ nothing = false;
+ break;
+ }
+ }
+ if(nothing)
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "No coverage found in: " << ci->first
+ << std::endl);
+ this->Coverage.TotalCoverage.erase(ci++);
+ }
+ else
+ {
+ ++ci;
+ }
+ }
+}
+
+bool cmParseCacheCoverage::SplitString(std::vector<std::string>& args,
+ std::string const& line)
+{
+ std::string::size_type pos1 = 0;
+ std::string::size_type pos2 = line.find(',', 0);
+ if(pos2 == std::string::npos)
+ {
+ return false;
+ }
+ std::string arg;
+ while(pos2 != std::string::npos)
+ {
+ arg = line.substr(pos1, pos2-pos1);
+ args.push_back(arg);
+ pos1 = pos2+1;
+ pos2 = line.find(',',pos1);
+ }
+ arg = line.substr(pos1);
+ args.push_back(arg);
+ return true;
+}
+
+bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
+{
+ std::ifstream in(file);
+ if(!in)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Can not open : "
+ << file << "\n");
+ return false;
+ }
+ std::string line;
+ std::vector<std::string> separateLine;
+ if(!cmSystemTools::GetLineFromStream(in, line))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Empty file : "
+ << file << " referenced in this line of cmcov data:\n"
+ "[" << line << "]\n");
+ return false;
+ }
+ separateLine.clear();
+ this->SplitString(separateLine, line);
+ if(separateLine.size() !=4 || separateLine[0] != "Routine"
+ || separateLine[1] != "Line" || separateLine[2] != "RtnLine"
+ || separateLine[3] != "Code")
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Bad first line of cmcov file : "
+ << file << " line:\n"
+ "[" << line << "]\n");
+ }
+ std::string routine;
+ std::string filepath;
+ while(cmSystemTools::GetLineFromStream(in, line))
+ {
+ // clear out line argument vector
+ separateLine.clear();
+ // parse the comma separated line
+ this->SplitString(separateLine, line);
+ // might have more because code could have a quoted , in it
+ // but we only care about the first 3 args anyway
+ if(separateLine.size() < 4)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Bad line of cmcov file expected at least 4 found: "
+ << separateLine.size() << " "
+ << file << " line:\n"
+ "[" << line << "]\n");
+ for(std::string::size_type i = 0; i < separateLine.size(); ++i)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,""
+ << separateLine[1] << " ");
+ }
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "\n");
+ return false;
+ }
+ // if we do not have a routine yet, then it should be
+ // the first argument in the vector
+ if(routine.size() == 0)
+ {
+ routine = separateLine[0];
+ // Find the full path to the file
+ if(!this->FindMumpsFile(routine, filepath))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Could not find mumps file for routine: "
+ << routine << "\n");
+ filepath = "";
+ continue; // move to next line
+ }
+ }
+ // if we have a routine name, check for end of routine
+ else
+ {
+ // Totals in arg 0 marks the end of a routine
+ if(separateLine[0].substr(0, 6) == "Totals")
+ {
+ routine = ""; // at the end of this routine
+ filepath = "";
+ continue; // move to next line
+ }
+ }
+ // if the file path was not found for the routine
+ // move to next line. We should have already warned
+ // after the call to FindMumpsFile that we did not find
+ // it, so don't report again to cut down on output
+ if(filepath.size() == 0)
+ {
+ continue;
+ }
+ // now we are ready to set the coverage from the line of data
+ cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
+ coverageVector = this->Coverage.TotalCoverage[filepath];
+ std::string::size_type linenumber = atoi(separateLine[1].c_str()) -1;
+ int count = atoi(separateLine[2].c_str());
+ if(linenumber > coverageVector.size())
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Parse error line is greater than number of lines in file: "
+ << linenumber << " " << filepath << "\n");
+ continue; // skip setting count to avoid crash
+ }
+ // now add to count for linenumber
+ // for some reason the cache coverage adds extra lines to the
+ // end of the file in some cases. Since they do not exist, we will
+ // mark them as non executable
+ while(linenumber >= coverageVector.size())
+ {
+ coverageVector.push_back(-1);
+ }
+ coverageVector[linenumber] += count;
+ }
+ return true;
+}
diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h
new file mode 100644
index 0000000..114eb92
--- /dev/null
+++ b/Source/CTest/cmParseCacheCoverage.h
@@ -0,0 +1,42 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ 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 cmParseCacheCoverage_h
+#define cmParseCacheCoverage_h
+
+#include "cmParseMumpsCoverage.h"
+
+/** \class cmParseCacheCoverage
+ * \brief Parse Cache coverage information
+ *
+ * This class is used to parse Cache coverage information for
+ * mumps.
+ */
+class cmParseCacheCoverage : public cmParseMumpsCoverage
+{
+public:
+ cmParseCacheCoverage(cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest);
+protected:
+ // implement virtual from parent
+ bool LoadCoverageData(const char* dir);
+ // remove files with no coverage
+ void RemoveUnCoveredFiles();
+ // Read a single mcov file
+ bool ReadCMCovFile(const char* f);
+ // split a string based on ,
+ bool SplitString(std::vector<std::string>& args,
+ std::string const& line);
+};
+
+
+#endif
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
new file mode 100644
index 0000000..5dfcfe5
--- /dev/null
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -0,0 +1,272 @@
+#include "cmStandardIncludes.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "cmSystemTools.h"
+#include "cmParseGTMCoverage.h"
+#include <cmsys/Directory.hxx>
+#include <cmsys/Glob.hxx>
+
+
+cmParseGTMCoverage::cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest)
+ :cmParseMumpsCoverage(cont, ctest)
+{
+}
+
+
+bool cmParseGTMCoverage::LoadCoverageData(const char* d)
+{
+ // load all the .mcov files in the specified directory
+ cmsys::Directory dir;
+ if(!dir.Load(d))
+ {
+ return false;
+ }
+ size_t numf;
+ unsigned int i;
+ numf = dir.GetNumberOfFiles();
+ for (i = 0; i < numf; i++)
+ {
+ std::string file = dir.GetFile(i);
+ if(file != "." && file != ".."
+ && !cmSystemTools::FileIsDirectory(file.c_str()))
+ {
+ std::string path = d;
+ path += "/";
+ path += file;
+ if(cmSystemTools::GetFilenameLastExtension(path) == ".mcov")
+ {
+ if(!this->ReadMCovFile(path.c_str()))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+}
+
+bool cmParseGTMCoverage::ReadMCovFile(const char* file)
+{
+ std::ifstream in(file);
+ if(!in)
+ {
+ return false;
+ }
+ std::string line;
+ std::string lastfunction;
+ std::string lastroutine;
+ std::string lastpath;
+ int lastoffset = 0;
+ while( cmSystemTools::GetLineFromStream(in, line))
+ {
+ // only look at lines that have coverage data
+ if(line.find("^ZZCOVERAGE") == line.npos)
+ {
+ continue;
+ }
+ std::string filepath;
+ std::string function;
+ std::string routine;
+ int linenumber = 0;
+ int count = 0;
+ this->ParseMCOVLine(line, routine, function, linenumber, count);
+ // skip this one
+ if(routine == "RSEL")
+ {
+ continue;
+ }
+ // no need to search the file if we just did it
+ if(function == lastfunction && lastroutine == routine)
+ {
+ if(lastpath.size())
+ {
+ this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber]
+ += count;
+ }
+ else
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Can not find mumps file : "
+ << lastroutine <<
+ " referenced in this line of mcov data:\n"
+ "[" << line << "]\n");
+ }
+ continue;
+ }
+ // Find the full path to the file
+ bool found = this->FindMumpsFile(routine, filepath);
+ if(found)
+ {
+ int lineoffset;
+ if(this->FindFunctionInMumpsFile(filepath,
+ function,
+ lineoffset))
+ {
+ cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
+ coverageVector = this->Coverage.TotalCoverage[filepath];
+ coverageVector[lineoffset + linenumber] += count;
+ }
+ lastoffset = lineoffset;
+ }
+ else
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Can not find mumps file : "
+ << routine << " referenced in this line of mcov data:\n"
+ "[" << line << "]\n");
+ }
+ lastfunction = function;
+ lastroutine = routine;
+ lastpath = filepath;
+ }
+ return true;
+}
+
+bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath,
+ std::string const& function,
+ int& lineoffset)
+{
+ std::ifstream in(filepath.c_str());
+ if(!in)
+ {
+ return false;
+ }
+ std::string line;
+ int linenum = 0;
+ while( cmSystemTools::GetLineFromStream(in, line))
+ {
+ std::string::size_type pos = line.find(function.c_str());
+ if(pos == 0)
+ {
+ char nextchar = line[function.size()];
+ if(nextchar == ' ' || nextchar == '(')
+ {
+ lineoffset = linenum;
+ return true;
+ }
+ }
+ if(pos == 1)
+ {
+ char prevchar = line[0];
+ char nextchar = line[function.size()+1];
+ if(prevchar == '%' && (nextchar == ' ' || nextchar == '('))
+ {
+ lineoffset = linenum;
+ return true;
+ }
+ }
+ linenum++; // move to next line count
+ }
+ lineoffset = 0;
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Could not find entry point : "
+ << function << " in " << filepath << "\n");
+ return false;
+}
+
+bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line,
+ std::string& routine,
+ std::string& function,
+ int& linenumber,
+ int& count)
+{
+ // this method parses lines from the .mcov file
+ // each line has ^COVERAGE(...) in it, and there
+ // are several varients of coverage lines:
+ //
+ // ^COVERAGE("DIC11","PR1",0)="2:0:0:0"
+ // ( file , entry, line ) = "number_executed:timing_info"
+ // ^COVERAGE("%RSEL","SRC")="1:0:0:0"
+ // ( file , entry ) = "number_executed:timing_info"
+ // ^COVERAGE("%RSEL","init",8,"FOR_LOOP",1)=1
+ // ( file , entry, line, IGNORE ) =number_executed
+ std::vector<cmStdString> args;
+ std::string::size_type pos = line.find('(', 0);
+ // if no ( is found, then return line has no coverage
+ if(pos == std::string::npos)
+ {
+ return false;
+ }
+ std::string arg;
+ bool done = false;
+ // separate out all of the comma separated arguments found
+ // in the COVERAGE(...) line
+ while(line[pos] && !done)
+ {
+ // save the char we are looking at
+ char cur = line[pos];
+ // , or ) means end of argument
+ if(cur == ',' || cur == ')')
+ {
+ // save the argument into the argument vector
+ args.push_back(arg);
+ // start on a new argument
+ arg = "";
+ // if we are at the end of the ), then finish while loop
+ if(cur == ')')
+ {
+ done = true;
+ }
+ }
+ else
+ {
+ // all chars except ", (, and % get stored in the arg string
+ if(cur != '\"' && cur != '(' && cur != '%')
+ {
+ arg.append(1, line[pos]);
+ }
+ }
+ // move to next char
+ pos++;
+ }
+ // now parse the right hand side of the =
+ pos = line.find('=');
+ // no = found, this is an error
+ if(pos == line.npos)
+ {
+ return false;
+ }
+ pos++; // move past =
+
+ // if the next positing is not a ", then this is a
+ // COVERAGE(..)=count line and turn the rest of the string
+ // past the = into an integer and set it to count
+ if(line[pos] != '\"')
+ {
+ count = atoi(line.substr(pos).c_str());
+ }
+ else
+ {
+ // this means line[pos] is a ", and we have a
+ // COVERAGE(...)="1:0:0:0" type of line
+ pos++; // move past "
+ // find the first : past the "
+ std::string::size_type pos2 = line.find(':', pos);
+ // turn the string between the " and the first : into an integer
+ // and set it to count
+ count = atoi(line.substr(pos, pos2-pos).c_str());
+ }
+ // less then two arguments is an error
+ if(args.size() < 2)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Error parsing mcov line: [" << line << "]\n");
+ return false;
+ }
+ routine = args[0]; // the routine is the first argument
+ function = args[1]; // the function in the routine is the second
+ // in the two argument only format
+ // ^COVERAGE("%RSEL","SRC"), the line offset is 0
+ if(args.size() == 2)
+ {
+ linenumber = 0;
+ }
+ else
+ {
+ // this is the format for this line
+ // ^COVERAGE("%RSEL","SRC",count)
+ linenumber = atoi(args[2].c_str());
+ }
+ return true;
+}
diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h
new file mode 100644
index 0000000..c6d7ef9
--- /dev/null
+++ b/Source/CTest/cmParseGTMCoverage.h
@@ -0,0 +1,49 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ 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 cmParseGTMCoverage_h
+#define cmParseGTMCoverage_h
+
+#include "cmParseMumpsCoverage.h"
+
+/** \class cmParseGTMCoverage
+ * \brief Parse GTM coverage information
+ *
+ * This class is used to parse GTM coverage information for
+ * mumps.
+ */
+class cmParseGTMCoverage : public cmParseMumpsCoverage
+{
+public:
+ cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest);
+protected:
+ // implement virtual from parent
+ bool LoadCoverageData(const char* dir);
+ // Read a single mcov file
+ bool ReadMCovFile(const char* f);
+ // find out what line in a mumps file (filepath) the given entry point
+ // or function is. lineoffset is set by this method.
+ bool FindFunctionInMumpsFile(std::string const& filepath,
+ std::string const& function,
+ int& lineoffset);
+ // parse a line from a .mcov file, and fill in the
+ // routine, function, linenumber and coverage count
+ bool ParseMCOVLine(std::string const& line,
+ std::string& routine,
+ std::string& function,
+ int& linenumber,
+ int& count);
+};
+
+
+#endif
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
new file mode 100644
index 0000000..37e8bd0
--- /dev/null
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -0,0 +1,165 @@
+#include "cmStandardIncludes.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "cmSystemTools.h"
+#include "cmParseGTMCoverage.h"
+#include <cmsys/Directory.hxx>
+#include <cmsys/Glob.hxx>
+
+
+cmParseMumpsCoverage::cmParseMumpsCoverage(
+ cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest)
+ :Coverage(cont), CTest(ctest)
+{
+}
+
+cmParseMumpsCoverage::~cmParseMumpsCoverage()
+{
+}
+
+bool cmParseMumpsCoverage::ReadCoverageFile(const char* file)
+{
+ // Read the gtm_coverage.mcov file, that has two lines of data:
+ // packages:/full/path/to/Vista/Packages
+ // coverage_dir:/full/path/to/dir/with/*.mcov
+ std::ifstream in(file);
+ if(!in)
+ {
+ return false;
+ }
+ std::string line;
+ while(cmSystemTools::GetLineFromStream(in, line))
+ {
+ std::string::size_type pos = line.find(':', 0);
+ std::string packages;
+ if(pos != std::string::npos)
+ {
+ std::string type = line.substr(0, pos);
+ std::string path = line.substr(pos+1);
+ if(type == "packages")
+ {
+ this->LoadPackages(path.c_str());
+ }
+ else if(type == "coverage_dir")
+ {
+ this->LoadCoverageData(path.c_str());
+ }
+ else
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Parse Error in Mumps coverage file :\n"
+ << file <<
+ "\ntype: [" << type << "]\npath:[" << path << "]\n"
+ "input line: [" << line << "]\n");
+ }
+ }
+ }
+ return true;
+}
+
+void cmParseMumpsCoverage::InitializeMumpsFile(std::string& file)
+{
+ // initialize the coverage information for a given mumps file
+ std::ifstream in(file.c_str());
+ if(!in)
+ {
+ return;
+ }
+ std::string line;
+ cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
+ coverageVector = this->Coverage.TotalCoverage[file];
+ if(!cmSystemTools::GetLineFromStream(in, line))
+ {
+ return;
+ }
+ // first line of a .m file can never be run
+ coverageVector.push_back(-1);
+ while( cmSystemTools::GetLineFromStream(in, line) )
+ {
+ // putting in a 0 for a line means it is executable code
+ // putting in a -1 for a line means it is not executable code
+ int val = -1; // assume line is not executable
+ bool found = false;
+ std::string::size_type i = 0;
+ // (1) Search for the first whitespace or semicolon character on a line.
+ //This will skip over labels if the line starts with one, or will simply
+ //be the first character on the line for non-label lines.
+ for(; i < line.size(); ++i)
+ {
+ if(line[i] == ' ' || line[i] == '\t' || line[i] == ';')
+ {
+ found = true;
+ break;
+ }
+ }
+ if(found)
+ {
+ // (2) If the first character found above is whitespace then continue the
+ // search for the first following non-whitespace character.
+ if(line[i] == ' ' || line[i] == '\t')
+ {
+ while(i < line.size() && (line[i] == ' ' || line[i] == '\t'))
+ {
+ i++;
+ }
+ }
+ // (3) If the character found is not a semicolon then the line counts for
+ // coverage.
+ if(i < line.size() && line[i] != ';')
+ {
+ val = 0;
+ }
+ }
+ coverageVector.push_back(val);
+ }
+}
+
+bool cmParseMumpsCoverage::LoadPackages(const char* d)
+{
+ cmsys::Glob glob;
+ glob.RecurseOn();
+ std::string pat = d;
+ pat += "/*.m";
+ glob.FindFiles(pat.c_str());
+ std::vector<std::string>& files = glob.GetFiles();
+ std::vector<std::string>::iterator fileIt;
+ for ( fileIt = files.begin(); fileIt != files.end();
+ ++ fileIt )
+ {
+ std::string name = cmSystemTools::GetFilenameName(*fileIt);
+ this->RoutineToDirectory[name.substr(0, name.size()-2)] = *fileIt;
+ // initialze each file, this is left out until CDash is fixed
+ // to handle large numbers of files
+ this->InitializeMumpsFile(*fileIt);
+ }
+ return true;
+}
+
+bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine,
+ std::string& filepath)
+{
+ std::map<cmStdString, cmStdString>::iterator i =
+ this->RoutineToDirectory.find(routine);
+ if(i != this->RoutineToDirectory.end())
+ {
+ filepath = i->second;
+ return true;
+ }
+ else
+ {
+ // try some alternate names
+ const char* tryname[] = {"GUX", "GTM", "ONT", 0};
+ for(int k=0; tryname[k] != 0; k++)
+ {
+ std::string routine2 = routine + tryname[k];
+ i = this->RoutineToDirectory.find(routine2);
+ if(i != this->RoutineToDirectory.end())
+ {
+ filepath = i->second;
+ return true;
+ }
+ }
+ }
+ return false;
+}
diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h
new file mode 100644
index 0000000..c1effa7
--- /dev/null
+++ b/Source/CTest/cmParseMumpsCoverage.h
@@ -0,0 +1,52 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ 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 cmParseMumpsCoverage_h
+#define cmParseMumpsCoverage_h
+
+#include "cmStandardIncludes.h"
+#include "cmCTestCoverageHandler.h"
+
+/** \class cmParseMumpsCoverage
+ * \brief Parse Mumps coverage information
+ *
+ * This class is used as the base class for Mumps coverage
+ * parsing.
+ */
+class cmParseMumpsCoverage
+{
+public:
+ cmParseMumpsCoverage(cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest);
+ virtual ~cmParseMumpsCoverage();
+ // This is the toplevel coverage file locating the coverage files
+ // and the mumps source code package tree.
+ bool ReadCoverageFile(const char* file);
+protected:
+ // sub classes will use this to
+ // load all coverage files found in the given directory
+ virtual bool LoadCoverageData(const char* d) = 0;
+ // search the package directory for mumps files and fill
+ // in the RoutineToDirectory map
+ bool LoadPackages(const char* dir);
+ // initialize the coverage information for a single mumps file
+ void InitializeMumpsFile(std::string& file);
+ // Find mumps file for routine
+ bool FindMumpsFile(std::string const& routine,
+ std::string& filepath);
+protected:
+ std::map<cmStdString, cmStdString> RoutineToDirectory;
+ cmCTestCoverageHandlerContainer& Coverage;
+ cmCTest* CTest;
+};
+
+#endif
diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h
index ce5741d..d50a83c 100644
--- a/Source/CTest/cmParsePHPCoverage.h
+++ b/Source/CTest/cmParsePHPCoverage.h
@@ -37,9 +37,6 @@ private:
bool ReadInt(std::ifstream& in, int& v);
bool ReadCoverageArray(std::ifstream& in, cmStdString const&);
bool ReadUntil(std::ifstream& in, char until);
- typedef std::map<int, int> FileLineCoverage;
- std::map<cmStdString, FileLineCoverage> FileToCoverage;
- std::map<int, int> FileCoverage;
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 45b4cd3..5cd4f29 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -288,7 +288,7 @@ CMakeSetupDialog::~CMakeSetupDialog()
// wait for thread to stop
this->CMakeThread->quit();
- this->CMakeThread->wait(2000);
+ this->CMakeThread->wait();
}
bool CMakeSetupDialog::prepareConfigure()
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index c1d0e9d..fd39eec 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -102,16 +102,17 @@ bool cmAddLibraryCommand
STATIC. But at this point we know only the name of the target, but not
yet its linker language. */
if ((type != cmTarget::STATIC_LIBRARY) &&
+ (type != cmTarget::OBJECT_LIBRARY) &&
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false))
{
- std::string msg = "ADD_LIBRARY for library ";
- msg += args[0];
- msg += " is used with the ";
- msg += type==cmTarget::SHARED_LIBRARY ? "SHARED" : "MODULE";
- msg += " option, but the target platform supports only STATIC libraries. "
- "Building it STATIC instead. This may lead to problems.";
- cmSystemTools::Message(msg.c_str() ,"Warning");
+ cmOStringStream w;
+ w <<
+ "ADD_LIBRARY called with " <<
+ (type==cmTarget::SHARED_LIBRARY ? "SHARED" : "MODULE") <<
+ " option but the target platform does not support dynamic linking. "
+ "Building a STATIC library instead. This may lead to problems.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
type = cmTarget::STATIC_LIBRARY;
}
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index dc6b749..b410e44 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -240,6 +240,7 @@ bool cmArchiveWrite::AddFile(const char* file,
// Clear acl and xattr fields not useful for distribution.
archive_entry_acl_clear(e);
archive_entry_xattr_clear(e);
+ archive_entry_set_fflags(e, 0, 0);
if(archive_write_header(this->Archive, e) != ARCHIVE_OK)
{
this->Error = "archive_write_header: ";
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 3f7fdc7..4aff64b 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -48,7 +48,7 @@
#include <float.h>
#include <ctype.h>
-#include <memory> // auto_ptr
+#include <cmsys/auto_ptr.hxx>
#include <cm_zlib.h>
#include <cmsys/Base64.h>
@@ -509,7 +509,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
- std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
{
@@ -1277,7 +1277,6 @@ int cmCTest::RunTest(std::vector<const char*> argv,
std::ostream* log, double testTimeOut,
std::vector<std::string>* environment)
{
- std::vector<std::string> origEnv;
bool modifyEnv = (environment && environment->size()>0);
// determine how much time we have
@@ -1334,9 +1333,11 @@ int cmCTest::RunTest(std::vector<const char*> argv,
}
std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory();
+ cmsys::auto_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv;
if (modifyEnv)
{
- origEnv = cmSystemTools::AppendEnv(environment);
+ saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment);
+ cmSystemTools::AppendEnv(*environment);
}
*retVal = inst.Run(args, output);
@@ -1351,11 +1352,6 @@ int cmCTest::RunTest(std::vector<const char*> argv,
"Internal cmCTest object used to run test." << std::endl
<< *output << std::endl);
- if (modifyEnv)
- {
- cmSystemTools::RestoreEnv(origEnv);
- }
-
return cmsysProcess_State_Exited;
}
std::vector<char> tempOutput;
@@ -1364,9 +1360,11 @@ int cmCTest::RunTest(std::vector<const char*> argv,
*output = "";
}
+ cmsys::auto_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv;
if (modifyEnv)
{
- origEnv = cmSystemTools::AppendEnv(environment);
+ saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment);
+ cmSystemTools::AppendEnv(*environment);
}
cmsysProcess* cp = cmsysProcess_New();
@@ -1436,11 +1434,6 @@ int cmCTest::RunTest(std::vector<const char*> argv,
}
cmsysProcess_Delete(cp);
- if (modifyEnv)
- {
- cmSystemTools::RestoreEnv(origEnv);
- }
-
return result;
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 48f644b..1ae7035 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -281,6 +281,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
cmakeFlags.push_back(flag);
}
+ if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0)
+ {
+ fprintf(fout, "SET(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
+ }
/* Use a random file name to avoid rapid creation and deletion
of the same executable name (some filesystems fail on that). */
@@ -404,6 +408,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
if(cmSystemTools::FileIsDirectory(fullPath.c_str()))
{
this->CleanupFiles(fullPath.c_str());
+ cmSystemTools::RemoveADirectory(fullPath.c_str());
}
else
{
diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmDependsFortranLexer.cxx
index 438af2d..b0d9a74 100644
--- a/Source/cmDependsFortranLexer.cxx
+++ b/Source/cmDependsFortranLexer.cxx
@@ -20,7 +20,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 34
+#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -65,7 +65,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -96,6 +95,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
+#endif /* ! C99 */
+
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -169,7 +170,15 @@ typedef void* yyscan_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
@@ -203,13 +212,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- * Given that the standard has decreed that size_t exists since 1989,
- * I guess we can afford to depend on it. Manoj.
- */
-
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
@@ -367,8 +369,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 43
-#define YY_END_OF_BUFFER 44
+#define YY_NUM_RULES 44
+#define YY_END_OF_BUFFER 45
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -376,25 +378,26 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[161] =
+static yyconst flex_int16_t yy_accept[165] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 44, 38, 40, 39, 42, 1, 38, 31, 2, 33,
- 38, 39, 36, 38, 37, 38, 37, 40, 38, 39,
- 38, 37, 9, 8, 9, 4, 3, 38, 0, 10,
- 0, 0, 0, 0, 0, 31, 31, 32, 34, 36,
- 38, 37, 0, 41, 37, 0, 0, 0, 0, 0,
- 0, 0, 0, 38, 0, 11, 37, 0, 0, 5,
- 0, 0, 0, 27, 0, 0, 31, 31, 31, 31,
- 0, 0, 0, 0, 0, 21, 0, 0, 0, 0,
+ 45, 39, 41, 40, 43, 1, 39, 32, 2, 34,
+ 39, 40, 37, 39, 38, 39, 38, 41, 39, 40,
+ 39, 38, 9, 8, 9, 4, 3, 39, 0, 10,
+ 0, 0, 0, 0, 0, 32, 32, 33, 35, 37,
+ 39, 38, 0, 42, 38, 0, 0, 0, 0, 0,
+ 0, 0, 0, 39, 0, 11, 38, 0, 0, 5,
+ 0, 0, 0, 28, 0, 0, 32, 32, 32, 32,
+ 0, 0, 0, 0, 0, 22, 0, 0, 0, 0,
0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 28, 29, 0, 0, 0, 0, 0, 0,
- 0, 22, 23, 0, 0, 0, 0, 0, 0, 0,
- 0, 30, 25, 0, 0, 18, 0, 0, 24, 19,
- 0, 0, 17, 0, 0, 16, 26, 0, 0, 15,
- 20, 0, 7, 35, 7, 13, 0, 12, 14, 0
+ 0, 0, 29, 30, 0, 0, 0, 0, 0, 0,
+ 0, 23, 24, 0, 0, 0, 0, 0, 0, 0,
+ 0, 31, 26, 0, 0, 19, 0, 0, 25, 20,
+ 0, 0, 18, 0, 0, 17, 27, 0, 0, 16,
+ 21, 0, 7, 36, 7, 14, 0, 13, 15, 0,
+ 0, 0, 12, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -404,15 +407,15 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 5, 6, 7, 8, 9, 1, 10, 11, 1,
1, 12, 1, 13, 1, 1, 1, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 15, 16, 1,
- 17, 18, 19, 1, 20, 20, 21, 22, 23, 24,
- 20, 20, 25, 20, 20, 26, 20, 27, 20, 20,
- 20, 20, 28, 20, 29, 20, 20, 20, 20, 20,
- 1, 30, 1, 1, 31, 1, 20, 20, 32, 33,
-
- 34, 35, 20, 20, 36, 20, 20, 37, 20, 38,
- 20, 20, 20, 20, 39, 20, 40, 20, 20, 20,
- 20, 20, 1, 1, 1, 1, 1, 1, 1, 1,
+ 14, 14, 14, 14, 14, 14, 14, 15, 16, 17,
+ 18, 19, 20, 1, 21, 21, 22, 23, 24, 25,
+ 21, 21, 26, 21, 21, 27, 21, 28, 21, 21,
+ 21, 21, 29, 21, 30, 21, 21, 21, 21, 21,
+ 1, 31, 1, 1, 32, 1, 21, 21, 33, 34,
+
+ 35, 36, 21, 21, 37, 21, 21, 38, 21, 39,
+ 21, 21, 21, 21, 40, 21, 41, 21, 21, 21,
+ 21, 21, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -429,178 +432,187 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[41] =
+static yyconst flex_int32_t yy_meta[42] =
{ 0,
1, 2, 2, 3, 4, 3, 3, 1, 1, 3,
- 3, 1, 3, 5, 1, 3, 3, 1, 1, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 1,
- 5, 6, 6, 6, 6, 6, 6, 6, 6, 6
+ 3, 1, 3, 5, 1, 3, 1, 3, 6, 1,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 1, 5, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7
} ;
-static yyconst flex_int16_t yy_base[169] =
+static yyconst flex_int16_t yy_base[174] =
{ 0,
- 0, 39, 0, 40, 184, 47, 43, 53, 55, 63,
- 186, 0, 476, 476, 164, 476, 79, 72, 476, 476,
- 143, 476, 130, 126, 0, 83, 119, 85, 149, 139,
- 189, 220, 476, 131, 89, 476, 476, 0, 132, 476,
- 259, 37, 69, 76, 34, 119, 137, 476, 0, 476,
- 121, 0, 150, 476, 0, 154, 298, 0, 75, 138,
- 142, 72, 127, 338, 94, 476, 0, 84, 158, 186,
- 81, 145, 108, 172, 147, 173, 260, 266, 284, 299,
- 272, 173, 178, 286, 245, 258, 285, 285, 78, 71,
- 207, 476, 288, 291, 296, 304, 310, 315, 317, 326,
-
- 330, 330, 335, 338, 338, 341, 343, 341, 348, 62,
- 52, 346, 476, 476, 353, 355, 357, 352, 359, 359,
- 359, 476, 476, 363, 365, 370, 366, 375, 46, 38,
- 378, 476, 476, 378, 381, 476, 376, 384, 476, 476,
- 384, 387, 476, 115, 0, 476, 476, 388, 393, 476,
- 476, 394, 476, 476, 476, 476, 398, 476, 476, 476,
- 432, 438, 443, 445, 451, 457, 463, 469
+ 0, 40, 0, 41, 188, 48, 44, 54, 56, 65,
+ 186, 0, 505, 505, 171, 505, 81, 74, 505, 505,
+ 158, 505, 151, 137, 0, 85, 122, 87, 153, 145,
+ 194, 226, 505, 143, 91, 505, 505, 0, 142, 505,
+ 266, 34, 70, 74, 34, 122, 141, 505, 0, 505,
+ 112, 0, 98, 505, 0, 154, 306, 0, 43, 133,
+ 139, 46, 130, 347, 130, 505, 0, 121, 163, 179,
+ 104, 156, 129, 176, 147, 178, 214, 267, 273, 292,
+ 279, 179, 249, 280, 257, 265, 288, 289, 116, 107,
+ 317, 505, 287, 289, 291, 302, 307, 310, 307, 311,
+
+ 316, 326, 329, 333, 332, 336, 347, 345, 349, 101,
+ 86, 346, 505, 505, 350, 351, 353, 350, 357, 362,
+ 362, 505, 505, 367, 369, 371, 366, 372, 56, 47,
+ 374, 505, 505, 374, 379, 505, 374, 387, 505, 505,
+ 387, 391, 505, 117, 0, 505, 505, 392, 394, 505,
+ 505, 394, 505, 505, 505, 505, 395, 419, 505, 429,
+ 0, 25, 505, 505, 446, 453, 459, 462, 469, 476,
+ 483, 490, 497
} ;
-static yyconst flex_int16_t yy_def[169] =
+static yyconst flex_int16_t yy_def[174] =
{ 0,
- 160, 1, 1, 1, 1, 1, 161, 161, 161, 161,
- 160, 162, 160, 160, 163, 160, 162, 160, 160, 160,
- 162, 160, 160, 162, 164, 162, 164, 160, 162, 160,
- 165, 160, 160, 160, 160, 160, 160, 162, 163, 160,
- 160, 160, 160, 160, 160, 160, 166, 160, 162, 160,
- 162, 164, 160, 160, 27, 160, 160, 57, 160, 160,
- 160, 160, 160, 165, 165, 160, 32, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 166, 166, 166, 166,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 167, 168, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 0,
- 160, 160, 160, 160, 160, 160, 160, 160
+ 164, 1, 1, 1, 1, 1, 165, 165, 165, 165,
+ 164, 166, 164, 164, 167, 164, 166, 164, 164, 164,
+ 166, 164, 164, 166, 168, 166, 168, 164, 166, 164,
+ 169, 164, 164, 164, 164, 164, 164, 166, 167, 164,
+ 164, 164, 164, 164, 164, 164, 170, 164, 166, 164,
+ 166, 168, 164, 164, 27, 164, 164, 57, 164, 164,
+ 164, 164, 164, 169, 169, 164, 32, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 170, 170, 170, 170,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 171, 172, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 173, 173, 164, 0, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164
} ;
-static yyconst flex_int16_t yy_nxt[517] =
+static yyconst flex_int16_t yy_nxt[547] =
{ 0,
12, 13, 14, 13, 13, 15, 16, 12, 17, 18,
- 19, 12, 20, 12, 21, 22, 23, 12, 24, 25,
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 26,
- 27, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 28, 28, 145, 28, 28, 34, 29, 29, 28, 30,
- 144, 28, 35, 36, 29, 34, 130, 34, 31, 71,
- 76, 37, 35, 36, 35, 34, 129, 32, 32, 37,
- 71, 76, 35, 46, 46, 111, 46, 47, 32, 32,
- 41, 48, 110, 41, 53, 54, 56, 53, 90, 56,
- 69, 70, 57, 69, 72, 73, 66, 83, 88, 74,
-
- 42, 43, 75, 44, 93, 72, 73, 45, 83, 88,
- 74, 42, 43, 75, 44, 93, 154, 154, 45, 38,
- 46, 46, 81, 46, 47, 81, 38, 38, 48, 96,
- 38, 89, 55, 38, 40, 68, 38, 38, 78, 46,
- 96, 78, 79, 63, 51, 82, 80, 50, 38, 55,
- 58, 53, 54, 58, 53, 56, 82, 49, 56, 69,
- 70, 57, 69, 84, 85, 86, 40, 99, 87, 94,
- 59, 60, 95, 61, 84, 85, 86, 62, 99, 87,
- 94, 59, 60, 95, 61, 160, 30, 91, 62, 64,
- 91, 66, 160, 97, 100, 92, 64, 64, 98, 101,
-
- 64, 102, 64, 64, 97, 100, 64, 64, 91, 98,
- 101, 91, 102, 160, 160, 160, 92, 160, 64, 64,
- 65, 65, 66, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 67, 65, 65, 65, 65, 65, 67,
- 67, 67, 67, 67, 67, 67, 67, 67, 67, 65,
- 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
- 41, 78, 46, 41, 78, 79, 105, 78, 46, 80,
- 78, 79, 160, 81, 160, 80, 81, 105, 160, 106,
- 42, 43, 160, 44, 107, 78, 46, 45, 78, 79,
- 106, 42, 43, 80, 44, 107, 82, 160, 45, 58,
-
- 78, 46, 58, 78, 79, 108, 109, 82, 80, 160,
- 103, 160, 112, 104, 113, 160, 108, 109, 114, 59,
- 60, 103, 61, 112, 104, 113, 62, 160, 115, 114,
- 59, 60, 116, 61, 160, 160, 117, 62, 64, 115,
- 66, 160, 118, 116, 160, 64, 64, 117, 119, 64,
- 120, 64, 64, 118, 121, 64, 64, 160, 122, 119,
- 123, 120, 124, 125, 126, 121, 127, 64, 64, 122,
- 128, 123, 131, 124, 125, 126, 132, 127, 133, 134,
- 135, 128, 136, 131, 137, 138, 139, 132, 140, 133,
- 134, 135, 141, 136, 142, 137, 138, 139, 143, 140,
-
- 146, 147, 148, 141, 149, 142, 150, 151, 152, 143,
- 156, 146, 147, 148, 157, 149, 158, 150, 151, 152,
- 159, 156, 160, 160, 160, 157, 160, 158, 160, 160,
- 160, 159, 33, 33, 33, 33, 33, 33, 38, 160,
- 160, 160, 38, 39, 39, 39, 39, 39, 39, 52,
- 52, 65, 65, 65, 65, 65, 65, 77, 77, 77,
- 77, 77, 77, 153, 153, 153, 160, 153, 153, 155,
- 160, 155, 160, 155, 155, 11, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160
+ 19, 12, 20, 12, 21, 22, 12, 23, 12, 24,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 26, 27, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 28, 28, 163, 28, 28, 34, 29, 29, 28,
+ 30, 145, 28, 35, 36, 29, 34, 71, 34, 31,
+ 144, 76, 37, 35, 36, 35, 83, 34, 71, 32,
+ 32, 37, 76, 88, 35, 46, 46, 83, 46, 47,
+ 32, 32, 41, 48, 88, 41, 53, 54, 56, 53,
+ 130, 56, 69, 70, 57, 69, 72, 73, 74, 53,
+
+ 54, 75, 53, 42, 43, 129, 44, 72, 73, 74,
+ 45, 111, 75, 81, 42, 43, 81, 44, 154, 154,
+ 110, 45, 38, 46, 46, 90, 46, 47, 93, 38,
+ 38, 48, 66, 38, 89, 55, 38, 82, 38, 93,
+ 38, 38, 78, 46, 40, 78, 79, 68, 82, 63,
+ 80, 96, 38, 55, 58, 56, 51, 58, 56, 84,
+ 85, 57, 96, 86, 69, 70, 87, 69, 99, 50,
+ 84, 85, 49, 40, 86, 59, 60, 87, 61, 99,
+ 91, 94, 62, 91, 95, 164, 59, 60, 92, 61,
+ 30, 164, 94, 62, 64, 95, 66, 164, 97, 164,
+
+ 100, 64, 64, 98, 164, 64, 101, 64, 64, 97,
+ 64, 100, 64, 64, 98, 78, 46, 101, 78, 79,
+ 164, 164, 164, 80, 64, 64, 65, 65, 66, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 67,
+ 65, 65, 65, 65, 65, 65, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 65, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 41, 78, 46,
+ 41, 78, 79, 102, 78, 46, 80, 78, 79, 105,
+ 81, 164, 80, 81, 102, 164, 164, 106, 42, 43,
+ 105, 44, 107, 78, 46, 45, 78, 79, 106, 42,
+
+ 43, 80, 44, 107, 82, 103, 45, 58, 104, 108,
+ 58, 109, 112, 113, 114, 82, 103, 164, 91, 104,
+ 108, 91, 109, 112, 113, 114, 92, 115, 59, 60,
+ 116, 61, 117, 118, 119, 62, 164, 120, 115, 59,
+ 60, 116, 61, 117, 118, 119, 62, 64, 120, 66,
+ 164, 121, 164, 122, 64, 64, 123, 124, 64, 125,
+ 64, 64, 121, 64, 122, 64, 64, 123, 124, 126,
+ 125, 127, 128, 131, 132, 133, 134, 64, 64, 135,
+ 126, 136, 127, 128, 131, 132, 133, 134, 137, 138,
+ 135, 139, 136, 140, 141, 142, 143, 146, 147, 137,
+
+ 138, 148, 139, 149, 140, 141, 142, 143, 146, 147,
+ 150, 151, 148, 152, 149, 156, 157, 158, 159, 164,
+ 160, 150, 151, 160, 152, 164, 156, 157, 158, 159,
+ 160, 164, 164, 160, 164, 161, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 161, 33, 33, 33, 33,
+ 33, 33, 33, 38, 164, 164, 164, 38, 38, 39,
+ 39, 39, 39, 39, 39, 39, 52, 164, 52, 65,
+ 65, 65, 65, 65, 65, 65, 77, 77, 77, 77,
+ 77, 77, 77, 153, 153, 153, 164, 153, 153, 153,
+ 155, 164, 155, 164, 155, 155, 155, 162, 162, 162,
+
+ 162, 162, 164, 162, 11, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164
} ;
-static yyconst flex_int16_t yy_chk[517] =
+static yyconst flex_int16_t yy_chk[547] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 4, 130, 2, 4, 7, 2, 4, 6, 6,
- 129, 6, 7, 7, 6, 8, 111, 9, 6, 42,
- 45, 9, 8, 8, 9, 10, 110, 6, 6, 10,
- 42, 45, 10, 18, 18, 90, 18, 18, 6, 6,
- 17, 18, 89, 17, 26, 26, 28, 26, 68, 28,
- 35, 35, 28, 35, 43, 43, 65, 59, 62, 44,
-
- 17, 17, 44, 17, 71, 43, 43, 17, 59, 62,
- 44, 17, 17, 44, 17, 71, 144, 144, 17, 27,
- 46, 46, 51, 46, 46, 51, 27, 27, 46, 73,
- 27, 63, 27, 27, 39, 34, 27, 27, 47, 47,
- 73, 47, 47, 30, 24, 51, 47, 23, 27, 27,
- 29, 53, 53, 29, 53, 56, 51, 21, 56, 69,
- 69, 56, 69, 60, 60, 61, 15, 75, 61, 72,
- 29, 29, 72, 29, 60, 60, 61, 29, 75, 61,
- 72, 29, 29, 72, 29, 11, 5, 70, 29, 31,
- 70, 31, 0, 74, 76, 70, 31, 31, 74, 82,
-
- 31, 83, 31, 31, 74, 76, 31, 31, 91, 74,
- 82, 91, 83, 0, 0, 0, 91, 0, 31, 31,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 1, 2, 4, 162, 2, 4, 7, 2, 4, 6,
+ 6, 130, 6, 7, 7, 6, 8, 42, 9, 6,
+ 129, 45, 9, 8, 8, 9, 59, 10, 42, 6,
+ 6, 10, 45, 62, 10, 18, 18, 59, 18, 18,
+ 6, 6, 17, 18, 62, 17, 26, 26, 28, 26,
+ 111, 28, 35, 35, 28, 35, 43, 43, 44, 53,
+
+ 53, 44, 53, 17, 17, 110, 17, 43, 43, 44,
+ 17, 90, 44, 51, 17, 17, 51, 17, 144, 144,
+ 89, 17, 27, 46, 46, 68, 46, 46, 71, 27,
+ 27, 46, 65, 27, 63, 27, 27, 51, 27, 71,
+ 27, 27, 47, 47, 39, 47, 47, 34, 51, 30,
+ 47, 73, 27, 27, 29, 56, 24, 29, 56, 60,
+ 60, 56, 73, 61, 69, 69, 61, 69, 75, 23,
+ 60, 60, 21, 15, 61, 29, 29, 61, 29, 75,
+ 70, 72, 29, 70, 72, 11, 29, 29, 70, 29,
+ 5, 0, 72, 29, 31, 72, 31, 0, 74, 0,
+
+ 76, 31, 31, 74, 0, 31, 82, 31, 31, 74,
+ 31, 76, 31, 31, 74, 77, 77, 82, 77, 77,
+ 0, 0, 0, 77, 31, 31, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 41, 77, 77, 41, 77, 77, 85, 78, 78, 77,
- 78, 78, 0, 81, 0, 78, 81, 85, 0, 86,
- 41, 41, 0, 41, 86, 79, 79, 41, 79, 79,
- 86, 41, 41, 79, 41, 86, 81, 0, 41, 57,
-
- 80, 80, 57, 80, 80, 87, 88, 81, 80, 0,
- 84, 0, 93, 84, 94, 0, 87, 88, 95, 57,
- 57, 84, 57, 93, 84, 94, 57, 0, 96, 95,
- 57, 57, 97, 57, 0, 0, 98, 57, 64, 96,
- 64, 0, 99, 97, 0, 64, 64, 98, 100, 64,
- 101, 64, 64, 99, 102, 64, 64, 0, 103, 100,
- 104, 101, 105, 106, 107, 102, 108, 64, 64, 103,
- 109, 104, 112, 105, 106, 107, 115, 108, 116, 117,
- 118, 109, 119, 112, 120, 121, 124, 115, 125, 116,
- 117, 118, 126, 119, 127, 120, 121, 124, 128, 125,
-
- 131, 134, 135, 126, 137, 127, 138, 141, 142, 128,
- 148, 131, 134, 135, 149, 137, 152, 138, 141, 142,
- 157, 148, 0, 0, 0, 149, 0, 152, 0, 0,
- 0, 157, 161, 161, 161, 161, 161, 161, 162, 0,
- 0, 0, 162, 163, 163, 163, 163, 163, 163, 164,
- 164, 165, 165, 165, 165, 165, 165, 166, 166, 166,
- 166, 166, 166, 167, 167, 167, 0, 167, 167, 168,
- 0, 168, 0, 168, 168, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160
+ 32, 32, 32, 32, 32, 32, 32, 41, 78, 78,
+ 41, 78, 78, 83, 79, 79, 78, 79, 79, 85,
+ 81, 0, 79, 81, 83, 0, 0, 86, 41, 41,
+ 85, 41, 86, 80, 80, 41, 80, 80, 86, 41,
+
+ 41, 80, 41, 86, 81, 84, 41, 57, 84, 87,
+ 57, 88, 93, 94, 95, 81, 84, 0, 91, 84,
+ 87, 91, 88, 93, 94, 95, 91, 96, 57, 57,
+ 97, 57, 98, 99, 100, 57, 0, 101, 96, 57,
+ 57, 97, 57, 98, 99, 100, 57, 64, 101, 64,
+ 0, 102, 0, 103, 64, 64, 104, 105, 64, 106,
+ 64, 64, 102, 64, 103, 64, 64, 104, 105, 107,
+ 106, 108, 109, 112, 115, 116, 117, 64, 64, 118,
+ 107, 119, 108, 109, 112, 115, 116, 117, 120, 121,
+ 118, 124, 119, 125, 126, 127, 128, 131, 134, 120,
+
+ 121, 135, 124, 137, 125, 126, 127, 128, 131, 134,
+ 138, 141, 135, 142, 137, 148, 149, 152, 157, 0,
+ 158, 138, 141, 158, 142, 0, 148, 149, 152, 157,
+ 160, 0, 0, 160, 0, 158, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 160, 165, 165, 165, 165,
+ 165, 165, 165, 166, 0, 0, 0, 166, 166, 167,
+ 167, 167, 167, 167, 167, 167, 168, 0, 168, 169,
+ 169, 169, 169, 169, 169, 169, 170, 170, 170, 170,
+ 170, 170, 170, 171, 171, 171, 0, 171, 171, 171,
+ 172, 0, 172, 0, 172, 172, 172, 173, 173, 173,
+
+ 173, 173, 0, 173, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164
} ;
/* The intent behind this definition is that it'll catch
@@ -673,7 +685,7 @@ Modify cmDependsFortranLexer.h:
/*--------------------------------------------------------------------------*/
-#line 670 "cmDependsFortranLexer.cxx"
+#line 678 "cmDependsFortranLexer.cxx"
#define INITIAL 0
#define free_fmt 1
@@ -796,7 +808,12 @@ static int input (yyscan_t yyscanner );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
@@ -804,7 +821,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -815,7 +832,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- int n; \
+ size_t n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -901,10 +918,10 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 75 "cmDependsFortranLexer.in.l"
+#line 71 "cmDependsFortranLexer.in.l"
-#line 901 "cmDependsFortranLexer.cxx"
+#line 914 "cmDependsFortranLexer.cxx"
if ( !yyg->yy_init )
{
@@ -958,13 +975,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 161 )
+ if ( yy_current_state >= 165 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 476 );
+ while ( yy_base[yy_current_state] != 505 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -990,7 +1007,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 77 "cmDependsFortranLexer.in.l"
+#line 73 "cmDependsFortranLexer.in.l"
{
cmDependsFortranParser_StringStart(yyextra);
cmDependsFortranParser_SetOldStartcond(yyextra, YY_START);
@@ -999,7 +1016,7 @@ YY_RULE_SETUP
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 83 "cmDependsFortranLexer.in.l"
+#line 79 "cmDependsFortranLexer.in.l"
{
cmDependsFortranParser_StringStart(yyextra);
cmDependsFortranParser_SetOldStartcond(yyextra, YY_START);
@@ -1007,10 +1024,10 @@ YY_RULE_SETUP
}
YY_BREAK
case 3:
-#line 90 "cmDependsFortranLexer.in.l"
+#line 86 "cmDependsFortranLexer.in.l"
case 4:
YY_RULE_SETUP
-#line 90 "cmDependsFortranLexer.in.l"
+#line 86 "cmDependsFortranLexer.in.l"
{
BEGIN(cmDependsFortranParser_GetOldStartcond(yyextra) );
yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra));
@@ -1018,17 +1035,17 @@ YY_RULE_SETUP
}
case 5:
/* rule 5 can match eol */
-#line 97 "cmDependsFortranLexer.in.l"
+#line 93 "cmDependsFortranLexer.in.l"
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
-#line 97 "cmDependsFortranLexer.in.l"
+#line 93 "cmDependsFortranLexer.in.l"
/* Ignore (continued strings, free fmt) */
YY_BREAK
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
-#line 99 "cmDependsFortranLexer.in.l"
+#line 95 "cmDependsFortranLexer.in.l"
{
if (cmDependsFortranParser_GetOldStartcond(yyextra) == fixed_fmt)
; /* Ignore (cont. strings, fixed fmt) */
@@ -1041,7 +1058,7 @@ YY_RULE_SETUP
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
-#line 109 "cmDependsFortranLexer.in.l"
+#line 105 "cmDependsFortranLexer.in.l"
{
unput ('\n');
BEGIN(INITIAL);
@@ -1049,7 +1066,7 @@ YY_RULE_SETUP
}
case 9:
YY_RULE_SETUP
-#line 115 "cmDependsFortranLexer.in.l"
+#line 111 "cmDependsFortranLexer.in.l"
{
cmDependsFortranParser_StringAppend(yyextra, yytext[0]);
}
@@ -1057,96 +1074,99 @@ YY_RULE_SETUP
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
-#line 119 "cmDependsFortranLexer.in.l"
+#line 115 "cmDependsFortranLexer.in.l"
{ return EOSTMT; } /* Treat comments like */
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
-#line 120 "cmDependsFortranLexer.in.l"
+#line 116 "cmDependsFortranLexer.in.l"
{ return EOSTMT; } /* empty lines */
case 12:
+/* rule 12 can match eol */
YY_RULE_SETUP
-#line 122 "cmDependsFortranLexer.in.l"
-{ return CPP_INCLUDE; }
+#line 118 "cmDependsFortranLexer.in.l"
+{
+ yytext[yyleng-1] = 0;
+ yylvalp->string = strdup(strchr(yytext, '<')+1);
+ return CPP_INCLUDE_ANGLE;
+}
case 13:
YY_RULE_SETUP
#line 123 "cmDependsFortranLexer.in.l"
-{ return F90PPR_INCLUDE; }
+{ return CPP_INCLUDE; }
case 14:
YY_RULE_SETUP
#line 124 "cmDependsFortranLexer.in.l"
-{ return COCO_INCLUDE; }
+{ return F90PPR_INCLUDE; }
case 15:
YY_RULE_SETUP
-#line 126 "cmDependsFortranLexer.in.l"
-{ return CPP_DEFINE; }
+#line 125 "cmDependsFortranLexer.in.l"
+{ return COCO_INCLUDE; }
case 16:
YY_RULE_SETUP
#line 127 "cmDependsFortranLexer.in.l"
-{ return F90PPR_DEFINE; }
+{ return CPP_DEFINE; }
case 17:
YY_RULE_SETUP
-#line 129 "cmDependsFortranLexer.in.l"
-{ return CPP_UNDEF; }
+#line 128 "cmDependsFortranLexer.in.l"
+{ return F90PPR_DEFINE; }
case 18:
YY_RULE_SETUP
#line 130 "cmDependsFortranLexer.in.l"
-{ return F90PPR_UNDEF; }
+{ return CPP_UNDEF; }
case 19:
YY_RULE_SETUP
-#line 132 "cmDependsFortranLexer.in.l"
-{ return CPP_IFDEF; }
+#line 131 "cmDependsFortranLexer.in.l"
+{ return F90PPR_UNDEF; }
case 20:
YY_RULE_SETUP
#line 133 "cmDependsFortranLexer.in.l"
-{ return CPP_IFNDEF; }
+{ return CPP_IFDEF; }
case 21:
YY_RULE_SETUP
#line 134 "cmDependsFortranLexer.in.l"
-{ return CPP_IF; }
+{ return CPP_IFNDEF; }
case 22:
YY_RULE_SETUP
#line 135 "cmDependsFortranLexer.in.l"
-{ return CPP_ELIF; }
+{ return CPP_IF; }
case 23:
YY_RULE_SETUP
#line 136 "cmDependsFortranLexer.in.l"
-{ return CPP_ELSE; }
+{ return CPP_ELIF; }
case 24:
YY_RULE_SETUP
#line 137 "cmDependsFortranLexer.in.l"
-{ return CPP_ENDIF; }
+{ return CPP_ELSE; }
case 25:
YY_RULE_SETUP
-#line 139 "cmDependsFortranLexer.in.l"
-{ return F90PPR_IFDEF; }
+#line 138 "cmDependsFortranLexer.in.l"
+{ return CPP_ENDIF; }
case 26:
YY_RULE_SETUP
#line 140 "cmDependsFortranLexer.in.l"
-{ return F90PPR_IFNDEF; }
+{ return F90PPR_IFDEF; }
case 27:
YY_RULE_SETUP
#line 141 "cmDependsFortranLexer.in.l"
-{ return F90PPR_IF; }
+{ return F90PPR_IFNDEF; }
case 28:
YY_RULE_SETUP
#line 142 "cmDependsFortranLexer.in.l"
-{ return F90PPR_ELIF; }
+{ return F90PPR_IF; }
case 29:
YY_RULE_SETUP
#line 143 "cmDependsFortranLexer.in.l"
-{ return F90PPR_ELSE; }
+{ return F90PPR_ELIF; }
case 30:
YY_RULE_SETUP
#line 144 "cmDependsFortranLexer.in.l"
-{ return F90PPR_ENDIF; }
-/* Line continuations, possible involving comments. */
+{ return F90PPR_ELSE; }
case 31:
-/* rule 31 can match eol */
YY_RULE_SETUP
-#line 147 "cmDependsFortranLexer.in.l"
-
- YY_BREAK
+#line 145 "cmDependsFortranLexer.in.l"
+{ return F90PPR_ENDIF; }
+/* Line continuations, possible involving comments. */
case 32:
/* rule 32 can match eol */
YY_RULE_SETUP
@@ -1154,59 +1174,65 @@ YY_RULE_SETUP
YY_BREAK
case 33:
+/* rule 33 can match eol */
YY_RULE_SETUP
-#line 150 "cmDependsFortranLexer.in.l"
-{ return COMMA; }
+#line 149 "cmDependsFortranLexer.in.l"
+
+ YY_BREAK
case 34:
YY_RULE_SETUP
-#line 152 "cmDependsFortranLexer.in.l"
-{ return DCOLON; }
+#line 151 "cmDependsFortranLexer.in.l"
+{ return COMMA; }
case 35:
-/* rule 35 can match eol */
YY_RULE_SETUP
-#line 154 "cmDependsFortranLexer.in.l"
-{ return GARBAGE; }
+#line 153 "cmDependsFortranLexer.in.l"
+{ return DCOLON; }
case 36:
+/* rule 36 can match eol */
YY_RULE_SETUP
-#line 156 "cmDependsFortranLexer.in.l"
-{ return ASSIGNMENT_OP; }
+#line 155 "cmDependsFortranLexer.in.l"
+{ return GARBAGE; }
case 37:
YY_RULE_SETUP
-#line 158 "cmDependsFortranLexer.in.l"
+#line 157 "cmDependsFortranLexer.in.l"
+{ return ASSIGNMENT_OP; }
+case 38:
+YY_RULE_SETUP
+#line 159 "cmDependsFortranLexer.in.l"
{
yylvalp->string = strdup(yytext);
return WORD;
}
-case 38:
+case 39:
YY_RULE_SETUP
-#line 163 "cmDependsFortranLexer.in.l"
+#line 164 "cmDependsFortranLexer.in.l"
{ return GARBAGE; }
-case 39:
-/* rule 39 can match eol */
+case 40:
+/* rule 40 can match eol */
YY_RULE_SETUP
-#line 165 "cmDependsFortranLexer.in.l"
+#line 166 "cmDependsFortranLexer.in.l"
{ return EOSTMT; }
-case 40:
+case 41:
YY_RULE_SETUP
-#line 168 "cmDependsFortranLexer.in.l"
+#line 169 "cmDependsFortranLexer.in.l"
/* Ignore */
YY_BREAK
-case 41:
-/* rule 41 can match eol */
+case 42:
+/* rule 42 can match eol */
YY_RULE_SETUP
-#line 169 "cmDependsFortranLexer.in.l"
+#line 170 "cmDependsFortranLexer.in.l"
/* Ignore line-endings preceeded by \ */
YY_BREAK
-case 42:
+case 43:
YY_RULE_SETUP
-#line 171 "cmDependsFortranLexer.in.l"
+#line 172 "cmDependsFortranLexer.in.l"
{ return *yytext; }
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(free_fmt):
case YY_STATE_EOF(fixed_fmt):
case YY_STATE_EOF(str_sq):
case YY_STATE_EOF(str_dq):
-#line 173 "cmDependsFortranLexer.in.l"
+#line 174 "cmDependsFortranLexer.in.l"
{
if(!cmDependsFortranParser_FilePop(yyextra) )
{
@@ -1214,12 +1240,12 @@ case YY_STATE_EOF(str_dq):
}
}
YY_BREAK
-case 43:
+case 44:
YY_RULE_SETUP
-#line 180 "cmDependsFortranLexer.in.l"
+#line 181 "cmDependsFortranLexer.in.l"
ECHO;
YY_BREAK
-#line 1247 "cmDependsFortranLexer.cxx"
+#line 1270 "cmDependsFortranLexer.cxx"
case YY_END_OF_BUFFER:
{
@@ -1512,7 +1538,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 161 )
+ if ( yy_current_state >= 165 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1541,11 +1567,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 161 )
+ if ( yy_current_state >= 165 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 160);
+ yy_is_jam = (yy_current_state == 164);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1991,7 +2017,7 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char * yystr , yyscan_t
}
/** Setup the input buffer state to scan the given bytes. The next call to cmDependsFortran_yylex() will
- * scan from a @e copy of @a yybytes.
+ * scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
@@ -2154,7 +2180,7 @@ void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param column_no
+ * @param line_number
* @param yyscanner The scanner object.
*/
void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner)
@@ -2374,7 +2400,7 @@ void cmDependsFortran_yyfree (void * ptr , yyscan_t)
#define YYTABLES_NAME "yytables"
-#line 180 "cmDependsFortranLexer.in.l"
+#line 181 "cmDependsFortranLexer.in.l"
diff --git a/Source/cmDependsFortranLexer.h b/Source/cmDependsFortranLexer.h
index 85e861d..8e24cfd 100644
--- a/Source/cmDependsFortranLexer.h
+++ b/Source/cmDependsFortranLexer.h
@@ -20,7 +20,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 34
+#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -65,7 +65,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -96,6 +95,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
+#endif /* ! C99 */
+
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -138,7 +139,15 @@ typedef void* yyscan_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
#endif
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
@@ -146,13 +155,6 @@ typedef void* yyscan_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- * Given that the standard has decreed that size_t exists since 1989,
- * I guess we can afford to depend on it. Manoj.
- */
-
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
@@ -304,7 +306,12 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
#endif
/* Number of entries by which start-condition stack grows. */
diff --git a/Source/cmDependsFortranLexer.in.l b/Source/cmDependsFortranLexer.in.l
index af8e37d..40e80b7 100644
--- a/Source/cmDependsFortranLexer.in.l
+++ b/Source/cmDependsFortranLexer.in.l
@@ -115,6 +115,11 @@ Modify cmDependsFortranLexer.h:
!.*\n { return EOSTMT; } /* Treat comments like */
<fixed_fmt>^[cC*dD].*\n { return EOSTMT; } /* empty lines */
+^[ \t]*#[ \t]*include[ \t]*<[^>]+> {
+ yytext[yyleng-1] = 0;
+ yylvalp->string = strdup(strchr(yytext, '<')+1);
+ return CPP_INCLUDE_ANGLE;
+}
^[ \t]*#[ \t]*include { return CPP_INCLUDE; }
\$[ \t]*include { return F90PPR_INCLUDE; }
\?\?[ \t]*include { return COCO_INCLUDE; }
diff --git a/Source/cmDependsFortranParser.cxx b/Source/cmDependsFortranParser.cxx
index ea31d3a..7b49a9c 100644
--- a/Source/cmDependsFortranParser.cxx
+++ b/Source/cmDependsFortranParser.cxx
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.1. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
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
@@ -45,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -74,7 +73,7 @@
/* Copy the first part of user declarations. */
-/* Line 189 of yacc.c */
+/* Line 268 of yacc.c */
#line 1 "cmDependsFortranParser.y"
/*============================================================================
@@ -161,8 +160,8 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
#endif
-/* Line 189 of yacc.c */
-#line 172 "cmDependsFortranParser.cxx"
+/* Line 268 of yacc.c */
+#line 165 "cmDependsFortranParser.cxx"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -216,7 +215,8 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
CPP_TOENDL = 282,
UNTERMINATED_STRING = 283,
STRING = 284,
- WORD = 285
+ WORD = 285,
+ CPP_INCLUDE_ANGLE = 286
};
#endif
/* Tokens. */
@@ -248,6 +248,7 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
#define UNTERMINATED_STRING 283
#define STRING 284
#define WORD 285
+#define CPP_INCLUDE_ANGLE 286
@@ -256,15 +257,15 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
typedef union YYSTYPE
{
-/* Line 214 of yacc.c */
-#line 94 "cmDependsFortranParser.y"
+/* Line 293 of yacc.c */
+#line 89 "cmDependsFortranParser.y"
char* string;
-/* Line 214 of yacc.c */
-#line 274 "cmDependsFortranParser.cxx"
+/* Line 293 of yacc.c */
+#line 269 "cmDependsFortranParser.cxx"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -275,8 +276,8 @@ typedef union YYSTYPE
/* Copy the second part of user declarations. */
-/* Line 264 of yacc.c */
-#line 286 "cmDependsFortranParser.cxx"
+/* Line 343 of yacc.c */
+#line 281 "cmDependsFortranParser.cxx"
#ifdef short
# undef short
@@ -326,7 +327,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -379,11 +380,11 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -406,24 +407,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -452,23 +453,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -488,23 +473,43 @@ union yyalloc
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 271
+#define YYLAST 276
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 31
+#define YYNTOKENS 32
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 16
/* YYNRULES -- Number of rules. */
-#define YYNRULES 52
+#define YYNRULES 53
/* YYNRULES -- Number of states. */
-#define YYNSTATES 94
+#define YYNSTATES 97
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 285
+#define YYMAXUTOK 286
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -540,7 +545,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30
+ 25, 26, 27, 28, 29, 30, 31
};
#if YYDEBUG
@@ -549,43 +554,43 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 4, 7, 9, 11, 16, 19, 24,
- 30, 38, 43, 48, 53, 58, 63, 68, 72, 76,
- 80, 84, 89, 93, 95, 97, 99, 101, 103, 105,
- 107, 109, 111, 113, 115, 117, 119, 121, 123, 125,
- 127, 129, 131, 133, 135, 136, 139, 141, 143, 145,
- 147, 149, 151
+ 30, 38, 43, 47, 52, 57, 62, 67, 72, 76,
+ 80, 84, 88, 93, 97, 99, 101, 103, 105, 107,
+ 109, 111, 113, 115, 117, 119, 121, 123, 125, 127,
+ 129, 131, 133, 135, 137, 139, 140, 143, 145, 147,
+ 149, 151, 153, 155
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 32, 0, -1, -1, 32, 33, -1, 35, -1, 34,
- -1, 30, 4, 45, 3, -1, 30, 3, -1, 30,
- 30, 45, 3, -1, 30, 26, 30, 45, 3, -1,
- 30, 25, 30, 26, 30, 45, 3, -1, 30, 29,
- 45, 3, -1, 36, 29, 45, 3, -1, 37, 30,
- 45, 3, -1, 38, 30, 45, 3, -1, 39, 30,
- 45, 3, -1, 40, 30, 45, 3, -1, 41, 45,
- 3, -1, 42, 45, 3, -1, 43, 45, 3, -1,
- 44, 45, 3, -1, 30, 5, 45, 3, -1, 5,
- 45, 3, -1, 3, -1, 1, -1, 6, -1, 7,
- -1, 8, -1, 10, -1, 9, -1, 12, -1, 11,
- -1, 13, -1, 19, -1, 14, -1, 20, -1, 15,
- -1, 21, -1, 17, -1, 23, -1, 16, -1, 22,
- -1, 18, -1, 24, -1, -1, 45, 46, -1, 30,
- -1, 29, -1, 5, -1, 4, -1, 26, -1, 25,
- -1, 28, -1
+ 33, 0, -1, -1, 33, 34, -1, 36, -1, 35,
+ -1, 30, 4, 46, 3, -1, 30, 3, -1, 30,
+ 30, 46, 3, -1, 30, 26, 30, 46, 3, -1,
+ 30, 25, 30, 26, 30, 46, 3, -1, 30, 29,
+ 46, 3, -1, 31, 46, 3, -1, 37, 29, 46,
+ 3, -1, 38, 30, 46, 3, -1, 39, 30, 46,
+ 3, -1, 40, 30, 46, 3, -1, 41, 30, 46,
+ 3, -1, 42, 46, 3, -1, 43, 46, 3, -1,
+ 44, 46, 3, -1, 45, 46, 3, -1, 30, 5,
+ 46, 3, -1, 5, 46, 3, -1, 3, -1, 1,
+ -1, 6, -1, 7, -1, 8, -1, 10, -1, 9,
+ -1, 12, -1, 11, -1, 13, -1, 19, -1, 14,
+ -1, 20, -1, 15, -1, 21, -1, 17, -1, 23,
+ -1, 16, -1, 22, -1, 18, -1, 24, -1, -1,
+ 46, 47, -1, 30, -1, 29, -1, 5, -1, 4,
+ -1, 26, -1, 25, -1, 28, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 115, 115, 115, 117, 117, 119, 125, 135, 165,
- 176, 189, 200, 207, 213, 219, 225, 231, 236, 241,
- 246, 251, 255, 256, 257, 262, 262, 262, 263, 263,
- 264, 264, 265, 265, 266, 266, 267, 267, 268, 268,
- 269, 269, 270, 270, 271, 271, 274, 275, 276, 277,
- 278, 279, 280
+ 0, 111, 111, 111, 113, 113, 115, 121, 131, 161,
+ 172, 185, 196, 203, 210, 216, 222, 228, 234, 239,
+ 244, 249, 254, 258, 259, 260, 265, 265, 265, 266,
+ 266, 267, 267, 268, 268, 269, 269, 270, 270, 271,
+ 271, 272, 272, 273, 273, 274, 274, 277, 278, 279,
+ 280, 281, 282, 283
};
#endif
@@ -600,9 +605,9 @@ static const char *const yytname[] =
"CPP_IF", "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF", "F90PPR_IFDEF",
"F90PPR_IFNDEF", "F90PPR_IF", "F90PPR_ELSE", "F90PPR_ELIF",
"F90PPR_ENDIF", "COMMA", "DCOLON", "CPP_TOENDL", "UNTERMINATED_STRING",
- "STRING", "WORD", "$accept", "code", "stmt", "assignment_stmt",
- "keyword_stmt", "include", "define", "undef", "ifdef", "ifndef", "if",
- "elif", "else", "endif", "other", "misc_code", 0
+ "STRING", "WORD", "CPP_INCLUDE_ANGLE", "$accept", "code", "stmt",
+ "assignment_stmt", "keyword_stmt", "include", "define", "undef", "ifdef",
+ "ifndef", "if", "elif", "else", "endif", "other", "misc_code", 0
};
#endif
@@ -614,163 +619,168 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285
+ 285, 286
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 31, 32, 32, 33, 33, 34, 35, 35, 35,
- 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
- 35, 35, 35, 35, 35, 36, 36, 36, 37, 37,
- 38, 38, 39, 39, 40, 40, 41, 41, 42, 42,
- 43, 43, 44, 44, 45, 45, 46, 46, 46, 46,
- 46, 46, 46
+ 0, 32, 33, 33, 34, 34, 35, 36, 36, 36,
+ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+ 36, 36, 36, 36, 36, 36, 37, 37, 37, 38,
+ 38, 39, 39, 40, 40, 41, 41, 42, 42, 43,
+ 43, 44, 44, 45, 45, 46, 46, 47, 47, 47,
+ 47, 47, 47, 47
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 1, 1, 4, 2, 4, 5,
- 7, 4, 4, 4, 4, 4, 4, 3, 3, 3,
- 3, 4, 3, 1, 1, 1, 1, 1, 1, 1,
+ 7, 4, 3, 4, 4, 4, 4, 4, 3, 3,
+ 3, 3, 4, 3, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 0, 2, 1, 1, 1, 1,
- 1, 1, 1
+ 1, 1, 1, 1, 1, 0, 2, 1, 1, 1,
+ 1, 1, 1, 1
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 24, 23, 44, 25, 26, 27, 29,
- 28, 31, 30, 32, 34, 36, 40, 38, 42, 33,
- 35, 37, 41, 39, 43, 0, 3, 5, 4, 0,
- 0, 0, 0, 0, 44, 44, 44, 44, 0, 7,
- 44, 44, 0, 0, 44, 44, 44, 44, 44, 44,
- 44, 0, 0, 0, 0, 22, 49, 48, 51, 50,
- 52, 47, 46, 45, 0, 0, 0, 44, 0, 0,
- 0, 0, 0, 0, 0, 17, 18, 19, 20, 6,
- 21, 0, 0, 11, 8, 12, 13, 14, 15, 16,
- 44, 9, 0, 10
+ 2, 0, 1, 25, 24, 45, 26, 27, 28, 30,
+ 29, 32, 31, 33, 35, 37, 41, 39, 43, 34,
+ 36, 38, 42, 40, 44, 0, 45, 3, 5, 4,
+ 0, 0, 0, 0, 0, 45, 45, 45, 45, 0,
+ 7, 45, 45, 0, 0, 45, 45, 0, 45, 45,
+ 45, 45, 45, 0, 0, 0, 0, 23, 50, 49,
+ 52, 51, 53, 48, 47, 46, 0, 0, 0, 45,
+ 0, 0, 12, 0, 0, 0, 0, 0, 18, 19,
+ 20, 21, 6, 22, 0, 0, 11, 8, 13, 14,
+ 15, 16, 17, 45, 9, 0, 10
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 1, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 63
+ -1, 1, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 65
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -35
+#define YYPACT_NINF -29
static const yytype_int16 yypact[] =
{
- -35, 29, -35, -35, -35, -35, -35, -35, -35, -35,
- -35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
- -35, -35, -35, -35, -35, 241, -35, -35, -35, -25,
- -22, -21, -13, -12, -35, -35, -35, -35, 57, -35,
- -35, -35, -11, -10, -35, -35, -35, -35, -35, -35,
- -35, 63, 69, 75, 103, -35, -35, -35, -35, -35,
- -35, -35, -35, -35, 109, 115, -5, -35, 121, 149,
- 155, 161, 167, 195, 201, -35, -35, -35, -35, -35,
- -35, -8, 207, -35, -35, -35, -35, -35, -35, -35,
- -35, -35, 213, -35
+ -29, 39, -29, -29, -29, -29, -29, -29, -29, -29,
+ -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
+ -29, -29, -29, -29, -29, 246, -29, -29, -29, -29,
+ -28, -27, -22, -17, -16, -29, -29, -29, -29, 2,
+ -29, -29, -29, -13, -12, -29, -29, 61, -29, -29,
+ -29, -29, -29, 68, 74, 80, 108, -29, -29, -29,
+ -29, -29, -29, -29, -29, -29, 114, 120, -24, -29,
+ 126, 154, -29, 160, 166, 172, 200, 206, -29, -29,
+ -29, -29, -29, -29, -9, 212, -29, -29, -29, -29,
+ -29, -29, -29, -29, -29, 218, -29
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
- -35, -35, -35, -35, -34, -35
+ -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
+ -29, -29, -29, -29, -26, -29
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 51, 52, 53, 54, 46, 0, 64, 65, 47, 48,
- 68, 69, 70, 71, 72, 73, 74, 49, 50, 66,
- 67, 81, 90, 0, 0, 0, 0, 0, 0, 2,
- 3, 0, 4, 82, 5, 6, 7, 8, 9, 10,
+ 47, 48, 84, 49, 0, 57, 58, 59, 50, 53,
+ 54, 55, 56, 51, 52, 66, 67, 68, 69, 70,
+ 71, 93, 73, 74, 75, 76, 77, 60, 61, 0,
+ 62, 63, 64, 0, 0, 0, 0, 0, 0, 2,
+ 3, 0, 4, 85, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 0, 0, 92, 0, 0, 25,
- 55, 56, 57, 0, 0, 0, 75, 56, 57, 0,
- 0, 0, 76, 56, 57, 0, 0, 0, 77, 56,
- 57, 0, 58, 59, 0, 60, 61, 62, 58, 59,
- 0, 60, 61, 62, 58, 59, 0, 60, 61, 62,
- 58, 59, 0, 60, 61, 62, 78, 56, 57, 0,
- 0, 0, 79, 56, 57, 0, 0, 0, 80, 56,
- 57, 0, 0, 0, 83, 56, 57, 0, 58, 59,
- 0, 60, 61, 62, 58, 59, 0, 60, 61, 62,
- 58, 59, 0, 60, 61, 62, 58, 59, 0, 60,
- 61, 62, 84, 56, 57, 0, 0, 0, 85, 56,
- 57, 0, 0, 0, 86, 56, 57, 0, 0, 0,
- 87, 56, 57, 0, 58, 59, 0, 60, 61, 62,
- 58, 59, 0, 60, 61, 62, 58, 59, 0, 60,
- 61, 62, 58, 59, 0, 60, 61, 62, 88, 56,
- 57, 0, 0, 0, 89, 56, 57, 0, 0, 0,
- 91, 56, 57, 0, 0, 0, 93, 56, 57, 0,
- 58, 59, 0, 60, 61, 62, 58, 59, 0, 60,
- 61, 62, 58, 59, 0, 60, 61, 62, 58, 59,
- 0, 60, 61, 62, 39, 40, 41, 0, 0, 0,
+ 21, 22, 23, 24, 72, 58, 59, 95, 0, 25,
+ 26, 78, 58, 59, 0, 0, 0, 79, 58, 59,
+ 0, 0, 0, 80, 58, 59, 60, 61, 0, 62,
+ 63, 64, 0, 60, 61, 0, 62, 63, 64, 60,
+ 61, 0, 62, 63, 64, 60, 61, 0, 62, 63,
+ 64, 81, 58, 59, 0, 0, 0, 82, 58, 59,
+ 0, 0, 0, 83, 58, 59, 0, 0, 0, 86,
+ 58, 59, 0, 60, 61, 0, 62, 63, 64, 60,
+ 61, 0, 62, 63, 64, 60, 61, 0, 62, 63,
+ 64, 60, 61, 0, 62, 63, 64, 87, 58, 59,
+ 0, 0, 0, 88, 58, 59, 0, 0, 0, 89,
+ 58, 59, 0, 0, 0, 90, 58, 59, 0, 60,
+ 61, 0, 62, 63, 64, 60, 61, 0, 62, 63,
+ 64, 60, 61, 0, 62, 63, 64, 60, 61, 0,
+ 62, 63, 64, 91, 58, 59, 0, 0, 0, 92,
+ 58, 59, 0, 0, 0, 94, 58, 59, 0, 0,
+ 0, 96, 58, 59, 0, 60, 61, 0, 62, 63,
+ 64, 60, 61, 0, 62, 63, 64, 60, 61, 0,
+ 62, 63, 64, 60, 61, 0, 62, 63, 64, 40,
+ 41, 42, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 42, 43, 0, 0,
- 44, 45
+ 0, 43, 44, 0, 0, 45, 46
};
+#define yypact_value_is_default(yystate) \
+ ((yystate) == (-29))
+
+#define yytable_value_is_error(yytable_value) \
+ YYID (0)
+
static const yytype_int8 yycheck[] =
{
- 34, 35, 36, 37, 29, -1, 40, 41, 30, 30,
- 44, 45, 46, 47, 48, 49, 50, 30, 30, 30,
- 30, 26, 30, -1, -1, -1, -1, -1, -1, 0,
- 1, -1, 3, 67, 5, 6, 7, 8, 9, 10,
+ 26, 29, 26, 30, -1, 3, 4, 5, 30, 35,
+ 36, 37, 38, 30, 30, 41, 42, 30, 30, 45,
+ 46, 30, 48, 49, 50, 51, 52, 25, 26, -1,
+ 28, 29, 30, -1, -1, -1, -1, -1, -1, 0,
+ 1, -1, 3, 69, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, -1, -1, 90, -1, -1, 30,
- 3, 4, 5, -1, -1, -1, 3, 4, 5, -1,
- -1, -1, 3, 4, 5, -1, -1, -1, 3, 4,
- 5, -1, 25, 26, -1, 28, 29, 30, 25, 26,
- -1, 28, 29, 30, 25, 26, -1, 28, 29, 30,
- 25, 26, -1, 28, 29, 30, 3, 4, 5, -1,
- -1, -1, 3, 4, 5, -1, -1, -1, 3, 4,
- 5, -1, -1, -1, 3, 4, 5, -1, 25, 26,
- -1, 28, 29, 30, 25, 26, -1, 28, 29, 30,
- 25, 26, -1, 28, 29, 30, 25, 26, -1, 28,
- 29, 30, 3, 4, 5, -1, -1, -1, 3, 4,
- 5, -1, -1, -1, 3, 4, 5, -1, -1, -1,
- 3, 4, 5, -1, 25, 26, -1, 28, 29, 30,
- 25, 26, -1, 28, 29, 30, 25, 26, -1, 28,
- 29, 30, 25, 26, -1, 28, 29, 30, 3, 4,
- 5, -1, -1, -1, 3, 4, 5, -1, -1, -1,
- 3, 4, 5, -1, -1, -1, 3, 4, 5, -1,
- 25, 26, -1, 28, 29, 30, 25, 26, -1, 28,
- 29, 30, 25, 26, -1, 28, 29, 30, 25, 26,
- -1, 28, 29, 30, 3, 4, 5, -1, -1, -1,
+ 21, 22, 23, 24, 3, 4, 5, 93, -1, 30,
+ 31, 3, 4, 5, -1, -1, -1, 3, 4, 5,
+ -1, -1, -1, 3, 4, 5, 25, 26, -1, 28,
+ 29, 30, -1, 25, 26, -1, 28, 29, 30, 25,
+ 26, -1, 28, 29, 30, 25, 26, -1, 28, 29,
+ 30, 3, 4, 5, -1, -1, -1, 3, 4, 5,
+ -1, -1, -1, 3, 4, 5, -1, -1, -1, 3,
+ 4, 5, -1, 25, 26, -1, 28, 29, 30, 25,
+ 26, -1, 28, 29, 30, 25, 26, -1, 28, 29,
+ 30, 25, 26, -1, 28, 29, 30, 3, 4, 5,
+ -1, -1, -1, 3, 4, 5, -1, -1, -1, 3,
+ 4, 5, -1, -1, -1, 3, 4, 5, -1, 25,
+ 26, -1, 28, 29, 30, 25, 26, -1, 28, 29,
+ 30, 25, 26, -1, 28, 29, 30, 25, 26, -1,
+ 28, 29, 30, 3, 4, 5, -1, -1, -1, 3,
+ 4, 5, -1, -1, -1, 3, 4, 5, -1, -1,
+ -1, 3, 4, 5, -1, 25, 26, -1, 28, 29,
+ 30, 25, 26, -1, 28, 29, 30, 25, 26, -1,
+ 28, 29, 30, 25, 26, -1, 28, 29, 30, 3,
+ 4, 5, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 25, 26, -1, -1,
- 29, 30
+ -1, 25, 26, -1, -1, 29, 30
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 32, 0, 1, 3, 5, 6, 7, 8, 9,
+ 0, 33, 0, 1, 3, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 30, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 3,
- 4, 5, 25, 26, 29, 30, 29, 30, 30, 30,
- 30, 45, 45, 45, 45, 3, 4, 5, 25, 26,
- 28, 29, 30, 46, 45, 45, 30, 30, 45, 45,
- 45, 45, 45, 45, 45, 3, 3, 3, 3, 3,
- 3, 26, 45, 3, 3, 3, 3, 3, 3, 3,
- 30, 3, 45, 3
+ 20, 21, 22, 23, 24, 30, 31, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 3, 4, 5, 25, 26, 29, 30, 46, 29, 30,
+ 30, 30, 30, 46, 46, 46, 46, 3, 4, 5,
+ 25, 26, 28, 29, 30, 47, 46, 46, 30, 30,
+ 46, 46, 3, 46, 46, 46, 46, 46, 3, 3,
+ 3, 3, 3, 3, 26, 46, 3, 3, 3, 3,
+ 3, 3, 3, 30, 3, 46, 3
};
#define yyerrok (yyerrstatus = 0)
@@ -785,9 +795,18 @@ static const yytype_uint8 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
+ Once GCC version 2 has supplanted version 1, this can go. However,
+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+ discussed. */
#define YYFAIL goto yyerrlab
+#if defined YYFAIL
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
+#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -797,7 +816,6 @@ do \
{ \
yychar = (Token); \
yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@@ -839,19 +857,10 @@ while (YYID (0))
#endif
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
+/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- fprintf (File, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
@@ -1043,7 +1052,6 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
@@ -1146,115 +1154,142 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
- int yyn = yypact[yystate];
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = 0;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
{
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
-
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
{
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
}
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
+ }
+ }
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
- if (yyresult)
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
}
- return yysize;
- }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1287,6 +1322,7 @@ yydestruct (yymsg, yytype, yyvaluep)
}
}
+
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -1303,12 +1339,9 @@ int yyparse ();
#endif /* ! YYPARSE_PARAM */
-
-
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
+/*----------.
+| yyparse. |
+`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1495,7 +1528,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1526,7 +1559,7 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
+ if (yytable_value_is_error (yyn))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
@@ -1582,8 +1615,8 @@ yyreduce:
{
case 6:
-/* Line 1455 of yacc.c */
-#line 120 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 116 "cmDependsFortranParser.y"
{
free((yyvsp[(1) - (4)].string));
}
@@ -1591,8 +1624,8 @@ yyreduce:
case 7:
-/* Line 1455 of yacc.c */
-#line 126 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 122 "cmDependsFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface"))
{
@@ -1606,8 +1639,8 @@ yyreduce:
case 8:
-/* Line 1455 of yacc.c */
-#line 136 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 132 "cmDependsFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use"))
{
@@ -1641,8 +1674,8 @@ yyreduce:
case 9:
-/* Line 1455 of yacc.c */
-#line 166 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 162 "cmDependsFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (5)].string), "use"))
{
@@ -1657,8 +1690,8 @@ yyreduce:
case 10:
-/* Line 1455 of yacc.c */
-#line 177 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 173 "cmDependsFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (7)].string), "use") &&
cmDependsFortranParserIsKeyword((yyvsp[(3) - (7)].string), "non_intrinsic") )
@@ -1675,8 +1708,8 @@ yyreduce:
case 11:
-/* Line 1455 of yacc.c */
-#line 190 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 186 "cmDependsFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include"))
{
@@ -1691,8 +1724,20 @@ yyreduce:
case 12:
-/* Line 1455 of yacc.c */
-#line 201 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 197 "cmDependsFortranParser.y"
+ {
+ cmDependsFortranParser* parser =
+ cmDependsFortran_yyget_extra(yyscanner);
+ cmDependsFortranParser_RuleInclude(parser, (yyvsp[(1) - (3)].string));
+ free((yyvsp[(1) - (3)].string));
+ }
+ break;
+
+ case 13:
+
+/* Line 1806 of yacc.c */
+#line 204 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
@@ -1701,10 +1746,10 @@ yyreduce:
}
break;
- case 13:
+ case 14:
-/* Line 1455 of yacc.c */
-#line 208 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 211 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string));
@@ -1712,10 +1757,10 @@ yyreduce:
}
break;
- case 14:
+ case 15:
-/* Line 1455 of yacc.c */
-#line 214 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 217 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string));
@@ -1723,10 +1768,10 @@ yyreduce:
}
break;
- case 15:
+ case 16:
-/* Line 1455 of yacc.c */
-#line 220 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 223 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string));
@@ -1734,10 +1779,10 @@ yyreduce:
}
break;
- case 16:
+ case 17:
-/* Line 1455 of yacc.c */
-#line 226 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 229 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string));
@@ -1745,75 +1790,86 @@ yyreduce:
}
break;
- case 17:
+ case 18:
-/* Line 1455 of yacc.c */
-#line 232 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 235 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIf(parser);
}
break;
- case 18:
+ case 19:
-/* Line 1455 of yacc.c */
-#line 237 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 240 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElif(parser);
}
break;
- case 19:
+ case 20:
-/* Line 1455 of yacc.c */
-#line 242 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 245 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElse(parser);
}
break;
- case 20:
+ case 21:
-/* Line 1455 of yacc.c */
-#line 247 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 250 "cmDependsFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleEndif(parser);
}
break;
- case 21:
+ case 22:
-/* Line 1455 of yacc.c */
-#line 252 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 255 "cmDependsFortranParser.y"
{
free((yyvsp[(1) - (4)].string));
}
break;
- case 46:
+ case 47:
-/* Line 1455 of yacc.c */
-#line 274 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 277 "cmDependsFortranParser.y"
{ free ((yyvsp[(1) - (1)].string)); }
break;
- case 47:
+ case 48:
-/* Line 1455 of yacc.c */
-#line 275 "cmDependsFortranParser.y"
+/* Line 1806 of yacc.c */
+#line 278 "cmDependsFortranParser.y"
{ free ((yyvsp[(1) - (1)].string)); }
break;
-/* Line 1455 of yacc.c */
-#line 1821 "cmDependsFortranParser.cxx"
+/* Line 1806 of yacc.c */
+#line 1860 "cmDependsFortranParser.cxx"
default: break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@@ -1841,6 +1897,10 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@@ -1848,37 +1908,36 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
{
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
}
}
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (yymsg);
- }
- else
- {
- yyerror (YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
+ yyerror (yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
+# undef YYSYNTAX_ERROR
#endif
}
@@ -1939,7 +1998,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
+ if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -1998,8 +2057,13 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval);
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@@ -2024,7 +2088,7 @@ yyreturn:
-/* Line 1675 of yacc.c */
-#line 283 "cmDependsFortranParser.y"
+/* Line 2067 of yacc.c */
+#line 286 "cmDependsFortranParser.y"
/* End of grammar */
diff --git a/Source/cmDependsFortranParser.y b/Source/cmDependsFortranParser.y
index 00d3327..5681d69 100644
--- a/Source/cmDependsFortranParser.y
+++ b/Source/cmDependsFortranParser.y
@@ -102,6 +102,7 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
%token <string> CPP_TOENDL
%token <number> UNTERMINATED_STRING
%token <string> STRING WORD
+%token <string> CPP_INCLUDE_ANGLE
/*-------------------------------------------------------------------------*/
/* grammar */
@@ -192,6 +193,13 @@ keyword_stmt:
free($1);
free($2);
}
+| CPP_INCLUDE_ANGLE other EOSTMT
+ {
+ cmDependsFortranParser* parser =
+ cmDependsFortran_yyget_extra(yyscanner);
+ cmDependsFortranParser_RuleInclude(parser, $1);
+ free($1);
+ }
| include STRING other EOSTMT
{
cmDependsFortranParser* parser =
diff --git a/Source/cmDependsFortranParserTokens.h b/Source/cmDependsFortranParserTokens.h
index 0bbcaae..941eda0 100644
--- a/Source/cmDependsFortranParserTokens.h
+++ b/Source/cmDependsFortranParserTokens.h
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.1. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
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
@@ -31,6 +30,7 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -64,7 +64,8 @@
CPP_TOENDL = 282,
UNTERMINATED_STRING = 283,
STRING = 284,
- WORD = 285
+ WORD = 285,
+ CPP_INCLUDE_ANGLE = 286
};
#endif
/* Tokens. */
@@ -96,6 +97,7 @@
#define UNTERMINATED_STRING 283
#define STRING 284
#define WORD 285
+#define CPP_INCLUDE_ANGLE 286
@@ -104,12 +106,14 @@
typedef union YYSTYPE
{
-/* Line 1676 of yacc.c */
-#line 94 "cmDependsFortranParser.y"
+/* Line 2068 of yacc.c */
+#line 89 "cmDependsFortranParser.y"
char* string;
-/* Line 1676 of yacc.c */
+
+
+/* Line 2068 of yacc.c */
#line 118 "cmDependsFortranParserTokens.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 897e516..592d931 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -523,6 +523,16 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables That Change Behavior");
cm->DefineProperty
+ ("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME", cmProperty::VARIABLE,
+ "Default component used in install() commands.",
+ "If an install() command is used without the COMPONENT argument, "
+ "these files will be grouped into a default component. The name of this "
+ "default install component will be taken from this variable. "
+ "It defaults to \"Unspecified\". ",
+ false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
("CMAKE_FIND_LIBRARY_PREFIXES", cmProperty::VARIABLE,
"Prefixes to prepend when looking for libraries.",
"This specifies what prefixes to add to library names when "
@@ -833,6 +843,36 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Default is ON.",false,
"Variables That Change Behavior");
+ cm->DefineProperty
+ ("CMAKE_ABSOLUTE_DESTINATION_FILES", cmProperty::VARIABLE,
+ "List of files which have been installed using "
+ " an ABSOLUTE DESTINATION path.",
+ "This variable is defined by CMake-generated cmake_install.cmake "
+ "scripts."
+ " It can be used (read-only) by program or script that source those"
+ " install scripts. This is used by some CPack generators (e.g. RPM).",
+ false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
+ ("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", cmProperty::VARIABLE,
+ "Ask cmake_install.cmake script to warn each time a file with "
+ "absolute INSTALL DESTINATION is encountered.",
+ "This variable is used by CMake-generated cmake_install.cmake"
+ " scripts. If ones set this variable to ON while running the"
+ " script, it may get warning messages from the script.", false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
+ ("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", cmProperty::VARIABLE,
+ "Ask cmake_install.cmake script to error out as soon as "
+ "a file with absolute INSTALL DESTINATION is encountered.",
+ "The fatal error is emitted before the installation of "
+ "the offending file takes place."
+ " This variable is used by CMake-generated cmake_install.cmake"
+ " scripts. If ones set this variable to ON while running the"
+ " script, it may get fatal error messages from the script.",false,
+ "Variables That Change Behavior");
// Variables defined by CMake that describe the system
@@ -1310,6 +1350,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"See that target property for additional information.",
false,
"Variables that Control the Build");
+ cm->DefineProperty
+ ("CMAKE_POSITION_INDEPENDENT_FLAGS", cmProperty::VARIABLE,
+ "Default value for POSITION_INDEPENDENT_CODE of targets.",
+ "This variable is used to initialize the "
+ "POSITION_INDEPENDENT_CODE 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/cmDocumentationFormatterHTML.cxx b/Source/cmDocumentationFormatterHTML.cxx
index 6ced1e4..cd0077e 100644
--- a/Source/cmDocumentationFormatterHTML.cxx
+++ b/Source/cmDocumentationFormatterHTML.cxx
@@ -127,7 +127,7 @@ void cmDocumentationFormatterHTML
{
os << "<h2><a name=\"section_";
cmDocumentationPrintHTMLId(os, name);
- os << "\"/>" << name << "</h2>\n";
+ os << "\"></a>" << name << "</h2>\n";
}
// Is a list needed?
@@ -145,7 +145,7 @@ void cmDocumentationFormatterHTML
cmDocumentationPrintHTMLId(os, op->Name.c_str());
os << "\"><b><code>";
this->PrintHTMLEscapes(os, op->Name.c_str());
- os << "</code></b></a></li>";
+ os << "</code></b></a></li>\n";
}
}
os << "</ul>\n" ;
@@ -167,9 +167,9 @@ void cmDocumentationFormatterHTML
{
os << " <a name=\"" << prefix << ":";
cmDocumentationPrintHTMLId(os, op->Name.c_str());
- os << "\"><b><code>";
+ os << "\"></a><b><code>";
this->PrintHTMLEscapes(os, op->Name.c_str());
- os << "</code></b></a>: ";
+ os << "</code></b>: ";
}
this->PrintHTMLEscapes(os, op->Brief.c_str());
if(op->Full.size())
@@ -269,9 +269,9 @@ void cmDocumentationFormatterHTML
return;
}
- os << "<h2><a name=\"section_Index\">Master Index "
+ os << "<h2><a name=\"section_Index\"></a>Master Index "
<< "CMake " << cmVersion::GetCMakeVersion()
- << "</a></h2>\n";
+ << "</h2>\n";
if (!sections.empty())
{
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index c4f5dfb..eb19df5e 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -137,10 +137,20 @@ cmExportFileGenerator
(mf->IsOn("WIN32") || mf->IsOn("CYGWIN") || mf->IsOn("MINGW"));
if(!dll_platform)
{
- std::string soname = target->GetSOName(config);
- std::string prop = "IMPORTED_SONAME";
+ std::string prop;
+ std::string value;
+ if(target->HasSOName(config))
+ {
+ prop = "IMPORTED_SONAME";
+ value = target->GetSOName(config);
+ }
+ else
+ {
+ prop = "IMPORTED_NO_SONAME";
+ value = "TRUE";
+ }
prop += suffix;
- properties[prop] = soname;
+ properties[prop] = value;
}
}
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index ccb17f0..5df8627 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -60,6 +60,9 @@ cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator()
// disable until somebody actually tests it:
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
#endif
+#ifdef CMAKE_USE_NINJA
+ this->SupportedGlobalGenerators.push_back("Ninja");
+#endif
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
}
@@ -383,6 +386,7 @@ void cmExtraCodeBlocksGenerator
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
+ case cmTarget::OBJECT_LIBRARY:
{
this->AppendTarget(fout, ti->first.c_str(), &ti->second,
make.c_str(), makefile, compiler.c_str());
@@ -420,6 +424,7 @@ void cmExtraCodeBlocksGenerator
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
+ case cmTarget::OBJECT_LIBRARY:
case cmTarget::UTILITY: // can have sources since 2.6.3
{
const std::vector<cmSourceFile*>&sources=ti->second.GetSourceFiles();
@@ -532,6 +537,31 @@ void cmExtraCodeBlocksGenerator
}
+// Write a dummy file for OBJECT libraries, so C::B can reference some file
+std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
+ cmMakefile* mf, cmTarget* target) const
+{
+ // this file doesn't seem to be used by C::B in custom makefile mode,
+ // but we generate a unique file for each OBJECT library so in case
+ // C::B uses it in some way, the targets don't interfere with each other.
+ std::string filename = mf->GetCurrentOutputDirectory();
+ filename += "/";
+ filename += mf->GetLocalGenerator()->GetTargetDirectory(*target);
+ filename += "/";
+ filename += target->GetName();
+ filename += ".objlib";
+ cmGeneratedFileStream fout(filename.c_str());
+ if(fout)
+ {
+ fout << "# This is a dummy file for the OBJECT library "
+ << target->GetName()
+ << " for the CMake CodeBlocks project generator.\n"
+ << "# Don't edit, this file will be overwritten.\n";
+ }
+ return filename;
+}
+
+
// Generate the xml code for one target.
void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
const char* targetName,
@@ -570,7 +600,18 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
}
const char* buildType = makefile->GetDefinition("CMAKE_BUILD_TYPE");
- fout<<" <Option output=\"" << target->GetLocation(buildType)
+ std::string location;
+ if ( target->GetType()==cmTarget::OBJECT_LIBRARY)
+ {
+ location = this->CreateDummyTargetFile(const_cast<cmMakefile*>(makefile),
+ target);
+ }
+ else
+ {
+ location = target->GetLocation(buildType);
+ }
+
+ fout<<" <Option output=\"" << location
<< "\" prefix_auto=\"0\" extension_auto=\"0\" />\n"
" <Option working_dir=\"" << workingDir << "\" />\n"
" <Option object_output=\"./\" />\n"
@@ -728,7 +769,8 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target)
return 1;
}
}
- else if ( target->GetType()==cmTarget::STATIC_LIBRARY)
+ else if (( target->GetType()==cmTarget::STATIC_LIBRARY)
+ || (target->GetType()==cmTarget::OBJECT_LIBRARY))
{
return 2;
}
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index 57751fc..e0a64ca 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -44,6 +44,8 @@ private:
void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
const std::string& filename);
+ std::string CreateDummyTargetFile(cmMakefile* mf, cmTarget* target) const;
+
std::string GetCBCompilerId(const cmMakefile* mf);
int GetCBTargetType(cmTarget* target);
std::string BuildMakeCommand(const std::string& make, const char* makefile,
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 65077b3..ab11307 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -34,6 +34,9 @@ cmExtraEclipseCDT4Generator
this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
#endif
+#ifdef CMAKE_USE_NINJA
+ this->SupportedGlobalGenerators.push_back("Ninja");
+#endif
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
this->SupportsVirtualFolders = true;
@@ -286,6 +289,9 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
// set the make command
std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ const std::string makeArgs = mf->GetSafeDefinition(
+ "CMAKE_ECLIPSE_MAKE_ARGUMENTS");
+
fout <<
"\t\t\t\t<dictionary>\n"
"\t\t\t\t\t<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>\n"
@@ -293,7 +299,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
"\t\t\t\t</dictionary>\n"
"\t\t\t\t<dictionary>\n"
"\t\t\t\t\t<key>org.eclipse.cdt.make.core.build.command</key>\n"
- "\t\t\t\t\t<value>" + this->GetEclipsePath(make) + "</value>\n"
+ "\t\t\t\t\t<value>" << this->GetEclipsePath(make) << "</value>\n"
"\t\t\t\t</dictionary>\n"
"\t\t\t\t<dictionary>\n"
"\t\t\t\t\t<key>org.eclipse.cdt.make.core.contents</key>\n"
@@ -305,7 +311,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
"\t\t\t\t</dictionary>\n"
"\t\t\t\t<dictionary>\n"
"\t\t\t\t\t<key>org.eclipse.cdt.make.core.build.arguments</key>\n"
- "\t\t\t\t\t<value></value>\n"
+ "\t\t\t\t\t<value>" << makeArgs << "</value>\n"
"\t\t\t\t</dictionary>\n"
"\t\t\t\t<dictionary>\n"
"\t\t\t\t\t<key>org.eclipse.cdt.make.core.buildLocation</key>\n"
@@ -1067,9 +1073,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
//insert rules for compiling, preprocessing and assembling individual files
- cmLocalUnixMakefileGenerator3* lumg=(cmLocalUnixMakefileGenerator3*)*it;
std::vector<std::string> objectFileTargets;
- lumg->GetIndividualFileTargets(objectFileTargets);
+ (*it)->GetIndividualFileTargets(objectFileTargets);
for(std::vector<std::string>::const_iterator fit=objectFileTargets.begin();
fit != objectFileTargets.end();
++fit)
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 3f14fa1..5da5a01 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -300,7 +300,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
offset = atoi(offsetArg.GetCString());
}
- file.seekg(offset);
+ file.seekg(offset, std::ios::beg); // explicit ios::beg for IBM VisualAge 6
std::string output;
@@ -1003,7 +1003,9 @@ protected:
// Match rules are case-insensitive on some platforms.
#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
std::string lower = cmSystemTools::LowerCase(file);
- file = lower.c_str();
+ const char* file_to_match = lower.c_str();
+#else
+ const char* file_to_match = file;
#endif
// Collect properties from all matching rules.
@@ -1012,7 +1014,7 @@ protected:
for(std::vector<MatchRule>::iterator mr = this->MatchRules.begin();
mr != this->MatchRules.end(); ++mr)
{
- if(mr->Regex.find(file))
+ if(mr->Regex.find(file_to_match))
{
matched = true;
result.Exclude |= mr->Properties.Exclude;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index ef16ce8..be47f95 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -89,7 +89,7 @@ void cmFindPackageCommand::GenerateDocumentation()
"FIND_XXX", "find_package");
this->CommandDocumentation =
" find_package(<package> [version] [EXACT] [QUIET] [MODULE]\n"
- " [[REQUIRED|COMPONENTS] [components...]]\n"
+ " [REQUIRED] [[COMPONENTS] [components...]]\n"
" [OPTIONAL_COMPONENTS components...]\n"
" [NO_POLICY_SCOPE])\n"
"Finds and loads settings from an external project. "
@@ -102,7 +102,7 @@ void cmFindPackageCommand::GenerateDocumentation()
"package cannot be found."
"\n"
"A package-specific list of required components may be listed after the "
- "COMPONENTS option or directly after the REQUIRED option. "
+ "COMPONENTS option (or after the REQUIRED option if present). "
"Additional optional components may be listed after OPTIONAL_COMPONENTS. "
"Available components and their influence on whether a package is "
"considered to be found are defined by the target package."
@@ -136,7 +136,7 @@ void cmFindPackageCommand::GenerateDocumentation()
"proceeds to Config mode.\n"
"The complete Config mode command signature is:\n"
" find_package(<package> [version] [EXACT] [QUIET]\n"
- " [[REQUIRED|COMPONENTS] [components...]]\n"
+ " [REQUIRED] [[COMPONENTS] [components...]]\n"
" [CONFIG|NO_MODULE]\n"
" [NO_POLICY_SCOPE]\n"
" [NAMES name1 [name2 ...]]\n"
@@ -353,6 +353,29 @@ void cmFindPackageCommand::GenerateDocumentation()
"variable CMAKE_DISABLE_FIND_PACKAGE_<package> to TRUE. See the "
"documentation for the CMAKE_DISABLE_FIND_PACKAGE_<package> variable for "
"more information.\n"
+ "When loading a find module or package configuration file find_package "
+ "defines variables to provide information about the call arguments "
+ "(and restores their original state before returning):\n"
+ " <package>_FIND_REQUIRED = true if REQUIRED option was given\n"
+ " <package>_FIND_QUIETLY = true if QUIET option was given\n"
+ " <package>_FIND_VERSION = full requested version string\n"
+ " <package>_FIND_VERSION_MAJOR = major version if requested, else 0\n"
+ " <package>_FIND_VERSION_MINOR = minor version if requested, else 0\n"
+ " <package>_FIND_VERSION_PATCH = patch version if requested, else 0\n"
+ " <package>_FIND_VERSION_TWEAK = tweak version if requested, else 0\n"
+ " <package>_FIND_VERSION_COUNT = number of version components, 0 to 4\n"
+ " <package>_FIND_VERSION_EXACT = true if EXACT option was given\n"
+ " <package>_FIND_COMPONENTS = list of requested components\n"
+ " <package>_FIND_REQUIRED_<c> = true if component <c> is required\n"
+ " false if component <c> is optional\n"
+ "In Module mode the loaded find module is responsible to honor the "
+ "request detailed by these variables; see the find module for details. "
+ "In Config mode find_package handles REQUIRED, QUIET, and version "
+ "options automatically but leaves it to the package configuration file "
+ "to handle components in a way that makes sense for the package. "
+ "The package configuration file may set <package>_FOUND to false "
+ "to tell find_package that component requirements are not satisfied."
+ "\n"
"See the cmake_policy() command documentation for discussion of the "
"NO_POLICY_SCOPE option."
;
@@ -1345,41 +1368,73 @@ bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
}
//----------------------------------------------------------------------------
-void cmFindPackageCommand::AppendToProperty(const char* propertyName)
+void cmFindPackageCommand::AppendToFoundProperty(bool found)
{
- std::string propertyValue;
- const char *prop =
- this->Makefile->GetCMakeInstance()->GetProperty(propertyName);
- if (prop && *prop)
+ std::vector<std::string> foundContents;
+ const char *foundProp =
+ this->Makefile->GetCMakeInstance()->GetProperty("PACKAGES_FOUND");
+ if (foundProp && *foundProp)
{
- propertyValue = prop;
-
- std::vector<std::string> contents;
- cmSystemTools::ExpandListArgument(propertyValue, contents, false);
+ std::string tmp = foundProp;
- bool alreadyInserted = false;
- for(std::vector<std::string>::const_iterator it = contents.begin();
- it != contents.end(); ++ it )
+ cmSystemTools::ExpandListArgument(tmp, foundContents, false);
+ std::vector<std::string>::iterator nameIt = std::find(
+ foundContents.begin(), foundContents.end(), this->Name);
+ if(nameIt != foundContents.end())
{
- if (*it == this->Name)
- {
- alreadyInserted = true;
- break;
- }
+ foundContents.erase(nameIt);
}
- if (!alreadyInserted)
+ }
+
+ std::vector<std::string> notFoundContents;
+ const char *notFoundProp =
+ this->Makefile->GetCMakeInstance()->GetProperty("PACKAGES_NOT_FOUND");
+ if (notFoundProp && *notFoundProp)
+ {
+ std::string tmp = notFoundProp;
+
+ cmSystemTools::ExpandListArgument(tmp, notFoundContents, false);
+ std::vector<std::string>::iterator nameIt = std::find(
+ notFoundContents.begin(), notFoundContents.end(), this->Name);
+ if(nameIt != notFoundContents.end())
{
- propertyValue += ";";
- propertyValue += this->Name;
+ notFoundContents.erase(nameIt);
}
}
+
+ if(found)
+ {
+ foundContents.push_back(this->Name);
+ }
else
{
- propertyValue = this->Name;
+ notFoundContents.push_back(this->Name);
}
- this->Makefile->GetCMakeInstance()->SetProperty(propertyName,
- propertyValue.c_str());
- }
+
+
+ std::string tmp;
+ const char* sep ="";
+ for(size_t i=0; i<foundContents.size(); i++)
+ {
+ tmp += sep;
+ tmp += foundContents[i];
+ sep = ";";
+ }
+
+ this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_FOUND",
+ tmp.c_str());
+
+ tmp = "";
+ sep = "";
+ for(size_t i=0; i<notFoundContents.size(); i++)
+ {
+ tmp += sep;
+ tmp += notFoundContents[i];
+ sep = ";";
+ }
+ this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_NOT_FOUND",
+ tmp.c_str());
+}
//----------------------------------------------------------------------------
void cmFindPackageCommand::AppendSuccessInformation()
@@ -1390,14 +1445,10 @@ void cmFindPackageCommand::AppendSuccessInformation()
const char* upperResult = this->Makefile->GetDefinition(upperFound.c_str());
const char* result = this->Makefile->GetDefinition(found.c_str());
- if ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult)))
- {
- this->AppendToProperty("PACKAGES_FOUND");
- }
- else
- {
- this->AppendToProperty("PACKAGES_NOT_FOUND");
- }
+ bool packageFound = ((cmSystemTools::IsOn(result))
+ || (cmSystemTools::IsOn(upperResult)));
+
+ this->AppendToFoundProperty(packageFound);
// Record whether the find was quiet or not, so this can be used
// e.g. in FeatureSummary.cmake
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index edb70a6..c380122 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -69,7 +69,7 @@ protected:
virtual void GenerateDocumentation();
private:
void AppendSuccessInformation();
- void AppendToProperty(const char* propertyName);
+ void AppendToFoundProperty(bool found);
void SetModuleVariables(const std::string& components);
bool FindModule(bool& found);
void AddFindDefinition(const char* var, const char* val);
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 42dd428..6e2e23d 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -39,17 +39,10 @@ void cmGeneratorTarget::ClassifySources()
{
cmSourceFile* sf = *si;
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
- cmTarget::SourceFileFlags tsFlags =
- this->Target->GetTargetSourceFileFlags(sf);
if(sf->GetCustomCommand())
{
this->CustomCommands.push_back(sf);
}
- else if(tsFlags.Type != cmTarget::SourceFileTypeNormal)
- {
- this->OSXContent.push_back(sf);
- if(isObjLib) { badObjLib.push_back(sf); }
- }
else if(sf->GetPropertyAsBool("HEADER_FILE_ONLY"))
{
this->HeaderSources.push_back(sf);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 3e50656..5c7578d 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -37,7 +37,6 @@ public:
std::vector<cmSourceFile*> HeaderSources;
std::vector<cmSourceFile*> ObjectSources;
std::vector<cmSourceFile*> ExternalObjects;
- std::vector<cmSourceFile*> OSXContent;
std::vector<cmSourceFile*> IDLSources;
std::string ModuleDefinitionFile;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 545f9e8..a47ca36 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -586,6 +586,16 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
}
} // end if in try compile
} // end need test language
+ // Store the shared library flags so that we can satisfy CMP0018
+ std::string sharedLibFlagsVar = "CMAKE_SHARED_LIBRARY_";
+ sharedLibFlagsVar += lang;
+ sharedLibFlagsVar += "_FLAGS";
+ const char* sharedLibFlags =
+ mf->GetSafeDefinition(sharedLibFlagsVar.c_str());
+ if (sharedLibFlags)
+ {
+ this->LanguageToOriginalSharedLibFlags[lang] = sharedLibFlags;
+ }
} // end for each language
// Now load files that can override any settings on the platform or for
@@ -2092,6 +2102,32 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
}
//----------------------------------------------------------------------------
+std::string
+cmGlobalGenerator::GenerateRuleFile(std::string const& output) const
+{
+ std::string ruleFile = output;
+ ruleFile += ".rule";
+ const char* dir = this->GetCMakeCFGIntDir();
+ if(dir && dir[0] == '$')
+ {
+ cmSystemTools::ReplaceString(ruleFile, dir,
+ cmake::GetCMakeFilesDirectory());
+ }
+ return ruleFile;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
+ std::string const& l)
+{
+ if(this->LanguageToOriginalSharedLibFlags.count(l) > 0)
+ {
+ return this->LanguageToOriginalSharedLibFlags[l];
+ }
+ return "";
+}
+
+//----------------------------------------------------------------------------
void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*,
const char*, std::string&)
{
@@ -2459,3 +2495,16 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
cmSystemTools::RemoveFile(file.c_str());
}
}
+
+//----------------------------------------------------------------------------
+// static
+std::string cmGlobalGenerator::EscapeJSON(const std::string& s) {
+ std::string result;
+ for (std::string::size_type i = 0; i < s.size(); ++i) {
+ if (s[i] == '"' || s[i] == '\\') {
+ result += '\\';
+ }
+ result += s[i];
+ }
+ return result;
+}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 80b948b..ce91793 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -277,6 +277,13 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig() { return false; }
+ std::string GetSharedLibFlagsForLanguage(std::string const& lang);
+
+ /** Generate an <output>.rule file path for a given command output. */
+ virtual std::string GenerateRuleFile(std::string const& output) const;
+
+ static std::string EscapeJSON(const std::string& s);
+
protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector;
// for a project collect all its targets by following depend
@@ -354,6 +361,7 @@ private:
std::map<cmStdString, cmStdString> LanguageToOutputExtension;
std::map<cmStdString, cmStdString> ExtensionToLanguage;
std::map<cmStdString, int> LanguageToLinkerPreference;
+ std::map<cmStdString, cmStdString> LanguageToOriginalSharedLibFlags;
// Record hashes for rules and outputs.
struct RuleHash { char Data[32]; };
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 56b9e9c..f699448 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -44,6 +44,9 @@ cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
:cmExternalMakefileProjectGenerator()
{
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
+#ifdef CMAKE_USE_NINJA
+ this->SupportedGlobalGenerators.push_back("Ninja");
+#endif
}
void cmGlobalKdevelopGenerator::Generate()
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 9cbd502..c3989c0 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -43,12 +43,13 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
std::string replace = comment;
std::string::size_type lpos = 0;
std::string::size_type rpos;
+ os << "\n#############################################\n";
while((rpos = replace.find('\n', lpos)) != std::string::npos)
{
os << "# " << replace.substr(lpos, rpos - lpos) << "\n";
lpos = rpos + 1;
}
- os << "# " << replace.substr(lpos) << "\n";
+ os << "# " << replace.substr(lpos) << "\n\n";
}
static bool IsIdentChar(char c)
@@ -66,7 +67,7 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
if (std::find_if(ident.begin(), ident.end(),
std::not1(std::ptr_fun(IsIdentChar))) != ident.end()) {
static unsigned VarNum = 0;
- std::ostringstream names;
+ cmOStringStream names;
names << "ident" << VarNum++;
vars << names.str() << " = " << ident << "\n";
return "$" + names.str();
@@ -89,7 +90,10 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string &path)
{
std::string result = path;
#ifdef _WIN32
- cmSystemTools::ReplaceString(result, "/", "\\");
+ if(UsingMinGW)
+ cmSystemTools::ReplaceString(result, "\\", "/");
+ else
+ cmSystemTools::ReplaceString(result, "/", "\\");
#endif
return EncodeLiteral(result);
}
@@ -101,7 +105,8 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
const cmNinjaDeps& explicitDeps,
const cmNinjaDeps& implicitDeps,
const cmNinjaDeps& orderOnlyDeps,
- const cmNinjaVars& variables)
+ const cmNinjaVars& variables,
+ int cmdLineLimit)
{
// Make sure there is a rule.
if(rule.empty())
@@ -123,50 +128,60 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
cmGlobalNinjaGenerator::WriteComment(os, comment);
- std::ostringstream builds;
+ cmOStringStream arguments;
// TODO: Better formatting for when there are multiple input/output files.
- // Write outputs files.
- builds << "build";
- for(cmNinjaDeps::const_iterator i = outputs.begin();
- i != outputs.end();
- ++i)
- builds << " " << EncodeIdent(EncodePath(*i), os);
- builds << ":";
-
- // Write the rule.
- builds << " " << rule;
-
// Write explicit dependencies.
for(cmNinjaDeps::const_iterator i = explicitDeps.begin();
i != explicitDeps.end();
++i)
- builds << " " << EncodeIdent(EncodePath(*i), os);
+ arguments << " " << EncodeIdent(EncodePath(*i), os);
// Write implicit dependencies.
if(!implicitDeps.empty())
{
- builds << " |";
+ arguments << " |";
for(cmNinjaDeps::const_iterator i = implicitDeps.begin();
i != implicitDeps.end();
++i)
- builds << " " << EncodeIdent(EncodePath(*i), os);
+ arguments << " " << EncodeIdent(EncodePath(*i), os);
}
// Write order-only dependencies.
if(!orderOnlyDeps.empty())
{
- builds << " ||";
+ arguments << " ||";
for(cmNinjaDeps::const_iterator i = orderOnlyDeps.begin();
i != orderOnlyDeps.end();
++i)
- builds << " " << EncodeIdent(EncodePath(*i), os);
+ arguments << " " << EncodeIdent(EncodePath(*i), os);
}
- builds << "\n";
+ arguments << "\n";
+
+
+ cmOStringStream builds;
- os << builds.str();
+ // Write outputs files.
+ builds << "build";
+ for(cmNinjaDeps::const_iterator i = outputs.begin();
+ i != outputs.end();
+ ++i)
+ builds << " " << EncodeIdent(EncodePath(*i), os);
+ builds << ":";
+
+
+ // Write the rule.
+ builds << " " << rule;
+
+ // check if a response file rule should be used
+ const std::string args = arguments.str();
+ if (cmdLineLimit > 0 &&
+ (args.size() + + builds.str().size()) > (size_t)cmdLineLimit)
+ builds << "_RSPFILE";
+
+ os << builds.str() << args;
// Write the variables bound to this build statement.
for(cmNinjaVars::const_iterator i = variables.begin();
@@ -200,6 +215,7 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule()
"$DESC",
"Rule for running custom commands.",
/*depfile*/ "",
+ /*rspfile*/ "",
/*restat*/ true);
}
@@ -211,10 +227,17 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
const cmNinjaDeps& deps,
const cmNinjaDeps& orderOnlyDeps)
{
+ std::string cmd = command;
+#ifdef _WIN32
+ if (cmd.empty())
+ // TODO Shouldn't an empty command be handled by ninja?
+ cmd = "cmd.exe /c";
+#endif
+
this->AddCustomCommandRule();
cmNinjaVars vars;
- vars["COMMAND"] = command;
+ vars["COMMAND"] = cmd;
vars["DESC"] = EncodeLiteral(description);
cmGlobalNinjaGenerator::WriteBuild(*this->BuildFileStream,
@@ -233,6 +256,7 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
const std::string& description,
const std::string& comment,
const std::string& depfile,
+ const std::string& rspfile,
bool restat,
bool generator)
{
@@ -277,6 +301,14 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
os << "description = " << description << "\n";
}
+ if(!rspfile.empty())
+ {
+ cmGlobalNinjaGenerator::Indent(os, 1);
+ os << "rspfile = " << rspfile << "\n";
+ cmGlobalNinjaGenerator::Indent(os, 1);
+ os << "rspfile_content = $in" << "\n";
+ }
+
if(restat)
{
cmGlobalNinjaGenerator::Indent(os, 1);
@@ -288,6 +320,8 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
cmGlobalNinjaGenerator::Indent(os, 1);
os << "generator = 1\n";
}
+
+ os << "\n";
}
void cmGlobalNinjaGenerator::WriteVariable(std::ostream& os,
@@ -341,6 +375,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
: cmGlobalGenerator()
, BuildFileStream(0)
, RulesFileStream(0)
+ , CompileCommandsStream(0)
, Rules()
, AllDependencies()
{
@@ -349,6 +384,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake";
}
+
//----------------------------------------------------------------------------
// Virtual public methods.
@@ -385,6 +421,12 @@ void cmGlobalNinjaGenerator::Generate()
this->WriteTargetAliases(*this->BuildFileStream);
this->WriteBuiltinTargets(*this->BuildFileStream);
+ if (cmSystemTools::GetErrorOccuredFlag()) {
+ this->RulesFileStream->setstate(std::ios_base::failbit);
+ this->BuildFileStream->setstate(std::ios_base::failbit);
+ }
+
+ this->CloseCompileCommandsStream();
this->CloseRulesFileStream();
this->CloseBuildFileStream();
}
@@ -397,16 +439,19 @@ void cmGlobalNinjaGenerator
cmMakefile *mf,
bool optional)
{
- this->cmGlobalGenerator::EnableLanguage(languages, mf, optional);
std::string path;
for(std::vector<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
+ std::vector<std::string> language;
+ language.push_back(*l);
+
if(*l == "NONE")
{
+ this->cmGlobalGenerator::EnableLanguage(language, mf, optional);
continue;
}
- if(*l == "Fortran")
+ else if(*l == "Fortran")
{
std::string message = "The \"";
message += this->GetName();
@@ -415,10 +460,25 @@ void cmGlobalNinjaGenerator
message += "\" yet.";
cmSystemTools::Error(message.c_str());
}
+ else if(*l == "RC")
+ {
+ // check if mingw is used
+ if(mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
+ {
+ UsingMinGW = true;
+ std::string rc = cmSystemTools::FindProgram("windres");
+ if(rc.empty())
+ rc = "windres.exe";;
+ mf->AddDefinition("CMAKE_RC_COMPILER", rc.c_str());
+ }
+ }
+ this->cmGlobalGenerator::EnableLanguage(language, mf, optional);
this->ResolveLanguageCompiler(*l, mf, optional);
}
}
+bool cmGlobalNinjaGenerator::UsingMinGW = false;
+
// Implemented by:
// cmGlobalUnixMakefileGenerator3
// cmGlobalVisualStudio10Generator
@@ -476,12 +536,15 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name,
const std::string& description,
const std::string& comment,
const std::string& depfile,
+ const std::string& rspfile,
bool restat,
bool generator)
{
// Do not add the same rule twice.
if (this->HasRule(name))
+ {
return;
+ }
this->Rules.insert(name);
cmGlobalNinjaGenerator::WriteRule(*this->RulesFileStream,
@@ -490,6 +553,7 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name,
description,
comment,
depfile,
+ rspfile,
restat,
generator);
}
@@ -618,6 +682,46 @@ void cmGlobalNinjaGenerator::CloseRulesFileStream()
}
}
+void cmGlobalNinjaGenerator::AddCXXCompileCommand(
+ const std::string &commandLine,
+ const std::string &sourceFile)
+{
+ // Compute Ninja's build file path.
+ std::string buildFileDir =
+ this->GetCMakeInstance()->GetHomeOutputDirectory();
+ if (!this->CompileCommandsStream)
+ {
+ std::string buildFilePath = buildFileDir + "/compile_commands.json";
+
+ // Get a stream where to generate things.
+ this->CompileCommandsStream =
+ new cmGeneratedFileStream(buildFilePath.c_str());
+ *this->CompileCommandsStream << "[";
+ } else {
+ *this->CompileCommandsStream << "," << std::endl;
+ }
+
+ *this->CompileCommandsStream << "\n{\n"
+ << " \"directory\": \""
+ << cmGlobalGenerator::EscapeJSON(buildFileDir) << "\",\n"
+ << " \"command\": \""
+ << cmGlobalGenerator::EscapeJSON(commandLine) << "\",\n"
+ << " \"file\": \""
+ << cmGlobalGenerator::EscapeJSON(sourceFile) << "\"\n"
+ << "}";
+}
+
+void cmGlobalNinjaGenerator::CloseCompileCommandsStream()
+{
+ if (this->CompileCommandsStream)
+ {
+ *this->CompileCommandsStream << "\n]";
+ delete this->CompileCommandsStream;
+ this->CompileCommandsStream = 0;
+ }
+
+}
+
void cmGlobalNinjaGenerator::WriteDisclaimer(std::ostream& os)
{
os
@@ -720,7 +824,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
// Insert the alias into the map. If the alias was already present in the
// map and referred to another target, mark it as ambiguous.
std::pair<TargetAliasMap::iterator, bool> newAlias =
- TargetAliases.insert(make_pair(alias, target));
+ TargetAliases.insert(std::make_pair(alias, target));
if (newAlias.second && newAlias.first->second != target)
newAlias.first->second = 0;
}
@@ -754,6 +858,8 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
this->WriteTargetAll(os);
this->WriteTargetRebuildManifest(os);
+ this->WriteTargetClean(os);
+ this->WriteTargetHelp(os);
}
void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
@@ -776,7 +882,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmLocalGenerator *lg = this->LocalGenerators[0];
cmMakefile* mfRoot = lg->GetMakefile();
- std::ostringstream cmd;
+ cmOStringStream cmd;
cmd << lg->ConvertToOutputFormat(
mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
cmLocalGenerator::SHELL)
@@ -792,6 +898,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
"Re-running CMake...",
"Rule for re-running cmake.",
/*depfile=*/ "",
+ /*rspfile=*/ "",
/*restat=*/ false,
/*generator=*/ true);
@@ -820,3 +927,56 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
implicitDeps,
cmNinjaDeps());
}
+
+std::string cmGlobalNinjaGenerator::ninjaCmd() const
+{
+ cmLocalGenerator* lgen = this->LocalGenerators[0];
+ if (lgen) {
+ return lgen->ConvertToOutputFormat(
+ lgen->GetMakefile()->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"),
+ cmLocalGenerator::SHELL);
+ }
+ return "ninja";
+}
+
+void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
+{
+ WriteRule(*this->RulesFileStream,
+ "CLEAN",
+ (ninjaCmd() + " -t clean").c_str(),
+ "Cleaning all built files...",
+ "Rule for cleaning all built files.",
+ /*depfile=*/ "",
+ /*rspfile=*/ "",
+ /*restat=*/ false,
+ /*generator=*/ false);
+ WriteBuild(os,
+ "Clean all the built files.",
+ "CLEAN",
+ /*outputs=*/ cmNinjaDeps(1, "clean"),
+ /*explicitDeps=*/ cmNinjaDeps(),
+ /*implicitDeps=*/ cmNinjaDeps(),
+ /*orderOnlyDeps=*/ cmNinjaDeps(),
+ /*variables=*/ cmNinjaVars());
+}
+
+void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
+{
+ WriteRule(*this->RulesFileStream,
+ "HELP",
+ (ninjaCmd() + " -t tagets").c_str(),
+ "All primary targets available:",
+ "Rule for printing all primary targets available.",
+ /*depfile=*/ "",
+ /*rspfile=*/ "",
+ /*restat=*/ false,
+ /*generator=*/ false);
+ WriteBuild(os,
+ "Print all primary targets available.",
+ "HELP",
+ /*outputs=*/ cmNinjaDeps(1, "help"),
+ /*explicitDeps=*/ cmNinjaDeps(),
+ /*implicitDeps=*/ cmNinjaDeps(),
+ /*orderOnlyDeps=*/ cmNinjaDeps(),
+ /*variables=*/ cmNinjaVars());
+}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 3217581..e939f61 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -16,6 +16,8 @@
# include "cmGlobalGenerator.h"
# include "cmNinjaTypes.h"
+//#define NINJA_GEN_VERBOSE_FILES
+
class cmLocalGenerator;
class cmGeneratedFileStream;
class cmGeneratorTarget;
@@ -81,7 +83,8 @@ public:
const cmNinjaDeps& explicitDeps,
const cmNinjaDeps& implicitDeps,
const cmNinjaDeps& orderOnlyDeps,
- const cmNinjaVars& variables);
+ const cmNinjaVars& variables,
+ int cmdLineLimit = -1);
/**
* Helper to write a build statement with the special 'phony' rule.
@@ -113,6 +116,7 @@ public:
const std::string& description,
const std::string& comment = "",
const std::string& depfile = "",
+ const std::string& rspfile = "" ,
bool restat = false,
bool generator = false);
@@ -143,6 +147,9 @@ public:
const cmNinjaDeps& targets,
const std::string& comment = "");
+
+ static bool IsMinGW() { return UsingMinGW; }
+
public:
/// Default constructor.
cmGlobalNinjaGenerator();
@@ -213,6 +220,9 @@ public:
cmGeneratedFileStream* GetRulesFileStream() const
{ return this->RulesFileStream; }
+ void AddCXXCompileCommand(const std::string &commandLine,
+ const std::string &sourceFile);
+
/**
* Add a rule to the generated build system.
* Call WriteRule() behind the scene but perform some check before like:
@@ -223,6 +233,7 @@ public:
const std::string& description,
const std::string& comment = "",
const std::string& depfile = "",
+ const std::string& rspfile = "",
bool restat = false,
bool generator = false);
@@ -254,6 +265,8 @@ private:
void OpenBuildFileStream();
void CloseBuildFileStream();
+ void CloseCompileCommandsStream();
+
void OpenRulesFileStream();
void CloseRulesFileStream();
@@ -273,6 +286,8 @@ private:
void WriteBuiltinTargets(std::ostream& os);
void WriteTargetAll(std::ostream& os);
void WriteTargetRebuildManifest(std::ostream& os);
+ void WriteTargetClean(std::ostream& os);
+ void WriteTargetHelp(std::ostream& os);
/// Called when we have seen the given custom command. Returns true
/// if we has seen it before.
@@ -302,6 +317,8 @@ private:
ASD.insert(deps.begin(), deps.end());
}
+ std::string ninjaCmd() const;
+
private:
/// The file containing the build statement. (the relation ship of the
/// compilation DAG).
@@ -309,6 +326,7 @@ private:
/// The file containing the rule statements. (The action attached to each
/// edge of the compilation DAG).
cmGeneratedFileStream* RulesFileStream;
+ cmGeneratedFileStream* CompileCommandsStream;
/// The type used to store the set of rules added to the generated build
/// system.
@@ -333,6 +351,9 @@ private:
TargetAliasMap TargetAliases;
static cmLocalGenerator* LocalGenerator;
+
+ static bool UsingMinGW;
+
};
#endif // ! cmGlobalNinjaGenerator_h
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index e63de9c..ebd8219 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -103,18 +103,6 @@ cmGlobalUnixMakefileGenerator3
}
}
-//----------------------------------------------------------------------------
-std::string EscapeJSON(const std::string& s) {
- std::string result;
- for (std::string::size_type i = 0; i < s.size(); ++i) {
- if (s[i] == '"' || s[i] == '\\') {
- result += '\\';
- }
- result += s[i];
- }
- return result;
-}
-
void cmGlobalUnixMakefileGenerator3::Generate()
{
// first do superclass method
@@ -179,11 +167,14 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand(
*this->CommandDatabase << "," << std::endl;
}
*this->CommandDatabase << "{" << std::endl
- << " \"directory\": \"" << EscapeJSON(workingDirectory) << "\","
+ << " \"directory\": \""
+ << cmGlobalGenerator::EscapeJSON(workingDirectory) << "\","
<< std::endl
- << " \"command\": \"" << EscapeJSON(compileCommand) << "\","
+ << " \"command\": \"" <<
+ cmGlobalGenerator::EscapeJSON(compileCommand) << "\","
<< std::endl
- << " \"file\": \"" << EscapeJSON(sourceFile) << "\""
+ << " \"file\": \"" <<
+ cmGlobalGenerator::EscapeJSON(sourceFile) << "\""
<< std::endl << "}";
}
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 22ead10..947a1c9 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -13,6 +13,7 @@
#include "cmGlobalVisualStudio10Generator.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
+#include "cmSourceFile.h"
#include "cmake.h"
@@ -51,6 +52,38 @@ cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator()
}
//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10Generator::Generate()
+{
+ this->LongestSource = LongestSourcePath();
+ this->cmGlobalVisualStudio8Generator::Generate();
+ if(this->LongestSource.Length > 0)
+ {
+ cmMakefile* mf = this->LongestSource.Target->GetMakefile();
+ cmOStringStream e;
+ e <<
+ "The binary and/or source directory paths may be too long to generate "
+ "Visual Studio 10 files for this project. "
+ "Consider choosing shorter directory names to build this project with "
+ "Visual Studio 10. "
+ "A more detailed explanation follows."
+ "\n"
+ "There is a bug in the VS 10 IDE that renders property dialog fields "
+ "blank for files referenced by full path in the project file. "
+ "However, CMake must reference at least one file by full path:\n"
+ " " << this->LongestSource.SourceFile->GetFullPath() << "\n"
+ "This is because some Visual Studio tools would append the relative "
+ "path to the end of the referencing directory path, as in:\n"
+ " " << mf->GetCurrentOutputDirectory() << "/"
+ << this->LongestSource.SourceRel << "\n"
+ "and then incorrectly complain that the file does not exist because "
+ "the path length is too long for some internal buffer or API. "
+ "To avoid this problem CMake must use a full path for this file "
+ "which then triggers the VS 10 property dialog bug.";
+ mf->IssueMessage(cmake::WARNING, e.str().c_str());
+ }
+}
+
+//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator
::GetDocumentation(cmDocumentationEntry& entry) const
{
@@ -212,3 +245,42 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
return false;
}
}
+
+//----------------------------------------------------------------------------
+std::string
+cmGlobalVisualStudio10Generator
+::GenerateRuleFile(std::string const& output) const
+{
+ // The VS 10 generator needs to create the .rule files on disk.
+ // Hide them away under the CMakeFiles directory.
+ std::string ruleDir = this->GetCMakeInstance()->GetHomeOutputDirectory();
+ ruleDir += cmake::GetCMakeFilesDirectory();
+ ruleDir += "/";
+ ruleDir += cmSystemTools::ComputeStringMD5(
+ cmSystemTools::GetFilenamePath(output).c_str());
+ std::string ruleFile = ruleDir + "/";
+ ruleFile += cmSystemTools::GetFilenameName(output);
+ ruleFile += ".rule";
+ return ruleFile;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10Generator::PathTooLong(
+ cmTarget* target, cmSourceFile* sf, std::string const& sfRel)
+{
+ size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) +
+ 1 + sfRel.length());
+ if(len > this->LongestSource.Length)
+ {
+ this->LongestSource.Length = len;
+ this->LongestSource.Target = target;
+ this->LongestSource.SourceFile = sf;
+ this->LongestSource.SourceRel = sfRel;
+ }
+}
+
+//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio10Generator::UseFolderProperty()
+{
+ return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty();
+}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 750b89c..060cdff 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -46,6 +46,8 @@ public:
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator();
+ virtual void Generate();
+
/**
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
@@ -75,10 +77,29 @@ public:
virtual const char* GetCMakeCFGIntDir() const
{ return "$(Configuration)";}
bool Find64BitTools(cmMakefile* mf);
+
+ /** Generate an <output>.rule file path for a given command output. */
+ virtual std::string GenerateRuleFile(std::string const& output) const;
+
+ void PathTooLong(cmTarget* target, cmSourceFile* sf,
+ std::string const& sfRel);
protected:
virtual const char* GetIDEVersion() { return "10.0"; }
std::string PlatformToolset;
bool ExpressEdition;
+
+ bool UseFolderProperty();
+
+private:
+ struct LongestSourcePath
+ {
+ LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
+ size_t Length;
+ cmTarget* Target;
+ cmSourceFile* SourceFile;
+ std::string SourceRel;
+ };
+ LongestSourcePath LongestSource;
};
#endif
diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.cxx b/Source/cmGlobalVisualStudio11ARMGenerator.cxx
new file mode 100644
index 0000000..fef1aba
--- /dev/null
+++ b/Source/cmGlobalVisualStudio11ARMGenerator.cxx
@@ -0,0 +1,32 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+
+ 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 "cmGlobalVisualStudio11ARMGenerator.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio11ARMGenerator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 11 ARM project files.";
+ entry.Full = "";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio11ARMGenerator
+::AddPlatformDefinitions(cmMakefile* mf)
+{
+ this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf);
+ mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "ARM");
+ mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "ARM");
+}
diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.h b/Source/cmGlobalVisualStudio11ARMGenerator.h
new file mode 100644
index 0000000..77e1429
--- /dev/null
+++ b/Source/cmGlobalVisualStudio11ARMGenerator.h
@@ -0,0 +1,37 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+
+ 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 cmGlobalVisualStudio11ARMGenerator_h
+#define cmGlobalVisualStudio11ARMGenerator_h
+
+#include "cmGlobalVisualStudio11Generator.h"
+
+class cmGlobalVisualStudio11ARMGenerator :
+ public cmGlobalVisualStudio11Generator
+{
+public:
+ cmGlobalVisualStudio11ARMGenerator() {}
+ static cmGlobalGenerator* New() {
+ return new cmGlobalVisualStudio11ARMGenerator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalVisualStudio11ARMGenerator::GetActualName();}
+ static const char* GetActualName() {return "Visual Studio 11 ARM";}
+
+ virtual const char* GetPlatformName() const {return "ARM";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ virtual void AddPlatformDefinitions(cmMakefile* mf);
+};
+#endif
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index a5feaca..d6b653c 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -241,9 +241,12 @@ void cmGlobalVisualStudio71Generator
::WriteExternalProject(std::ostream& fout,
const char* name,
const char* location,
+ const char* typeGuid,
const std::set<cmStdString>& depends)
{
- fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
+ fout << "Project(\"{"
+ << (typeGuid ? typeGuid : "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942")
+ << "}\") = \""
<< name << "\", \""
<< this->ConvertToSolutionPath(location) << "\", \"{"
<< this->GetGUID(name)
@@ -279,18 +282,21 @@ void cmGlobalVisualStudio71Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(std::ostream& fout, const char* name,
- bool partOfDefaultBuild)
+ bool partOfDefaultBuild,
+ const char* platformMapping)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
- << ".ActiveCfg = " << *i << "|Win32\n";
+ << ".ActiveCfg = " << *i << "|"
+ << (platformMapping ? platformMapping : "Win32") << std::endl;
if(partOfDefaultBuild)
{
fout << "\t\t{" << guid << "}." << *i
- << ".Build.0 = " << *i << "|Win32\n";
+ << ".Build.0 = " << *i << "|"
+ << (platformMapping ? platformMapping : "Win32") << std::endl;
}
}
}
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index 81c2087..503b708 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -64,10 +64,12 @@ protected:
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
- bool partOfDefaultBuild);
+ bool partOfDefaultBuild,
+ const char* platformMapping = NULL);
virtual void WriteExternalProject(std::ostream& fout,
const char* name,
const char* path,
+ const char* typeGuid,
const std::set<cmStdString>& depends);
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index a68e6d8..6332d0b 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -250,8 +250,9 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
if(expath)
{
- this->WriteProjectConfigurations(fout, target->GetName(),
- true);
+ this->WriteProjectConfigurations(
+ fout, target->GetName(),
+ true, target->GetProperty("VS_PLATFORM_MAPPING"));
}
else
{
@@ -286,8 +287,12 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
{
std::string project = target->GetName();
std::string location = expath;
- this->WriteExternalProject(fout, project.c_str(),
- location.c_str(), target->GetUtilities());
+
+ this->WriteExternalProject(fout,
+ project.c_str(),
+ location.c_str(),
+ target->GetProperty("VS_PROJECT_TYPE"),
+ target->GetUtilities());
written = true;
}
else
@@ -580,18 +585,21 @@ cmGlobalVisualStudio7Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(std::ostream& fout, const char* name,
- bool partOfDefaultBuild)
+ bool partOfDefaultBuild,
+ const char* platformMapping)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
- << ".ActiveCfg = " << *i << "|Win32\n";
+ << ".ActiveCfg = " << *i << "|"
+ << (platformMapping ? platformMapping : "Win32") << "\n";
if(partOfDefaultBuild)
{
fout << "\t\t{" << guid << "}." << *i
- << ".Build.0 = " << *i << "|Win32\n";
+ << ".Build.0 = " << *i << "|"
+ << (platformMapping ? platformMapping : "Win32") << "\n";
}
}
}
@@ -604,10 +612,14 @@ void cmGlobalVisualStudio7Generator
void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout,
const char* name,
const char* location,
+ const char* typeGuid,
const std::set<cmStdString>&)
{
std::string d = cmSystemTools::ConvertToOutputPath(location);
- fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
+ fout << "Project("
+ << "\"{"
+ << (typeGuid ? typeGuid : "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942")
+ << "}\") = \""
<< name << "\", \""
<< this->ConvertToSolutionPath(location) << "\", \"{"
<< this->GetGUID(name)
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index c92998e..9b9107d 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -107,7 +107,8 @@ protected:
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
- bool partOfDefaultBuild);
+ bool partOfDefaultBuild,
+ const char* platformMapping = NULL);
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);
virtual std::string WriteUtilityDepend(cmTarget* target);
@@ -130,6 +131,7 @@ protected:
virtual void WriteExternalProject(std::ostream& fout,
const char* name,
const char* path,
+ const char* typeGuid,
const std::set<cmStdString>&
dependencies);
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index a723109..e7c4232 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -214,13 +214,11 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
// (this could be avoided with per-target source files)
const char* no_main_dependency = 0;
const char* no_working_directory = 0;
- mf->AddCustomCommandToOutput(
- stamps, listFiles,
- no_main_dependency, commandLines, "Checking Build System",
- no_working_directory, true);
- std::string ruleName = stamps[0];
- ruleName += ".rule";
- if(cmSourceFile* file = mf->GetSource(ruleName.c_str()))
+ if(cmSourceFile* file =
+ mf->AddCustomCommandToOutput(
+ stamps, listFiles,
+ no_main_dependency, commandLines, "Checking Build System",
+ no_working_directory, true))
{
tgt->AddSourceFile(file);
}
@@ -270,20 +268,23 @@ cmGlobalVisualStudio8Generator
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(std::ostream& fout, const char* name,
- bool partOfDefaultBuild)
+ bool partOfDefaultBuild,
+ const char* platformMapping)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
- << "|" << this->GetPlatformName() << ".ActiveCfg = "
- << *i << "|" << this->GetPlatformName() << "\n";
+ << "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"
+ << (platformMapping ? platformMapping : this->GetPlatformName())
+ << "\n";
if(partOfDefaultBuild)
{
fout << "\t\t{" << guid << "}." << *i
- << "|" << this->GetPlatformName() << ".Build.0 = "
- << *i << "|" << this->GetPlatformName() << "\n";
+ << "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|"
+ << (platformMapping ? platformMapping : this->GetPlatformName())
+ << "\n";
}
}
}
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index e0913ed..7dae429 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -77,7 +77,8 @@ protected:
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
- bool partOfDefaultBuild);
+ bool partOfDefaultBuild,
+ const char* platformMapping = NULL);
virtual bool ComputeTargetDepends();
virtual void WriteProjectDepends(std::ostream& fout, const char* name,
const char* path, cmTarget &t);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 998843f..938977b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -723,6 +723,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext,
{
sourcecode = "file.xib";
}
+ else if(ext == "storyboard")
+ {
+ sourcecode = "file.storyboard";
+ }
else if(ext == "mm")
{
sourcecode += ".cpp.objcpp";
@@ -1590,14 +1594,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
if(strcmp(lang, "CXX") == 0)
{
this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName);
- this->CurrentLocalGenerator->AddSharedFlags(cflags, lang, shared);
+ this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target, "C");
}
// Add language-specific flags.
this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
// Add shared-library flags if needed.
- this->CurrentLocalGenerator->AddSharedFlags(flags, lang, shared);
+ this->CurrentLocalGenerator->AddCMP0018Flags(flags, &target, lang);
}
else if(binary)
{
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 4eed477..ffc0f35 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -74,6 +74,13 @@ IsFunctionBlocked(const cmListFileFunction& lff,
{
this->IsBlocking = this->HasRun;
this->HasRun = true;
+
+ // if trace is enabled, print a (trivially) evaluated "else"
+ // statement
+ if(!this->IsBlocking && mf.GetCMakeInstance()->GetTrace())
+ {
+ mf.PrintCommandTrace(this->Functions[c]);
+ }
}
else if (scopeDepth == 0 && !cmSystemTools::Strucmp
(this->Functions[c].Name.c_str(),"elseif"))
@@ -88,6 +95,12 @@ IsFunctionBlocked(const cmListFileFunction& lff,
cmMakefileCall stack_manager(&mf, this->Functions[c], status);
static_cast<void>(stack_manager);
+ // if trace is enabled, print the evaluated "elseif" statement
+ if(mf.GetCMakeInstance()->GetTrace())
+ {
+ mf.PrintCommandTrace(this->Functions[c]);
+ }
+
std::string errorString;
std::vector<std::string> expandedArguments;
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index a4369a3..d219c16 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -25,18 +25,75 @@ bool cmIncludeExternalMSProjectCommand
#ifdef _WIN32
if(this->Makefile->GetDefinition("WIN32"))
{
+ enum Doing { DoingNone, DoingType, DoingGuid, DoingPlatform };
+
+ Doing doing = DoingNone;
+
+ std::string customType;
+ std::string customGuid;
+ std::string platformMapping;
+
+ std::vector<std::string> depends;
+ for (unsigned int i=2; i<args.size(); ++i)
+ {
+ if (args[i] == "TYPE")
+ {
+ doing = DoingType;
+ }
+ else if (args[i] == "GUID")
+ {
+ doing = DoingGuid;
+ }
+ else if (args[i] == "PLATFORM")
+ {
+ doing = DoingPlatform;
+ }
+ else
+ {
+ switch (doing)
+ {
+ case DoingNone: depends.push_back(args[i]); break;
+ case DoingType: customType = args[i]; break;
+ case DoingGuid: customGuid = args[i]; break;
+ case DoingPlatform: platformMapping = args[i]; break;
+ }
+ doing = DoingNone;
+ }
+ }
+
+ // Hack together a utility target storing enough information
+ // to reproduce the target inclusion.
+ std::string utility_name = args[0];
+
std::string path = args[1];
cmSystemTools::ConvertToUnixSlashes(path);
+ if (!customGuid.empty())
+ {
+ std::string guidVariable = utility_name + "_GUID_CMAKE";
+ this->Makefile->GetCMakeInstance()->AddCacheEntry(
+ guidVariable.c_str(), customGuid.c_str(),
+ "Stored GUID", cmCacheManager::INTERNAL);
+ }
+
// Create a target instance for this utility.
cmTarget* target=this->Makefile->AddNewTarget(cmTarget::UTILITY,
- args[0].c_str());
+ utility_name.c_str());
+
+ target->SetProperty("GENERATOR_FILE_NAME", utility_name.c_str());
target->SetProperty("EXTERNAL_MSPROJECT", path.c_str());
- target->SetProperty("EXCLUDE_FROM_ALL","FALSE");
- target->SetProperty("GENERATOR_FILE_NAME", args[0].c_str());
- for (unsigned int i=2; i<args.size(); ++i)
+ target->SetProperty("EXCLUDE_FROM_ALL", "FALSE");
+
+ if (!customType.empty())
+ target->SetProperty("VS_PROJECT_TYPE",customType.c_str());
+ if (!platformMapping.empty())
+ target->SetProperty("VS_PLATFORM_MAPPING",platformMapping.c_str());
+
+ for (std::vector<std::string>::const_iterator it = depends.begin();
+ it != depends.end();
+ ++it)
{
- target->AddUtility(args[i].c_str());
+ target->AddUtility(it->c_str());
}
}
#endif
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 911a772..2b2ed0d 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -59,11 +59,21 @@ public:
{
return
" include_external_msproject(projectname location\n"
+ " [TYPE projectTypeGUID]\n"
+ " [GUID projectGUID]\n"
+ " [PLATFORM platformName]\n"
" dep1 dep2 ...)\n"
"Includes an external Microsoft project in the generated workspace "
"file. Currently does nothing on UNIX. This will create a "
"target named [projectname]. This can be used in the add_dependencies "
- "command to make things depend on the external project.";
+ "command to make things depend on the external project."
+ "\n"
+ "TYPE, GUID and PLATFORM are optional parameters that allow one "
+ "to specify the type of project, id (GUID) of the project and "
+ "the name of the target platform. "
+ "This is useful for projects requiring values other than the default "
+ "(e.g. WIX projects). "
+ "These options are not supported by the Visual Studio 6 generator.";
}
cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand);
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index c656487..4016734 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -23,25 +23,25 @@
static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target,
const cmInstallCommandArguments& args, bool impLib, bool forceOpt = false)
{
- return new cmInstallTargetGenerator(target, args.GetDestination().c_str(),
- impLib, args.GetPermissions().c_str(),
+ return new cmInstallTargetGenerator(target, args.GetDestination().c_str(),
+ impLib, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(),
args.GetOptional() || forceOpt);
}
static cmInstallFilesGenerator* CreateInstallFilesGenerator(
- const std::vector<std::string>& absFiles,
+ const std::vector<std::string>& absFiles,
const cmInstallCommandArguments& args, bool programs)
{
- return new cmInstallFilesGenerator(absFiles, args.GetDestination().c_str(),
- programs, args.GetPermissions().c_str(),
+ return new cmInstallFilesGenerator(absFiles, args.GetDestination().c_str(),
+ programs, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(),
args.GetRename().c_str(), args.GetOptional());
}
// cmInstallCommand
-bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
+bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &)
{
// Allow calling with no arguments so that arguments may be built up
@@ -55,6 +55,13 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()->EnableInstallTarget();
+ this->DefaultComponentName = this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
+ if (this->DefaultComponentName.empty())
+ {
+ this->DefaultComponentName = "Unspecified";
+ }
+
// Switch among the command modes.
if(args[0] == "SCRIPT")
{
@@ -95,7 +102,7 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
//----------------------------------------------------------------------------
bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
{
- std::string component("Unspecified");
+ std::string component = this->DefaultComponentName;
int componentCount = 0;
bool doing_script = false;
bool doing_code = false;
@@ -190,7 +197,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
/*struct InstallPart
{
- InstallPart(cmCommandArgumentsHelper* helper, const char* key,
+ InstallPart(cmCommandArgumentsHelper* helper, const char* key,
cmCommandArgumentGroup* group);
cmCAStringVector argVector;
cmInstallCommandArguments args;
@@ -222,7 +229,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// ARCHIVE, RUNTIME etc. (see above)
// These generic args also contain the targets and the export stuff
std::vector<std::string> unknownArgs;
- cmInstallCommandArguments genericArgs;
+ cmInstallCommandArguments genericArgs(this->DefaultComponentName);
cmCAStringVector targetList(&genericArgs.Parser, "TARGETS");
cmCAString exports(&genericArgs.Parser,"EXPORT", &genericArgs.ArgumentGroup);
targetList.Follows(0);
@@ -230,16 +237,16 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs);
bool success = genericArgs.Finalize();
- cmInstallCommandArguments archiveArgs;
- cmInstallCommandArguments libraryArgs;
- cmInstallCommandArguments runtimeArgs;
- cmInstallCommandArguments frameworkArgs;
- cmInstallCommandArguments bundleArgs;
- cmInstallCommandArguments privateHeaderArgs;
- cmInstallCommandArguments publicHeaderArgs;
- cmInstallCommandArguments resourceArgs;
+ cmInstallCommandArguments archiveArgs(this->DefaultComponentName);
+ cmInstallCommandArguments libraryArgs(this->DefaultComponentName);
+ cmInstallCommandArguments runtimeArgs(this->DefaultComponentName);
+ cmInstallCommandArguments frameworkArgs(this->DefaultComponentName);
+ cmInstallCommandArguments bundleArgs(this->DefaultComponentName);
+ cmInstallCommandArguments privateHeaderArgs(this->DefaultComponentName);
+ cmInstallCommandArguments publicHeaderArgs(this->DefaultComponentName);
+ cmInstallCommandArguments resourceArgs(this->DefaultComponentName);
- // now parse the args for specific parts of the target (e.g. LIBRARY,
+ // now parse the args for specific parts of the target (e.g. LIBRARY,
// RUNTIME, ARCHIVE etc.
archiveArgs.Parse (&archiveArgVector.GetVector(), &unknownArgs);
libraryArgs.Parse (&libraryArgVector.GetVector(), &unknownArgs);
@@ -345,7 +352,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
this->Makefile->IsOn("CYGWIN") ||
this->Makefile->IsOn("MINGW"));
- for(std::vector<std::string>::const_iterator
+ for(std::vector<std::string>::const_iterator
targetIt=targetList.GetVector().begin();
targetIt!=targetList.GetVector().end();
++targetIt)
@@ -422,7 +429,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
case cmTarget::SHARED_LIBRARY:
{
// Shared libraries are handled differently on DLL and non-DLL
- // platforms. All windows platforms are DLL platforms including
+ // platforms. All windows platforms are DLL platforms including
// cygwin. Currently no other platform is a DLL platform.
if(dll_platform)
{
@@ -436,13 +443,13 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
if(!archiveArgs.GetDestination().empty())
{
// The import library uses the ARCHIVE properties.
- archiveGenerator = CreateInstallTargetGenerator(target,
+ archiveGenerator = CreateInstallTargetGenerator(target,
archiveArgs, true);
}
if(!runtimeArgs.GetDestination().empty())
{
// The DLL uses the RUNTIME properties.
- runtimeGenerator = CreateInstallTargetGenerator(target,
+ runtimeGenerator = CreateInstallTargetGenerator(target,
runtimeArgs, false);
}
if ((archiveGenerator==0) && (runtimeGenerator==0))
@@ -467,7 +474,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// Use the FRAMEWORK properties.
if (!frameworkArgs.GetDestination().empty())
{
- frameworkGenerator = CreateInstallTargetGenerator(target,
+ frameworkGenerator = CreateInstallTargetGenerator(target,
frameworkArgs, false);
}
else
@@ -484,7 +491,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// The shared library uses the LIBRARY properties.
if (!libraryArgs.GetDestination().empty())
{
- libraryGenerator = CreateInstallTargetGenerator(target,
+ libraryGenerator = CreateInstallTargetGenerator(target,
libraryArgs, false);
libraryGenerator->SetNamelinkMode(namelinkMode);
namelinkOnly =
@@ -507,7 +514,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// Static libraries use ARCHIVE properties.
if (!archiveArgs.GetDestination().empty())
{
- archiveGenerator = CreateInstallTargetGenerator(target, archiveArgs,
+ archiveGenerator = CreateInstallTargetGenerator(target, archiveArgs,
false);
}
else
@@ -525,7 +532,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// Modules use LIBRARY properties.
if (!libraryArgs.GetDestination().empty())
{
- libraryGenerator = CreateInstallTargetGenerator(target, libraryArgs,
+ libraryGenerator = CreateInstallTargetGenerator(target, libraryArgs,
false);
libraryGenerator->SetNamelinkMode(namelinkMode);
namelinkOnly =
@@ -548,7 +555,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// Application bundles use the BUNDLE properties.
if (!bundleArgs.GetDestination().empty())
{
- bundleGenerator = CreateInstallTargetGenerator(target, bundleArgs,
+ bundleGenerator = CreateInstallTargetGenerator(target, bundleArgs,
false);
}
else if(!runtimeArgs.GetDestination().empty())
@@ -580,7 +587,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// Executables use the RUNTIME properties.
if (!runtimeArgs.GetDestination().empty())
{
- runtimeGenerator = CreateInstallTargetGenerator(target,
+ runtimeGenerator = CreateInstallTargetGenerator(target,
runtimeArgs, false);
}
else
@@ -600,7 +607,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
target.IsExecutableWithExports())
{
// The import library uses the ARCHIVE properties.
- archiveGenerator = CreateInstallTargetGenerator(target,
+ archiveGenerator = CreateInstallTargetGenerator(target,
archiveArgs, true, true);
}
}
@@ -710,7 +717,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
installsRuntime = installsRuntime || runtimeGenerator != 0;
installsFramework = installsFramework || frameworkGenerator != 0;
installsBundle = installsBundle || bundleGenerator != 0;
- installsPrivateHeader = installsPrivateHeader
+ installsPrivateHeader = installsPrivateHeader
|| privateHeaderGenerator != 0;
installsPublicHeader = installsPublicHeader || publicHeaderGenerator != 0;
installsResource = installsResource || resourceGenerator;
@@ -729,7 +736,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
if(!exports.GetString().empty() && !namelinkOnly)
{
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddTargetToExports(exports.GetCString(), &target,
+ ->AddTargetToExports(exports.GetCString(), &target,
archiveGenerator, runtimeGenerator,
libraryGenerator, frameworkGenerator,
bundleGenerator, publicHeaderGenerator);
@@ -788,7 +795,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
{
// This is the FILES mode.
bool programs = (args[0] == "PROGRAMS");
- cmInstallCommandArguments ica;
+ cmInstallCommandArguments ica(this->DefaultComponentName);
cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES");
files.Follows(0);
ica.ArgumentGroup.Follows(&files);
@@ -803,7 +810,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
this->SetError(e.str().c_str());
return false;
}
-
+
// Check if there is something to do.
if(files.GetVector().empty())
{
@@ -865,7 +872,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
std::string permissions_file;
std::string permissions_dir;
std::vector<std::string> configurations;
- std::string component = "Unspecified";
+ std::string component = this->DefaultComponentName;
std::string literal_args;
for(unsigned int i=1; i < args.size(); ++i)
{
@@ -1179,7 +1186,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
{
// This is the EXPORT mode.
- cmInstallCommandArguments ica;
+ cmInstallCommandArguments ica(this->DefaultComponentName);
cmCAString exp(&ica.Parser, "EXPORT");
cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup);
cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 3403c38..bf9fd9e 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -337,10 +337,12 @@ private:
bool HandleFilesMode(std::vector<std::string> const& args);
bool HandleDirectoryMode(std::vector<std::string> const& args);
bool HandleExportMode(std::vector<std::string> const& args);
- bool MakeFilesFullPath(const char* modeName,
+ bool MakeFilesFullPath(const char* modeName,
const std::vector<std::string>& relFiles,
std::vector<std::string>& absFiles);
bool CheckCMP0006(bool& failure);
+
+ std::string DefaultComponentName;
};
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 13ef8ed..0ba21c7 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -23,7 +23,8 @@ const char* cmInstallCommandArguments::PermissionsTable[] =
const std::string cmInstallCommandArguments::EmptyString;
-cmInstallCommandArguments::cmInstallCommandArguments()
+cmInstallCommandArguments::cmInstallCommandArguments(
+ const std::string& defaultComponent)
:Parser()
,ArgumentGroup()
,Destination (&Parser, "DESTINATION" , &ArgumentGroup)
@@ -35,7 +36,9 @@ cmInstallCommandArguments::cmInstallCommandArguments()
,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup)
,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup)
,GenericArguments(0)
-{}
+{
+ this->Component.SetDefaultString(defaultComponent.c_str());
+}
const std::string& cmInstallCommandArguments::GetDestination() const
{
@@ -130,7 +133,7 @@ bool cmInstallCommandArguments::GetNamelinkSkip() const
return false;
}
-const std::vector<std::string>&
+const std::vector<std::string>&
cmInstallCommandArguments::GetConfigurations() const
{
if (!this->Configurations.GetVector().empty())
@@ -156,7 +159,7 @@ bool cmInstallCommandArguments::Finalize()
return true;
}
-void cmInstallCommandArguments::Parse(const std::vector<std::string>* args,
+void cmInstallCommandArguments::Parse(const std::vector<std::string>* args,
std::vector<std::string>* unconsumedArgs)
{
this->Parser.Parse(args, unconsumedArgs);
@@ -166,9 +169,9 @@ void cmInstallCommandArguments::Parse(const std::vector<std::string>* args,
bool cmInstallCommandArguments::CheckPermissions()
{
this->PermissionsString = "";
- for(std::vector<std::string>::const_iterator
- permIt = this->Permissions.GetVector().begin();
- permIt != this->Permissions.GetVector().end();
+ for(std::vector<std::string>::const_iterator
+ permIt = this->Permissions.GetVector().begin();
+ permIt != this->Permissions.GetVector().end();
++permIt)
{
if (!this->CheckPermissions(*permIt, this->PermissionsString))
@@ -183,7 +186,7 @@ bool cmInstallCommandArguments::CheckPermissions(
const std::string& onePermission, std::string& permissions)
{
// Check the permission against the table.
- for(const char** valid = cmInstallCommandArguments::PermissionsTable;
+ for(const char** valid = cmInstallCommandArguments::PermissionsTable;
*valid; ++valid)
{
if(onePermission == *valid)
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index 16033ce..321454a 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -19,10 +19,10 @@
class cmInstallCommandArguments
{
public:
- cmInstallCommandArguments();
- void SetGenericArguments(cmInstallCommandArguments* args)
+ cmInstallCommandArguments(const std::string& defaultComponent);
+ void SetGenericArguments(cmInstallCommandArguments* args)
{this->GenericArguments = args;}
- void Parse(const std::vector<std::string>* args,
+ void Parse(const std::vector<std::string>* args,
std::vector<std::string>* unconsumedArgs);
// Compute destination path.and check permissions
@@ -37,14 +37,15 @@ class cmInstallCommandArguments
bool GetNamelinkOnly() const;
bool GetNamelinkSkip() const;
- // once HandleDirectoryMode() is also switched to using
+ // once HandleDirectoryMode() is also switched to using
// cmInstallCommandArguments then these two functions can become non-static
// private member functions without arguments
- static bool CheckPermissions(const std::string& onePerm,
+ static bool CheckPermissions(const std::string& onePerm,
std::string& perm);
cmCommandArgumentsHelper Parser;
cmCommandArgumentGroup ArgumentGroup;
private:
+ cmInstallCommandArguments(); // disabled
cmCAString Destination;
cmCAString Component;
cmCAString Rename;
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 0ec3030..cc62c4b 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -34,7 +34,7 @@ bool cmInstallFilesCommand
if((args.size() > 1) && (args[1] == "FILES"))
{
- this->IsFilesForm = true;
+ this->IsFilesForm = true;
for(std::vector<std::string>::const_iterator s = args.begin()+2;
s != args.end(); ++s)
{
@@ -53,45 +53,46 @@ bool cmInstallFilesCommand
this->FinalArgs.push_back(*s);
}
}
-
+
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddInstallComponent("Unspecified");
+ ->AddInstallComponent(this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}
-void cmInstallFilesCommand::FinalPass()
+void cmInstallFilesCommand::FinalPass()
{
// No final pass for "FILES" form of arguments.
if(this->IsFilesForm)
{
return;
}
-
+
std::string testf;
std::string ext = this->FinalArgs[0];
-
+
// two different options
if (this->FinalArgs.size() > 1)
{
// now put the files into the list
std::vector<std::string>::iterator s = this->FinalArgs.begin();
++s;
- // for each argument, get the files
+ // for each argument, get the files
for (;s != this->FinalArgs.end(); ++s)
{
// replace any variables
std::string temps = *s;
if (cmSystemTools::GetFilenamePath(temps).size() > 0)
{
- testf = cmSystemTools::GetFilenamePath(temps) + "/" +
+ testf = cmSystemTools::GetFilenamePath(temps) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext;
}
else
{
testf = cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext;
}
-
+
// add to the result
this->Files.push_back(this->FindInstallSource(testf.c_str()));
}
@@ -102,9 +103,9 @@ void cmInstallFilesCommand::FinalPass()
std::string regex = this->FinalArgs[0].c_str();
cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(),
regex.c_str(), files);
-
+
std::vector<std::string>::iterator s = files.begin();
- // for each argument, get the files
+ // for each argument, get the files
for (;s != files.end(); ++s)
{
this->Files.push_back(this->FindInstallSource(s->c_str()));
@@ -128,13 +129,14 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
// Use a file install generator.
const char* no_permissions = "";
const char* no_rename = "";
- const char* no_component = "Unspecified";
+ std::string no_component = this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Files,
destination.c_str(), false,
no_permissions, no_configurations,
- no_component, no_rename));
+ no_component.c_str(), no_rename));
}
@@ -151,7 +153,7 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const
// This is a full path.
return name;
}
-
+
// This is a relative path.
std::string tb = this->Makefile->GetCurrentOutputDirectory();
tb += "/";
@@ -159,7 +161,7 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const
std::string ts = this->Makefile->GetCurrentDirectory();
ts += "/";
ts += name;
-
+
if(cmSystemTools::FileExists(tb.c_str()))
{
// The file exists in the binary tree. Use it.
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 807168e..3be2c2b 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -60,7 +60,7 @@ void cmInstallGenerator
std::string dest = this->GetInstallDestination();
if (cmSystemTools::FileIsFullPath(dest.c_str()))
{
- os << "list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES\n";
+ os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
os << indent << " \"";
for(std::vector<std::string>::const_iterator fi = files.begin();
fi != files.end(); ++fi)
@@ -80,6 +80,16 @@ void cmInstallGenerator
}
}
os << "\")\n";
+ os << indent << "IF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL "
+ << "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
+ os << indent << "ENDIF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+
+ os << indent << "IF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL "
+ << "DESTINATION forbidden (by caller): "
+ << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
+ os << indent << "ENDIF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
}
os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str();
if(optional)
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 7e6c9ce..3a0a322 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -31,26 +31,27 @@ bool cmInstallProgramsCommand
for (++s;s != args.end(); ++s)
{
this->FinalArgs.push_back(*s);
- }
-
+ }
+
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddInstallComponent("Unspecified");
+ ->AddInstallComponent(this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}
-void cmInstallProgramsCommand::FinalPass()
+void cmInstallProgramsCommand::FinalPass()
{
bool files_mode = false;
if(!this->FinalArgs.empty() && this->FinalArgs[0] == "FILES")
{
files_mode = true;
}
-
+
// two different options
if (this->FinalArgs.size() > 1 || files_mode)
{
- // for each argument, get the programs
+ // for each argument, get the programs
std::vector<std::string>::iterator s = this->FinalArgs.begin();
if(files_mode)
{
@@ -68,9 +69,9 @@ void cmInstallProgramsCommand::FinalPass()
std::vector<std::string> programs;
cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(),
this->FinalArgs[0].c_str(), programs);
-
+
std::vector<std::string>::iterator s = programs.begin();
- // for each argument, get the programs
+ // for each argument, get the programs
for (;s != programs.end(); ++s)
{
this->Files.push_back(this->FindInstallSource(s->c_str()));
@@ -89,13 +90,14 @@ void cmInstallProgramsCommand::FinalPass()
// Use a file install generator.
const char* no_permissions = "";
const char* no_rename = "";
- const char* no_component = "Unspecified";
+ std::string no_component = this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Files,
destination.c_str(), true,
no_permissions, no_configurations,
- no_component, no_rename));
+ no_component.c_str(), no_rename));
}
/**
@@ -112,7 +114,7 @@ std::string cmInstallProgramsCommand
// This is a full path.
return name;
}
-
+
// This is a relative path.
std::string tb = this->Makefile->GetCurrentOutputDirectory();
tb += "/";
@@ -120,7 +122,7 @@ std::string cmInstallProgramsCommand
std::string ts = this->Makefile->GetCurrentDirectory();
ts += "/";
ts += name;
-
+
if(cmSystemTools::FileExists(tb.c_str()))
{
// The file exists in the binary tree. Use it.
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index 27fc175..277ccea 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -58,7 +58,8 @@ bool cmInstallTargetsCommand
}
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddInstallComponent("Unspecified");
+ ->AddInstallComponent(this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index cbbcbb0..908f3b0 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -204,6 +204,12 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
this->Makefile->AddDefinition(variableName.c_str(), "NOTFOUND");
return true;
}
+ // FIXME: Add policy to make non-existing lists an error like empty lists.
+ if(varArgsExpanded.empty())
+ {
+ this->SetError("GET given empty list");
+ return false;
+ }
std::string value;
size_t cc;
@@ -318,7 +324,8 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
// expand the variable
int item = atoi(args[2].c_str());
std::vector<std::string> varArgsExpanded;
- if ( !this->GetList(varArgsExpanded, listName.c_str()) && item != 0)
+ if((!this->GetList(varArgsExpanded, listName.c_str())
+ || varArgsExpanded.empty()) && item != 0)
{
cmOStringStream str;
str << "index: " << item << " out of range (0, 0)";
@@ -544,6 +551,12 @@ bool cmListCommand::HandleRemoveAtCommand(
this->SetError("sub-command REMOVE_AT requires list to be present.");
return false;
}
+ // FIXME: Add policy to make non-existing lists an error like empty lists.
+ if(varArgsExpanded.empty())
+ {
+ this->SetError("REMOVE_AT given empty list");
+ return false;
+ }
size_t cc;
std::vector<size_t> removed;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 32cfa68..0cfb36b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -872,6 +872,13 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
return replaceValues.TargetPDB;
}
}
+ if(replaceValues.DependencyFile )
+ {
+ if(variable == "DEP_FILE")
+ {
+ return replaceValues.DependencyFile;
+ }
+ }
if(replaceValues.Target)
{
@@ -954,29 +961,27 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
}
}
- if(replaceValues.TargetSOName)
+ if(variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
+ variable == "TARGET_INSTALLNAME_DIR")
{
- if(variable == "TARGET_SONAME")
+ // All these variables depend on TargetSOName
+ if(replaceValues.TargetSOName)
{
- if(replaceValues.Language)
+ if(variable == "TARGET_SONAME")
{
- std::string name = "CMAKE_SHARED_LIBRARY_SONAME_";
- name += replaceValues.Language;
- name += "_FLAG";
- if(this->Makefile->GetDefinition(name.c_str()))
- {
- return replaceValues.TargetSOName;
- }
+ return replaceValues.TargetSOName;
+ }
+ if(variable == "SONAME_FLAG" && replaceValues.SONameFlag)
+ {
+ return replaceValues.SONameFlag;
+ }
+ if(replaceValues.TargetInstallNameDir &&
+ variable == "TARGET_INSTALLNAME_DIR")
+ {
+ return replaceValues.TargetInstallNameDir;
}
- return "";
- }
- }
- if(replaceValues.TargetInstallNameDir)
- {
- if(variable == "TARGET_INSTALLNAME_DIR")
- {
- return replaceValues.TargetInstallNameDir;
}
+ return "";
}
if(replaceValues.LinkLibraries)
{
@@ -1550,16 +1555,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
target.GetName());
return;
}
- std::string langVar = "CMAKE_";
- langVar += linkLanguage;
- std::string flagsVar = langVar + "_FLAGS";
- std::string sharedFlagsVar = "CMAKE_SHARED_LIBRARY_";
- sharedFlagsVar += linkLanguage;
- sharedFlagsVar += "_FLAGS";
- flags += this->Makefile->GetSafeDefinition(flagsVar.c_str());
- flags += " ";
- flags += this->Makefile->GetSafeDefinition(sharedFlagsVar.c_str());
- flags += " ";
+ this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
cmOStringStream linklibs;
this->OutputLinkLibraries(linklibs, target, false);
linkLibs = linklibs.str();
@@ -1968,6 +1964,111 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
}
//----------------------------------------------------------------------------
+void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target,
+ std::string const& lang)
+{
+ int targetType = target->GetType();
+
+ bool shared = ((targetType == cmTarget::SHARED_LIBRARY) ||
+ (targetType == cmTarget::MODULE_LIBRARY));
+
+ if (this->GetShouldUseOldFlags(shared, lang))
+ {
+ this->AddSharedFlags(flags, lang.c_str(), shared);
+ }
+ else
+ {
+ // Add position independendent flags, if needed.
+ if (target->GetPropertyAsBool("POSITION_INDEPENDENT_CODE"))
+ {
+ this->AddPositionIndependentFlags(flags, lang, targetType);
+ }
+ if (shared)
+ {
+ this->AppendFeatureOptions(flags, lang.c_str(), "DLL");
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
+ const std::string &lang) const
+{
+ std::string originalFlags =
+ this->GlobalGenerator->GetSharedLibFlagsForLanguage(lang);
+ if (shared)
+ {
+ std::string flagsVar = "CMAKE_SHARED_LIBRARY_";
+ flagsVar += lang;
+ flagsVar += "_FLAGS";
+ const char* flags =
+ this->Makefile->GetSafeDefinition(flagsVar.c_str());
+
+ if (flags && flags != originalFlags)
+ {
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0018))
+ {
+ case cmPolicies::WARN:
+ {
+ cmOStringStream e;
+ e << "Variable " << flagsVar << " has been modified. CMake "
+ "will ignore the POSITION_INDEPENDENT_CODE target property for "
+ "shared libraries and will use the " << flagsVar << " variable "
+ "instead. This may cause errors if the original content of "
+ << flagsVar << " was removed.\n"
+ << this->Makefile->GetPolicies()->GetPolicyWarning(
+ cmPolicies::CMP0018);
+
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ // fall through to OLD behaviour
+ }
+ case cmPolicies::OLD:
+ return true;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ default:
+ return false;
+ }
+ }
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
+void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
+ std::string const& lang,
+ int targetType)
+{
+ const char* picFlags = 0;
+
+ if(targetType == cmTarget::EXECUTABLE)
+ {
+ std::string flagsVar = "CMAKE_";
+ flagsVar += lang;
+ flagsVar += "_COMPILE_OPTIONS_PIE";
+ picFlags = this->Makefile->GetSafeDefinition(flagsVar.c_str());
+ }
+ if (!picFlags)
+ {
+ std::string flagsVar = "CMAKE_";
+ flagsVar += lang;
+ flagsVar += "_COMPILE_OPTIONS_PIC";
+ picFlags = this->Makefile->GetSafeDefinition(flagsVar.c_str());
+ }
+ if (picFlags)
+ {
+ std::vector<std::string> options;
+ cmSystemTools::ExpandListArgument(picFlags, options);
+ for(std::vector<std::string>::const_iterator oi = options.begin();
+ oi != options.end(); ++oi)
+ {
+ this->AppendFlags(flags, this->EscapeForShell(oi->c_str()).c_str());
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
const char* var,
const char* config)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 3e93819..39b493f 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -140,7 +140,8 @@ public:
void AddLanguageFlags(std::string& flags, const char* lang,
const char* config);
- void AddSharedFlags(std::string& flags, const char* lang, bool shared);
+ void AddCMP0018Flags(std::string &flags, cmTarget* target,
+ std::string const& lang);
void AddConfigVariableFlags(std::string& flags, const char* var,
const char* config);
///! Append flags to a string.
@@ -204,6 +205,10 @@ public:
/** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source);
+ // Fill the vector with the target names for the object files,
+ // preprocessed files and assembly files.
+ virtual void GetIndividualFileTargets(std::vector<std::string>&) {}
+
// Create a struct to hold the varibles passed into
// ExpandRuleVariables
struct RuleVariables
@@ -228,12 +233,14 @@ public:
const char* ObjectDir;
const char* Flags;
const char* ObjectsQuoted;
+ const char* SONameFlag;
const char* TargetSOName;
const char* TargetInstallNameDir;
const char* LinkFlags;
const char* LanguageCompileFlags;
const char* Defines;
const char* RuleLauncher;
+ const char* DependencyFile;
};
/** Set whether to treat conversions to SHELL as a link script shell. */
@@ -424,6 +431,11 @@ protected:
private:
std::string ConvertToOutputForExistingCommon(const char* remote,
std::string const& result);
+
+ void AddSharedFlags(std::string& flags, const char* lang, bool shared);
+ bool GetShouldUseOldFlags(bool shared, const std::string &lang) const;
+ void AddPositionIndependentFlags(std::string& flags, std::string const& l,
+ int targetType);
};
#endif
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 425b219..9a496f2 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -46,7 +46,9 @@ void cmLocalNinjaGenerator::Generate()
this->SetConfigName();
this->WriteProcessedMakefile(this->GetBuildFileStream());
+#ifdef NINJA_GEN_VERBOSE_FILES
this->WriteProcessedMakefile(this->GetRulesFileStream());
+#endif
this->WriteBuildFileTop();
@@ -275,16 +277,16 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
return ":";
#endif
- // TODO: This will work only on Unix platforms. I don't
- // want to use a link.txt file because I will lose the benefit of the
- // $in variables. A discussion about dealing with multiple commands in
- // a rule is started here:
- // groups.google.com/group/ninja-build/browse_thread/thread/d515f23a78986008
- std::ostringstream cmd;
+ cmOStringStream cmd;
for (std::vector<std::string>::const_iterator li = cmdLines.begin();
li != cmdLines.end(); ++li) {
- if (li != cmdLines.begin())
+ if (li != cmdLines.begin()) {
cmd << " && ";
+#ifdef _WIN32
+ } else if (cmdLines.size() > 1) {
+ cmd << "cmd.exe /c ";
+#endif
+ }
cmd << *li;
}
return cmd.str();
@@ -299,7 +301,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc,
if (!wd)
wd = this->GetMakefile()->GetStartOutputDirectory();
- std::ostringstream cdCmd;
+ cmOStringStream cdCmd;
cdCmd << "cd " << this->ConvertToOutputFormat(wd, SHELL);
cmdLines.push_back(cdCmd.str());
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index a645303..db93529 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -36,6 +36,30 @@
#include <queue>
//----------------------------------------------------------------------------
+// Escape special characters in Makefile dependency lines
+class cmMakeSafe
+{
+public:
+ cmMakeSafe(const char* s): Data(s) {}
+ cmMakeSafe(std::string const& s): Data(s.c_str()) {}
+private:
+ const char* Data;
+ friend std::ostream& operator<<(std::ostream& os,
+ cmMakeSafe const& self)
+ {
+ for(const char* c = self.Data; *c; ++c)
+ {
+ switch (*c)
+ {
+ case '=': os << "$(EQUALS)"; break;
+ default: os << *c; break;
+ }
+ }
+ return os;
+ }
+};
+
+//----------------------------------------------------------------------------
// Helper function used below.
static std::string cmSplitExtension(std::string const& in, std::string& base)
{
@@ -555,28 +579,13 @@ cmLocalUnixMakefileGenerator3
space = " ";
}
- // Warn about paths not supported by Make tools.
- std::string::size_type pos = tgt.find_first_of("=");
- if(pos != std::string::npos)
- {
- cmOStringStream m;
- m <<
- "Make rule for\n"
- " " << tgt << "\n"
- "has '=' on left hand side. "
- "The make tool may not support this.";
- cmListFileBacktrace bt;
- this->GlobalGenerator->GetCMakeInstance()
- ->IssueMessage(cmake::WARNING, m.str(), bt);
- }
-
// Mark the rule as symbolic if requested.
if(symbolic)
{
if(const char* sym =
this->Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"))
{
- os << tgt.c_str() << space << ": " << sym << "\n";
+ os << cmMakeSafe(tgt) << space << ": " << sym << "\n";
}
}
@@ -584,7 +593,7 @@ cmLocalUnixMakefileGenerator3
if(depends.empty())
{
// No dependencies. The commands will always run.
- os << tgt.c_str() << space << ":\n";
+ os << cmMakeSafe(tgt) << space << ":\n";
}
else
{
@@ -595,7 +604,7 @@ cmLocalUnixMakefileGenerator3
{
replace = *dep;
replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE);
- os << tgt.c_str() << space << ": " << replace.c_str() << "\n";
+ os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -608,7 +617,7 @@ cmLocalUnixMakefileGenerator3
}
if(symbolic && !this->WatcomWMake)
{
- os << ".PHONY : " << tgt.c_str() << "\n";
+ os << ".PHONY : " << cmMakeSafe(tgt) << "\n";
}
os << "\n";
// Add the output to the local help if requested.
@@ -687,6 +696,10 @@ cmLocalUnixMakefileGenerator3
<< this->ConvertShellCommand(cmakecommand, FULL)
<< " -E remove -f\n"
<< "\n";
+ makefileStream
+ << "# Escaping for special characters.\n"
+ << "EQUALS = =\n"
+ << "\n";
if(const char* edit_cmd =
this->Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index bf0e997..ace7adf 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -99,6 +99,14 @@ void cmLocalVisualStudio10Generator
{
cmVS10XMLParser parser;
parser.ParseFile(path);
+
+ // if we can not find a GUID then create one
+ if(parser.GUID.empty())
+ {
+ this->GlobalGenerator->CreateGUID(name);
+ return;
+ }
+
std::string guidStoreName = name;
guidStoreName += "_GUID_CMAKE";
// save the GUID in the cache
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 99a4c95..5ab223b 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -320,7 +320,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
sourceGroup.AssignSource(*i);
// while we are at it, if it is a .rule file then for visual studio 6 we
// must generate it
- if ((*i)->GetExtension() == "rule")
+ if ((*i)->GetPropertyAsBool("__CMAKE_RULE"))
{
if(!cmSystemTools::FileExists(source.c_str()))
{
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 9faf46d..f2ab79d 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1933,9 +1933,11 @@ cmLocalVisualStudio7Generator
vskey += "\\Packages\\" CM_INTEL_PLUGIN_GUID ";ProductVersion";
cmSystemTools::ReadRegistryValue(vskey.c_str(), intelVersion,
cmSystemTools::KeyWOW64_32);
- if (intelVersion.find("12") == 0 || (intelVersion.find("11") == 0))
+ if (intelVersion.find("13") == 0 ||
+ intelVersion.find("12") == 0 ||
+ intelVersion.find("11") == 0)
{
- // Version 11.x and 12.x actually use 11.0 in project files!
+ // Version 11.x, 12.x, and 13.x actually use 11.0 in project files!
intelVersion = "11.0" ;
}
else if(intelVersion.find("10") == 0)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e7e5eda..a60896f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -354,6 +354,22 @@ bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const
}
//----------------------------------------------------------------------------
+void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff)
+{
+ cmOStringStream msg;
+ msg << lff.FilePath << "(" << lff.Line << "): ";
+ msg << lff.Name << "(";
+ for(std::vector<cmListFileArgument>::const_iterator i =
+ lff.Arguments.begin(); i != lff.Arguments.end(); ++i)
+ {
+ msg << i->Value;
+ msg << " ";
+ }
+ msg << ")";
+ cmSystemTools::Message(msg.str().c_str());
+}
+
+//----------------------------------------------------------------------------
bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
cmExecutionStatus &status)
{
@@ -385,20 +401,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
|| pcmd->IsScriptable()))
{
- // if trace is one, print out invoke information
+ // if trace is enabled, print out invoke information
if(this->GetCMakeInstance()->GetTrace())
{
- cmOStringStream msg;
- msg << lff.FilePath << "(" << lff.Line << "): ";
- msg << lff.Name << "(";
- for(std::vector<cmListFileArgument>::const_iterator i =
- lff.Arguments.begin(); i != lff.Arguments.end(); ++i)
- {
- msg << i->Value;
- msg << " ";
- }
- msg << ")";
- cmSystemTools::Message(msg.str().c_str());
+ this->PrintCommandTrace(lff);
}
// Try invoking the command.
if(!pcmd->InvokeInitialPass(lff.Arguments,status) ||
@@ -883,7 +889,7 @@ cmMakefile::AddCustomCommandToTarget(const char* target,
}
//----------------------------------------------------------------------------
-void
+cmSourceFile*
cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
const char* main_dependency,
@@ -897,7 +903,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
if(outputs.empty())
{
cmSystemTools::Error("Attempt to add a custom rule with no output!");
- return;
+ return 0;
}
// Validate custom commands. TODO: More strict?
@@ -910,7 +916,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
cmOStringStream e;
e << "COMMAND may not contain literal quotes:\n " << cl[0] << "\n";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
- return;
+ return 0;
}
}
@@ -928,7 +934,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
{
// The existing custom command is identical. Silently ignore
// the duplicate.
- return;
+ return file;
}
else
{
@@ -948,17 +954,11 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
// Generate a rule file if the main dependency is not available.
if(!file)
{
+ cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator();
+
// Construct a rule file associated with the first output produced.
- std::string outName = outputs[0];
- outName += ".rule";
- const char* dir =
- this->LocalGenerator->GetGlobalGenerator()->
- GetCMakeCFGIntDir();
- if(dir && dir[0] == '$')
- {
- cmSystemTools::ReplaceString(outName, dir,
- cmake::GetCMakeFilesDirectory());
- }
+ std::string outName = gg->GenerateRuleFile(outputs[0]);
+
// Check if the rule file already exists.
file = this->GetSource(outName.c_str());
if(file && file->GetCustomCommand() && !replace)
@@ -970,11 +970,12 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
outName.c_str(),
"\" which already has a custom rule.");
}
- return;
+ return file;
}
// Create a cmSourceFile for the rule file.
file = this->GetOrCreateSource(outName.c_str(), true);
+ file->SetProperty("__CMAKE_RULE", "1");
}
// Always create the output sources and mark them generated.
@@ -1004,10 +1005,11 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
cc->SetEscapeAllowMakeVars(true);
file->SetCustomCommand(cc);
}
+ return file;
}
//----------------------------------------------------------------------------
-void
+cmSourceFile*
cmMakefile::AddCustomCommandToOutput(const char* output,
const std::vector<std::string>& depends,
const char* main_dependency,
@@ -1019,9 +1021,9 @@ cmMakefile::AddCustomCommandToOutput(const char* output,
{
std::vector<std::string> outputs;
outputs.push_back(output);
- this->AddCustomCommandToOutput(outputs, depends, main_dependency,
- commandLines, comment, workingDir,
- replace, escapeOldStyle);
+ return this->AddCustomCommandToOutput(outputs, depends, main_dependency,
+ commandLines, comment, workingDir,
+ replace, escapeOldStyle);
}
//----------------------------------------------------------------------------
@@ -1054,13 +1056,14 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
{
// Get the name of this output.
const char* output = oi->c_str();
+ cmSourceFile* sf;
// Choose whether to use a main dependency.
if(sourceFiles.find(source))
{
// The source looks like a real file. Use it as the main dependency.
- this->AddCustomCommandToOutput(output, depends, source,
- commandLines, comment, 0);
+ sf = this->AddCustomCommandToOutput(output, depends, source,
+ commandLines, comment, 0);
}
else
{
@@ -1068,20 +1071,18 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
const char* no_main_dependency = 0;
std::vector<std::string> depends2 = depends;
depends2.push_back(source);
- this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
- commandLines, comment, 0);
+ sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
+ commandLines, comment, 0);
}
// If the rule was added to the source (and not a .rule file),
// then add the source to the target to make sure the rule is
// included.
- std::string sname = output;
- sname += ".rule";
- if(!this->GetSource(sname.c_str()))
+ if(sf && !sf->GetPropertyAsBool("__CMAKE_RULE"))
{
if (this->Targets.find(target) != this->Targets.end())
{
- this->Targets[target].AddSource(source);
+ this->Targets[target].AddSourceFile(sf);
}
else
{
@@ -1976,7 +1977,6 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
// look through all the source files that have custom commands
// and see if the custom command has the passed source file as an output
- // keep in mind the possible .rule extension that may be tacked on
for(std::vector<cmSourceFile*>::const_iterator i =
this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i)
{
@@ -2201,6 +2201,14 @@ bool cmMakefile::PlatformIs64Bit() const
return false;
}
+const char* cmMakefile::GetSONameFlag(const char* language) const
+{
+ std::string name = "CMAKE_SHARED_LIBRARY_SONAME_";
+ name += language;
+ name += "_FLAG";
+ return GetDefinition(name.c_str());
+}
+
bool cmMakefile::CanIWriteThisFile(const char* fileName)
{
if ( !this->IsOn("CMAKE_DISABLE_SOURCE_CHANGES") )
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 960ba39..8a0088b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -175,20 +175,22 @@ public:
cmTarget::CustomCommandType type,
const char* comment, const char* workingDir,
bool escapeOldStyle = true);
- void AddCustomCommandToOutput(const std::vector<std::string>& outputs,
- const std::vector<std::string>& depends,
- const char* main_dependency,
- const cmCustomCommandLines& commandLines,
- const char* comment, const char* workingDir,
- bool replace = false,
- bool escapeOldStyle = true);
- void AddCustomCommandToOutput(const char* output,
- const std::vector<std::string>& depends,
- const char* main_dependency,
- const cmCustomCommandLines& commandLines,
- const char* comment, const char* workingDir,
- bool replace = false,
- bool escapeOldStyle = true);
+ cmSourceFile* AddCustomCommandToOutput(
+ const std::vector<std::string>& outputs,
+ const std::vector<std::string>& depends,
+ const char* main_dependency,
+ const cmCustomCommandLines& commandLines,
+ const char* comment, const char* workingDir,
+ bool replace = false,
+ bool escapeOldStyle = true);
+ cmSourceFile* AddCustomCommandToOutput(
+ const char* output,
+ const std::vector<std::string>& depends,
+ const char* main_dependency,
+ const cmCustomCommandLines& commandLines,
+ const char* comment, const char* workingDir,
+ bool replace = false,
+ bool escapeOldStyle = true);
void AddCustomCommandOldStyle(const char* target,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
@@ -593,6 +595,9 @@ public:
/** Return whether the target platform is 64-bit. */
bool PlatformIs64Bit() const;
+ /** Retrieve soname flag for the specified language if supported */
+ const char* GetSONameFlag(const char* language) const;
+
/**
* Get a list of preprocessor define flags.
*/
@@ -696,6 +701,11 @@ public:
#endif
/**
+ * Print a command's invocation
+ */
+ void PrintCommandTrace(const cmListFileFunction& lff);
+
+ /**
* Execute a single CMake command. Returns true if the command
* succeeded or false if it failed.
*/
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 38aa59d..db59ffd 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -714,7 +714,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string linkString = linklibs.str();
vars.LinkLibraries = linkString.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
- vars.TargetSOName= targetNameSO.c_str();
+ if (this->Target->HasSOName(this->ConfigName))
+ {
+ vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage);
+ vars.TargetSOName= targetNameSO.c_str();
+ }
vars.LinkFlags = linkFlags.c_str();
// Compute the directory portion of the install_name setting.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index a0e0481..df89275 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -153,14 +153,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
}
}
- for(std::vector<cmSourceFile*>::const_iterator
- si = this->GeneratorTarget->OSXContent.begin();
- si != this->GeneratorTarget->OSXContent.end(); ++si)
- {
- cmTarget::SourceFileFlags tsFlags =
- this->Target->GetTargetSourceFileFlags(*si);
- this->WriteMacOSXContentRules(**si, tsFlags.MacFolder);
- }
+ this->WriteMacOSXContentRules(this->GeneratorTarget->HeaderSources);
+ this->WriteMacOSXContentRules(this->GeneratorTarget->ExtraSources);
for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->ExternalObjects.begin();
si != this->GeneratorTarget->ExternalObjects.end(); ++si)
@@ -251,9 +245,6 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l)
std::string flags;
const char *lang = l.c_str();
- bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) ||
- (this->Target->GetType() == cmTarget::MODULE_LIBRARY));
-
// Add language feature flags.
this->AddFeatureFlags(flags, lang);
@@ -266,8 +257,7 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l)
this->AddFortranFlags(flags);
}
- // Add shared-library flags if needed.
- this->LocalGenerator->AddSharedFlags(flags, lang, shared);
+ this->LocalGenerator->AddCMP0018Flags(flags, this->Target, lang);
// Add include directory flags.
this->AddIncludeFlags(flags, lang);
@@ -354,6 +344,22 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
}
//----------------------------------------------------------------------------
+void cmMakefileTargetGenerator::WriteMacOSXContentRules(
+ std::vector<cmSourceFile*> const& sources)
+{
+ for(std::vector<cmSourceFile*>::const_iterator
+ si = sources.begin(); si != sources.end(); ++si)
+ {
+ cmTarget::SourceFileFlags tsFlags =
+ this->Target->GetTargetSourceFileFlags(*si);
+ if(tsFlags.Type != cmTarget::SourceFileTypeNormal)
+ {
+ this->WriteMacOSXContentRules(**si, tsFlags.MacFolder);
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
void cmMakefileTargetGenerator::WriteMacOSXContentRules(cmSourceFile& source,
const char* pkgloc)
{
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index e1e554b..36a1f68 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -73,6 +73,7 @@ protected:
void WriteTargetDependRules();
// write rules for Mac OS X Application Bundle content.
+ void WriteMacOSXContentRules(std::vector<cmSourceFile*> const& sources);
void WriteMacOSXContentRules(cmSourceFile& source, const char* pkgloc);
// write the rules for an object
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 2bad32c..01e8e73 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -47,8 +47,7 @@ cmNinjaNormalTargetGenerator(cmTarget* target)
{
// on Windows the output dir is already needed at compile time
// ensure the directory exists (OutDir test)
- std::string outpath = target->GetDirectory(this->GetConfigName());
- cmSystemTools::MakeDirectory(outpath.c_str());
+ EnsureDirectoryExists(target->GetDirectory(this->GetConfigName()));
}
}
@@ -76,16 +75,17 @@ void cmNinjaNormalTargetGenerator::Generate()
}
else
{
- this->WriteLinkRule();
+ this->WriteLinkRule(false);
+#ifdef _WIN32 // TODO response file support only Linux
+ this->WriteLinkRule(true);
+#endif
this->WriteLinkStatement();
}
-
- this->GetBuildFileStream() << "\n";
- this->GetRulesFileStream() << "\n";
}
void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
{
+#ifdef NINJA_GEN_VERBOSE_FILES
cmGlobalNinjaGenerator::WriteDivider(this->GetRulesFileStream());
this->GetRulesFileStream()
<< "# Rules for each languages for "
@@ -93,6 +93,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
<< " target "
<< this->GetTargetName()
<< "\n\n";
+#endif
std::set<cmStdString> languages;
this->GetTarget()->GetLanguages(languages);
@@ -130,28 +131,43 @@ cmNinjaNormalTargetGenerator
void
cmNinjaNormalTargetGenerator
-::WriteLinkRule()
+::WriteLinkRule(bool useResponseFile)
{
cmTarget::TargetType targetType = this->GetTarget()->GetType();
std::string ruleName = this->LanguageLinkerRule();
+ if (useResponseFile)
+ ruleName += "_RSPFILE";
+
+ // Select whether to use a response file for objects.
+ std::string rspfile;
if (!this->GetGlobalGenerator()->HasRule(ruleName)) {
cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->GetTarget();
vars.Language = this->TargetLinkLanguage;
- vars.Objects = "$in";
- std::string objdir =
- this->GetLocalGenerator()->GetHomeRelativeOutputPath();
- objdir += objdir.empty() ? "" : "/";
- objdir += cmake::GetCMakeFilesDirectoryPostSlash();
- objdir += this->GetTargetName();
- objdir += ".dir";
- objdir = this->GetLocalGenerator()->Convert(objdir.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
- vars.ObjectDir = objdir.c_str();
+
+ std::string responseFlag;
+ if (!useResponseFile) {
+ vars.Objects = "$in";
+ } else {
+ // handle response file
+ std::string cmakeLinkVar = std::string("CMAKE_") +
+ this->TargetLinkLanguage + "_RESPONSE_FILE_LINK_FLAG";
+ const char * flag = GetMakefile()->GetDefinition(cmakeLinkVar.c_str());
+ if(flag) {
+ responseFlag = flag;
+ } else {
+ responseFlag = "@";
+ }
+ rspfile = "$out.rsp";
+ responseFlag += rspfile;
+ vars.Objects = responseFlag.c_str();
+ }
+
+ vars.ObjectDir = "$OBJECT_DIR";
vars.Target = "$out";
+ vars.SONameFlag = "$SONAME_FLAG";
vars.TargetSOName = "$SONAME";
vars.TargetInstallNameDir = "$INSTALLNAME_DIR";
vars.TargetPDB = "$TARGET_PDB";
@@ -178,14 +194,15 @@ cmNinjaNormalTargetGenerator
vars.LinkFlags = "$LINK_FLAGS";
std::string langFlags;
- this->GetLocalGenerator()->AddLanguageFlags(langFlags,
- this->TargetLinkLanguage,
- this->GetConfigName());
- if (targetType != cmTarget::EXECUTABLE)
+ if (targetType != cmTarget::EXECUTABLE) {
+ this->GetLocalGenerator()->AddLanguageFlags(langFlags,
+ this->TargetLinkLanguage,
+ this->GetConfigName());
langFlags += " $ARCH_FLAGS";
- vars.LanguageCompileFlags = langFlags.c_str();
+ vars.LanguageCompileFlags = langFlags.c_str();
+ }
- // Rule for linking library.
+ // Rule for linking library/executable.
std::vector<std::string> linkCmds = this->ComputeLinkCmd();
for(std::vector<std::string>::iterator i = linkCmds.begin();
i != linkCmds.end();
@@ -198,17 +215,19 @@ cmNinjaNormalTargetGenerator
std::string linkCmd =
this->GetLocalGenerator()->BuildCommandLine(linkCmds);
- // Write the linker rule.
- std::ostringstream comment;
+ // Write the linker rule with response file if needed.
+ cmOStringStream comment;
comment << "Rule for linking " << this->TargetLinkLanguage << " "
<< this->GetVisibleTypeName() << ".";
- std::ostringstream description;
+ cmOStringStream description;
description << "Linking " << this->TargetLinkLanguage << " "
<< this->GetVisibleTypeName() << " $out";
this->GetGlobalGenerator()->AddRule(ruleName,
linkCmd,
description.str(),
- comment.str());
+ comment.str(),
+ /*depfile*/ "",
+ rspfile);
}
if (this->TargetNameOut != this->TargetNameReal) {
@@ -337,7 +356,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
/*implib=*/true).c_str());
// Compute the comment.
- std::ostringstream comment;
+ cmOStringStream comment;
comment << "Link the " << this->GetVisibleTypeName() << " "
<< targetOutputReal;
@@ -359,34 +378,61 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// Compute architecture specific link flags. Yes, these go into a different
// variable for executables, probably due to a mistake made when duplicating
// code between the Makefile executable and library generators.
- this->GetLocalGenerator()
- ->AddArchitectureFlags(targetType == cmTarget::EXECUTABLE
+ std::string flags = (targetType == cmTarget::EXECUTABLE
? vars["FLAGS"]
- : vars["ARCH_FLAGS"],
+ : vars["ARCH_FLAGS"]);
+ this->GetLocalGenerator()->AddArchitectureFlags(flags,
this->GetTarget(),
this->TargetLinkLanguage,
this->GetConfigName());
- vars["SONAME"] = this->TargetNameSO;
-
- if (targetType == cmTarget::SHARED_LIBRARY) {
- std::string install_name_dir =
- this->GetTarget()->GetInstallNameDirForBuildTree(this->GetConfigName());
-
- if (!install_name_dir.empty()) {
- vars["INSTALLNAME_DIR"] =
- this->GetLocalGenerator()->Convert(install_name_dir.c_str(),
- cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL, false);
+ if (targetType == cmTarget::EXECUTABLE) {
+ vars["FLAGS"] = flags;
+ } else {
+ vars["ARCH_FLAGS"] = flags;
+ }
+ if (this->GetTarget()->HasSOName(this->GetConfigName())) {
+ vars["SONAME_FLAG"] =
+ this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage);
+ vars["SONAME"] = this->TargetNameSO;
+ if (targetType == cmTarget::SHARED_LIBRARY) {
+ std::string install_name_dir = this->GetTarget()
+ ->GetInstallNameDirForBuildTree(this->GetConfigName());
+
+ if (!install_name_dir.empty()) {
+ vars["INSTALLNAME_DIR"] =
+ this->GetLocalGenerator()->Convert(install_name_dir.c_str(),
+ cmLocalGenerator::NONE,
+ cmLocalGenerator::SHELL, false);
+ }
}
}
+ std::string path;
if (!this->TargetNameImport.empty()) {
- vars["TARGET_IMPLIB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- targetOutputImplib.c_str(), cmLocalGenerator::SHELL);
+ path = this->GetLocalGenerator()->ConvertToOutputFormat(
+ targetOutputImplib.c_str(), cmLocalGenerator::SHELL);
+ vars["TARGET_IMPLIB"] = path;
+ EnsureParentDirectoryExists(path);
}
- vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- this->GetTargetPDB().c_str(), cmLocalGenerator::SHELL);
+ // TODO move to GetTargetPDB
+ cmMakefile* mf = this->GetMakefile();
+ if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
+ mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
+ {
+ path = this->GetTargetPDB();
+ vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+ ConvertToNinjaPath(path.c_str()).c_str(),
+ cmLocalGenerator::SHELL);
+ EnsureParentDirectoryExists(path);
+ }
+
+ if (mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
+ {
+ path = GetTarget()->GetSupportDirectory();
+ vars["OBJECT_DIR"] = ConvertToNinjaPath(path.c_str());
+ EnsureDirectoryExists(path);
+ }
std::vector<cmCustomCommand> *cmdLists[3] = {
&this->GetTarget()->GetPreBuildCommands(),
@@ -413,7 +459,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for
// the link commands.
if (!preLinkCmdLines.empty()) {
- std::string path = this->GetLocalGenerator()->ConvertToOutputFormat(
+ path = this->GetLocalGenerator()->ConvertToOutputFormat(
this->GetMakefile()->GetHomeOutputDirectory(),
cmLocalGenerator::SHELL);
preLinkCmdLines.push_back("cd " + path);
@@ -432,6 +478,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
symlinkVars["POST_BUILD"] = postBuildCmdLine;
}
+ int cmdLineLimit;
+#ifdef _WIN32
+ cmdLineLimit = 8000;
+#else
+ cmdLineLimit = -1; // TODO
+#endif
+
// Write the build statement for this target.
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
comment.str(),
@@ -440,7 +493,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
explicitDeps,
implicitDeps,
emptyDeps,
- vars);
+ vars,
+ cmdLineLimit);
if (targetOutput != targetOutputReal) {
if (targetType == cmTarget::EXECUTABLE) {
diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h
index 1702caf..1ef9567 100644
--- a/Source/cmNinjaNormalTargetGenerator.h
+++ b/Source/cmNinjaNormalTargetGenerator.h
@@ -30,7 +30,7 @@ private:
std::string LanguageLinkerRule() const;
const char* GetVisibleTypeName() const;
void WriteLanguagesRules();
- void WriteLinkRule();
+ void WriteLinkRule(bool useResponseFile);
void WriteLinkStatement();
void WriteObjectLibStatement();
std::vector<std::string> ComputeLinkCmd();
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c6469f2..6157931 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -140,11 +140,8 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
// }
// Add shared-library flags if needed.
- {
- bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) ||
- (this->Target->GetType() == cmTarget::MODULE_LIBRARY));
- this->GetLocalGenerator()->AddSharedFlags(flags, language.c_str(), shared);
- }
+ this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
+ language.c_str());
// TODO: Handle response file.
// Add include directory flags.
@@ -154,6 +151,8 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
language.c_str());
std::string includeFlags =
this->LocalGenerator->GetIncludeFlags(includes, language.c_str(), false);
+ if(cmGlobalNinjaGenerator::IsMinGW())
+ cmSystemTools::ReplaceString(includeFlags, "\\", "/");
this->LocalGenerator->AppendFlags(flags, includeFlags.c_str());
}
@@ -301,7 +300,7 @@ std::string cmNinjaTargetGenerator::GetTargetPDB() const
targetFullPathPDB += this->Target->GetPDBName(this->GetConfigName());
}
- return ConvertToNinjaPath(targetFullPathPDB.c_str());
+ return targetFullPathPDB.c_str();
}
@@ -309,10 +308,11 @@ void
cmNinjaTargetGenerator
::WriteLanguageRules(const std::string& language)
{
+#ifdef NINJA_GEN_VERBOSE_FILES
this->GetRulesFileStream()
<< "# Rules for language " << language << "\n\n";
+#endif
this->WriteCompileRule(language);
- this->GetRulesFileStream() << "\n";
}
void
@@ -330,20 +330,45 @@ cmNinjaTargetGenerator
vars.Defines = "$DEFINES";
vars.TargetPDB = "$TARGET_PDB";
+
+ cmMakefile* mf = this->GetMakefile();
+
+ bool useClDeps = false;
+ std::string clDepsBinary;
+ std::string clShowPrefix;
+ if (lang == "C" || lang == "CXX" || lang == "RC")
+ {
+ const char* depsPtr = mf->GetDefinition("CMAKE_CMCLDEPS_EXECUTABLE");
+ const char* showPtr = mf->GetDefinition("CMAKE_CL_SHOWINCLUDE_PREFIX");
+ if (depsPtr && showPtr)
+ {
+ // don't wrap for try_compile,
+ // TODO but why doesn't it work with cmcldeps?
+ const std::string projectName = mf->GetProjectName() ?
+ mf->GetProjectName() : "";
+ if (projectName != "CMAKE_TRY_COMPILE")
+ {
+ useClDeps = true;
+ std::string qu = "\"";
+ clDepsBinary = qu + depsPtr + qu;
+ clShowPrefix = qu + showPtr + qu;
+ vars.DependencyFile = "$DEP_FILE";
+ }
+ }
+ }
+
+
std::string depfile;
std::string depfileFlagsName = "CMAKE_DEPFILE_FLAGS_" + language;
- const char *depfileFlags =
- this->GetMakefile()->GetDefinition(depfileFlagsName.c_str());
- if (depfileFlags) {
- std::string depfileFlagsStr = depfileFlags;
- depfile = "$out.d";
- cmSystemTools::ReplaceString(depfileFlagsStr, "<DEPFILE>",
- depfile.c_str());
- cmSystemTools::ReplaceString(depfileFlagsStr, "<OBJECT>",
- "$out");
- cmSystemTools::ReplaceString(depfileFlagsStr, "<CMAKE_C_COMPILER>",
- this->GetMakefile()->GetDefinition("CMAKE_C_COMPILER"));
- flags += " " + depfileFlagsStr;
+ const char *depfileFlags = mf->GetDefinition(depfileFlagsName.c_str());
+ if (depfileFlags || useClDeps) {
+ std::string depFlagsStr = depfileFlags ? depfileFlags : "";
+ depfile = "$DEP_FILE";
+ cmSystemTools::ReplaceString(depFlagsStr, "<DEPFILE>", "\"$DEP_FILE\"");
+ cmSystemTools::ReplaceString(depFlagsStr, "<OBJECT>", "$out");
+ cmSystemTools::ReplaceString(depFlagsStr, "<CMAKE_C_COMPILER>",
+ mf->GetDefinition("CMAKE_C_COMPILER"));
+ flags += " " + depFlagsStr;
}
vars.Flags = flags.c_str();
@@ -352,8 +377,7 @@ cmNinjaTargetGenerator
std::string compileCmdVar = "CMAKE_";
compileCmdVar += language;
compileCmdVar += "_COMPILE_OBJECT";
- std::string compileCmd =
- this->GetMakefile()->GetRequiredDefinition(compileCmdVar.c_str());
+ std::string compileCmd = mf->GetRequiredDefinition(compileCmdVar.c_str());
std::vector<std::string> compileCmds;
cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
@@ -364,10 +388,18 @@ cmNinjaTargetGenerator
std::string cmdLine =
this->GetLocalGenerator()->BuildCommandLine(compileCmds);
+ if(useClDeps)
+ {
+ std::string cl = mf->GetDefinition("CMAKE_C_COMPILER");
+ cl = "\"" + cl + "\" ";
+ cmdLine = clDepsBinary + " " + lang + " $in \"$DEP_FILE\" $out "
+ + clShowPrefix + " " + cl + cmdLine;
+ }
+
// Write the rule for compiling file of the given language.
- std::ostringstream comment;
+ cmOStringStream comment;
comment << "Rule for compiling " << language << " files.";
- std::ostringstream description;
+ cmOStringStream description;
description << "Building " << language << " object $out";
this->GetGlobalGenerator()->AddRule(this->LanguageCompilerRule(language),
cmdLine,
@@ -396,7 +428,6 @@ cmNinjaTargetGenerator
cmCustomCommand const* cc = (*si)->GetCustomCommand();
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
}
- // TODO: this->GeneratorTarget->OSXContent
for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->ExternalObjects.begin();
si != this->GeneratorTarget->ExternalObjects.end(); ++si)
@@ -485,8 +516,51 @@ cmNinjaTargetGenerator
cmNinjaVars vars;
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
- vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- this->GetTargetPDB().c_str(), cmLocalGenerator::SHELL);
+ vars["DEP_FILE"] = objectFileName + ".d";;
+ EnsureParentDirectoryExists(objectFileName);
+
+ // TODO move to GetTargetPDB
+ cmMakefile* mf = this->GetMakefile();
+ if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
+ mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
+ {
+ vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+ ConvertToNinjaPath(GetTargetPDB().c_str()).c_str(),
+ cmLocalGenerator::SHELL);
+ }
+
+ if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS"))
+ {
+ cmLocalGenerator::RuleVariables compileObjectVars;
+ std::string lang = language;
+ compileObjectVars.Language = lang.c_str();
+ std::string escapedSourceFileName =
+ this->LocalGenerator->ConvertToOutputFormat(
+ sourceFileName.c_str(), cmLocalGenerator::SHELL);
+ compileObjectVars.Source = escapedSourceFileName.c_str();
+ compileObjectVars.Object = objectFileName.c_str();
+ compileObjectVars.Flags = vars["FLAGS"].c_str();
+ compileObjectVars.Defines = vars["DEFINES"].c_str();
+
+ // Rule for compiling object file.
+ std::string compileCmdVar = "CMAKE_";
+ compileCmdVar += language;
+ compileCmdVar += "_COMPILE_OBJECT";
+ std::string compileCmd =
+ this->GetMakefile()->GetRequiredDefinition(compileCmdVar.c_str());
+ std::vector<std::string> compileCmds;
+ cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+
+ for (std::vector<std::string>::iterator i = compileCmds.begin();
+ i != compileCmds.end(); ++i)
+ this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars);
+
+ std::string cmdLine =
+ this->GetLocalGenerator()->BuildCommandLine(compileCmds);
+
+ this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine,
+ sourceFileName);
+ }
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
comment,
@@ -534,3 +608,17 @@ cmNinjaTargetGenerator
this->ModuleDefinitionFile.c_str()));
this->LocalGenerator->AppendFlags(flags, flag.c_str());
}
+
+void
+cmNinjaTargetGenerator
+::EnsureDirectoryExists(const std::string& dir)
+{
+ cmSystemTools::MakeDirectory(dir.c_str());
+}
+
+void
+cmNinjaTargetGenerator
+::EnsureParentDirectoryExists(const std::string& path)
+{
+ EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path.c_str()));
+}
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index b64ce1e..af43a8b 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -111,6 +111,9 @@ protected:
// Helper to add flag for windows .def file.
void AddModuleDefinitionFlag(std::string& flags);
+ void EnsureDirectoryExists(const std::string& dir);
+ void EnsureParentDirectoryExists(const std::string& path);
+
private:
cmTarget* Target;
cmGeneratorTarget* GeneratorTarget;
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 37070b6..79af4d7 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -463,6 +463,34 @@ cmPolicies::cmPolicies()
"The OLD behaviour is to always prefer files from CMAKE_MODULE_PATH over "
"files from the CMake modules directory.",
2,8,4,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0018, "CMP0018",
+ "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.",
+ "CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries "
+ "using the value of the undocumented CMAKE_SHARED_LIBRARY_<Lang>_FLAGS "
+ "platform variable. The variable contained platform-specific flags "
+ "needed to compile objects for shared libraries. Typically it included "
+ "a flag such as -fPIC for position independent code but also included "
+ "other flags needed on certain platforms. CMake 2.8.9 and higher "
+ "prefer instead to use the POSITION_INDEPENDENT_CODE target property to "
+ "determine what targets should be position independent, and new "
+ "undocumented platform variables to select flags while ignoring "
+ "CMAKE_SHARED_LIBRARY_<Lang>_FLAGS completely."
+ "\n"
+ "The default for either approach produces identical compilation flags, "
+ "but if a project modifies CMAKE_SHARED_LIBRARY_<Lang>_FLAGS from its "
+ "original value this policy determines which approach to use."
+ "\n"
+ "The OLD behavior for this policy is to ignore the "
+ "POSITION_INDEPENDENT_CODE property for all targets and use the modified "
+ "value of CMAKE_SHARED_LIBRARY_<Lang>_FLAGS for SHARED and MODULE "
+ "libraries."
+ "\n"
+ "The NEW behavior for this policy is to ignore "
+ "CMAKE_SHARED_LIBRARY_<Lang>_FLAGS whether it is modified or not and "
+ "honor the POSITION_INDEPENDENT_CODE target property.",
+ 2,8,9,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 3106248..6932565 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -65,6 +65,9 @@ public:
/// target_link_libraries() fails if only argument is not a target
CMP0016,
CMP0017, ///< Prefer files in CMAKE_ROOT when including from CMAKE_ROOT
+ CMP0018, ///< Ignore language flags for shared libs, and adhere to
+ /// POSITION_INDEPENDENT_CODE property and *_COMPILE_OPTIONS_PI{E,C}
+ /// instead.
/** \brief Always the last entry.
*
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index ca27530..65ecdf7 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -18,6 +18,7 @@
#include "cmSystemTools.h"
#include <cmsys/Terminal.h>
+#include <cmsys/ios/sstream>
#include <string.h>
#if defined(__APPLE__)
@@ -244,6 +245,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
bool cmQtAutomoc::Run(const char* targetDirectory)
{
+ bool success = true;
cmake cm;
cmGlobalGenerator* gg = this->CreateGlobalGenerator(&cm, targetDirectory);
cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
@@ -255,7 +257,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory)
if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
{
- this->RunAutomoc();
+ success = this->RunAutomoc();
}
this->WriteOldMocDefinitionsFile(targetDirectory);
@@ -263,7 +265,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory)
delete gg;
gg = NULL;
makefile = NULL;
- return true;
+ return success;
}
@@ -549,7 +551,7 @@ bool cmQtAutomoc::RunAutomoc()
this->GenerateMoc(it->first, it->second);
}
- std::stringstream outStream(std::stringstream::out);
+ cmsys_ios::stringstream outStream;
outStream << "/* This file is autogenerated, do not edit*/\n";
bool automocCppChanged = false;
@@ -577,7 +579,7 @@ bool cmQtAutomoc::RunAutomoc()
if (this->RunMocFailed)
{
- std::cerr << "returning failed.."<< std::endl;
+ std::cerr << "moc failed..."<< std::endl;
return false;
}
outStream.flush();
@@ -1077,7 +1079,7 @@ bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with)
std::string cmQtAutomoc::ReadAll(const std::string& filename)
{
std::ifstream file(filename.c_str());
- std::stringstream stream;
+ cmsys_ios::stringstream stream;
stream << file.rdbuf();
file.close();
return stream.str();
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 66b129e..2dd80e3 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -52,7 +52,7 @@ public:
*/
virtual const char* GetTerseDocumentation() const
{
- return "Set a CMAKE variable to a given value.";
+ return "Set a CMake, cache or environment variable to a given value.";
}
/**
@@ -63,26 +63,37 @@ public:
return
" set(<variable> <value>\n"
" [[CACHE <type> <docstring> [FORCE]] | PARENT_SCOPE])\n"
- "Within CMake sets <variable> to the value <value>. <value> is expanded"
- " before <variable> is set to it. If CACHE is present, then the "
- "<variable> is put in the cache. <type> and <docstring> are then "
- "required. <type> is used by the CMake GUI to choose a widget with "
- "which the user sets a value. The value for <type> may be one of\n"
+ "Within CMake sets <variable> to the value <value>. "
+ "<value> is expanded before <variable> is set to it. "
+ "Normally, set will set a regular CMake variable. "
+ "If CACHE is present, then the <variable> is put in the cache "
+ "instead, unless it is already in the cache. "
+ "See section 'Variable types in CMake' below for details of "
+ "regular and cache variables and their interactions. "
+ "If CACHE is used, <type> and <docstring> are required. <type> is used "
+ "by the CMake GUI to choose a widget with which the user sets a value. "
+ "The value for <type> may be one of\n"
" FILEPATH = File chooser dialog.\n"
" PATH = Directory chooser dialog.\n"
" STRING = Arbitrary string.\n"
" BOOL = Boolean ON/OFF checkbox.\n"
" INTERNAL = No GUI entry (used for persistent variables).\n"
- "If <type> is INTERNAL, then the <value> is always written into the "
- "cache, replacing any values existing in the cache. If it is not a "
- "cache variable, then this always writes into the current makefile. The "
- "FORCE option will overwrite the cache value removing any changes by "
- "the user.\n"
+ "If <type> is INTERNAL, the cache variable is marked as internal, "
+ "and will not be shown to the user in tools like cmake-gui. "
+ "This is intended for values that should be persisted in the cache, "
+ "but which users should not normally change. INTERNAL implies FORCE."
+ "\n"
+ "Normally, set(...CACHE...) creates cache variables, but does not "
+ "modify them. "
+ "If FORCE is specified, the value of the cache variable is set, even "
+ "if the variable is already in the cache. This should normally be "
+ "avoided, as it will remove any changes to the cache variable's value "
+ "by the user.\n"
"If PARENT_SCOPE is present, the variable will be set in the scope "
"above the current scope. Each new directory or function creates a new "
"scope. This command will set the value of a variable into the parent "
"directory or calling function (whichever is applicable to the case at "
- "hand).\n"
+ "hand). PARENT_SCOPE cannot be combined with CACHE.\n"
"If <value> is not specified then the variable is removed "
"instead of set. See also: the unset() command.\n"
" set(<variable> <value1> ... <valueN>)\n"
@@ -90,7 +101,58 @@ public:
"values.\n"
"<variable> can be an environment variable such as:\n"
" set( ENV{PATH} /home/martink )\n"
- "in which case the environment variable will be set.";
+ "in which case the environment variable will be set.\n"
+ "*** Variable types in CMake ***\n"
+ "In CMake there are two types of variables: normal variables and cache "
+ "variables. Normal variables are meant for the internal use of the "
+ "script (just like variables in most programming languages); they are "
+ "not persisted across CMake runs. "
+ "Cache variables (unless set with INTERNAL) are mostly intended for "
+ "configuration settings where the first CMake run determines a "
+ "suitable default value, which the user can then override, by editing "
+ "the cache with tools such as ccmake or cmake-gui. "
+ "Cache variables are stored in the CMake cache file, and "
+ "are persisted across CMake runs. \n"
+ "Both types can exist at the same time with the same name "
+ "but different values. "
+ "When ${FOO} is evaluated, CMake first looks for "
+ "a normal variable 'FOO' in scope and uses it if set. "
+ "If and only if no normal variable exists then it falls back to the "
+ "cache variable 'FOO'.\n"
+ "Some examples:\n"
+ "The code 'set(FOO \"x\")' sets the normal variable 'FOO'. It does not "
+ "touch the cache, but it will hide any existing cache value 'FOO'.\n"
+ "The code 'set(FOO \"x\" CACHE ...)' checks for 'FOO' in the cache, "
+ "ignoring any normal variable of the same name. If 'FOO' is in the "
+ "cache then nothing happens to either the normal variable or the cache "
+ "variable. If 'FOO' is not in the cache, then it is added to the "
+ "cache.\n"
+ "Finally, whenever a cache variable is added or modified by a command, "
+ "CMake also *removes* the normal variable of the same name from the "
+ "current scope so that an immediately following evaluation of "
+ "it will expose the newly cached value.\n"
+ "Normally projects should avoid using normal and cache variables of "
+ "the same name, as this interaction can be hard to follow. "
+ "However, in some situations it can be useful. "
+ "One example (used by some projects):"
+ "\n"
+ "A project has a subproject in its source tree. The child project has "
+ "its own CMakeLists.txt, which is included from the parent "
+ "CMakeLists.txt using add_subdirectory(). "
+ "Now, if the parent and the child project provide the same option "
+ "(for example a compiler option), the parent gets the first chance "
+ "to add a user-editable option to the cache. "
+ "Normally, the child would then use the same value "
+ "that the parent uses. "
+ "However, it may be necessary to hard-code the value for the child "
+ "project's option while still allowing the user to edit the value used "
+ "by the parent project. The parent project can achieve this simply by "
+ "setting a normal variable with the same name as the option in a scope "
+ "sufficient to hide the option's cache variable from the child "
+ "completely. The parent has already set the cache variable, so the "
+ "child's set(...CACHE...) will do nothing, and evaluating the option "
+ "variable will use the value from the normal variable, which hides the "
+ "cache variable.";
}
cmTypeMacro(cmSetCommand, cmCommand);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1376a48..89f03f6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -104,6 +104,9 @@ public:
private:
HANDLE handle_;
};
+#elif defined(__APPLE__)
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
#endif
bool cmSystemTools::s_RunCommandHideConsole = false;
@@ -1630,33 +1633,28 @@ std::vector<std::string> cmSystemTools::GetEnvironmentVariables()
}
//----------------------------------------------------------------------
-std::vector<std::string> cmSystemTools::AppendEnv(
- std::vector<std::string>* env)
+void cmSystemTools::AppendEnv(std::vector<std::string> const& env)
{
- std::vector<std::string> origEnv = GetEnvironmentVariables();
-
- if (env && env->size()>0)
+ for(std::vector<std::string>::const_iterator eit = env.begin();
+ eit != env.end(); ++eit)
{
- std::vector<std::string>::const_iterator eit;
-
- for (eit = env->begin(); eit!= env->end(); ++eit)
- {
- PutEnv(eit->c_str());
- }
+ cmSystemTools::PutEnv(eit->c_str());
}
-
- return origEnv;
}
//----------------------------------------------------------------------
-void cmSystemTools::RestoreEnv(const std::vector<std::string>& env)
+cmSystemTools::SaveRestoreEnvironment::SaveRestoreEnvironment()
{
- std::vector<std::string>::const_iterator eit;
+ this->Env = cmSystemTools::GetEnvironmentVariables();
+}
+//----------------------------------------------------------------------
+cmSystemTools::SaveRestoreEnvironment::~SaveRestoreEnvironment()
+{
// First clear everything in the current environment:
- //
std::vector<std::string> currentEnv = GetEnvironmentVariables();
- for (eit = currentEnv.begin(); eit!= currentEnv.end(); ++eit)
+ for(std::vector<std::string>::const_iterator
+ eit = currentEnv.begin(); eit != currentEnv.end(); ++eit)
{
std::string var(*eit);
@@ -1666,27 +1664,11 @@ void cmSystemTools::RestoreEnv(const std::vector<std::string>& env)
var = var.substr(0, pos);
}
- UnsetEnv(var.c_str());
+ cmSystemTools::UnsetEnv(var.c_str());
}
// Then put back each entry from the original environment:
- //
- for (eit = env.begin(); eit!= env.end(); ++eit)
- {
- PutEnv(eit->c_str());
- }
-}
-
-//----------------------------------------------------------------------
-cmSystemTools::SaveRestoreEnvironment::SaveRestoreEnvironment()
-{
- this->Env = cmSystemTools::GetEnvironmentVariables();
-}
-
-//----------------------------------------------------------------------
-cmSystemTools::SaveRestoreEnvironment::~SaveRestoreEnvironment()
-{
- cmSystemTools::RestoreEnv(this->Env);
+ cmSystemTools::AppendEnv(this->Env);
}
#endif
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 5f21de2..69673c9 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -371,16 +371,8 @@ public:
/** Get the list of all environment variables */
static std::vector<std::string> GetEnvironmentVariables();
- /** Append multiple variables to the current environment.
- Return the original environment, as it was before the
- append. */
- static std::vector<std::string> AppendEnv(
- std::vector<std::string>* env);
-
- /** Restore the full environment to "env" - use after
- AppendEnv to put the environment back to the way it
- was. */
- static void RestoreEnv(const std::vector<std::string>& env);
+ /** Append multiple variables to the current environment. */
+ static void AppendEnv(std::vector<std::string> const& env);
/** Helper class to save and restore the environment.
Instantiate this class as an automatic variable on
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index cfa9976..4f3f2c5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -700,9 +700,9 @@ void cmTarget::DefineProperties(cmake *cm)
"Setting this property tells CMake what imported configurations are "
"suitable for use when building the <CONFIG> configuration. "
"The first configuration in the list found to be provided by the "
- "imported target is selected. If no matching configurations are "
- "available the imported target is considered to be not found. "
- "This property is ignored for non-imported targets.",
+ "imported target is selected. If this property is set and no matching "
+ "configurations are available, then the imported target is considered "
+ "to be not found. This property is ignored for non-imported targets.",
false /* TODO: make this chained */ );
cm->DefineProperty
@@ -756,6 +756,14 @@ void cmTarget::DefineProperties(cmake *cm)
"(such as \"lib\") on a library name.");
cm->DefineProperty
+ ("POSITION_INDEPENDENT_CODE", cmProperty::TARGET,
+ "Whether to create a position-independent target",
+ "The POSITION_INDEPENDENT_CODE property determines whether position "
+ "independent executables or shared libraries will be created. "
+ "This property is true by default for SHARED and MODULE library "
+ "targets and false otherwise.");
+
+ cm->DefineProperty
("POST_INSTALL_SCRIPT", cmProperty::TARGET,
"Deprecated install support.",
"The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the "
@@ -823,6 +831,19 @@ void cmTarget::DefineProperties(cmake *cm)
"CMAKE_SKIP_BUILD_RPATH if it is set when a target is created.");
cm->DefineProperty
+ ("NO_SONAME", cmProperty::TARGET,
+ "Whether to set \"soname\" when linking a shared library or module.",
+ "Enable this boolean property if a generated shared library or module "
+ "should not have \"soname\" set. Default is to set \"soname\" on all "
+ "shared libraries and modules as long as the platform supports it. "
+ "Generally, use this property only for leaf private libraries or "
+ "plugins. If you use it on normal shared libraries which other targets "
+ "link against, on some platforms a linker will insert a full path to "
+ "the library (as specified at link time) into the dynamic section of "
+ "the dependent binary. Therefore, once installed, dynamic loader may "
+ "eventually fail to locate the library for the binary.");
+
+ cm->DefineProperty
("SOVERSION", cmProperty::TARGET,
"What version number is this target.",
"For shared libraries VERSION and SOVERSION can be used to specify "
@@ -831,6 +852,7 @@ void cmTarget::DefineProperties(cmake *cm)
"supports symlinks and the linker supports so-names. "
"If only one of both is specified the missing is assumed to have "
"the same version number. "
+ "SOVERSION is ignored if NO_SONAME property is set. "
"For shared libraries and executables on Windows the VERSION "
"attribute is parsed to extract a \"major.minor\" version number. "
"These numbers are used as the image version of the binary. ");
@@ -1291,6 +1313,13 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetProperty("INCLUDE_DIRECTORIES",
this->Makefile->GetProperty("INCLUDE_DIRECTORIES"));
+ if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY
+ || this->TargetTypeValue == cmTarget::MODULE_LIBRARY)
+ {
+ this->SetProperty("POSITION_INDEPENDENT_CODE", "True");
+ }
+ this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0);
+
// Record current policies for later use.
this->PolicyStatusCMP0003 =
this->Makefile->GetPolicyStatus(cmPolicies::CMP0003);
@@ -2995,6 +3024,17 @@ std::string cmTarget::GetPDBName(const char* config)
}
//----------------------------------------------------------------------------
+bool cmTarget::HasSOName(const char* config)
+{
+ // soname is supported only for shared libraries and modules,
+ // and then only when the platform supports an soname flag.
+ return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->GetType() == cmTarget::MODULE_LIBRARY) &&
+ !this->GetPropertyAsBool("NO_SONAME") &&
+ this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
+}
+
+//----------------------------------------------------------------------------
std::string cmTarget::GetSOName(const char* config)
{
if(this->IsImported())
@@ -3327,22 +3367,10 @@ void cmTarget::GetLibraryNames(std::string& name,
return;
}
- // Construct the name of the soname flag variable for this language.
- const char* ll = this->GetLinkerLanguage(config);
- std::string sonameFlag = "CMAKE_SHARED_LIBRARY_SONAME";
- if(ll)
- {
- sonameFlag += "_";
- sonameFlag += ll;
- }
- sonameFlag += "_FLAG";
-
// Check for library version properties.
const char* version = this->GetProperty("VERSION");
const char* soversion = this->GetProperty("SOVERSION");
- if((this->GetType() != cmTarget::SHARED_LIBRARY &&
- this->GetType() != cmTarget::MODULE_LIBRARY) ||
- !this->Makefile->GetDefinition(sonameFlag.c_str()) ||
+ if(!this->HasSOName(config) ||
this->IsFrameworkOnApple())
{
// Versioning is supported only for shared libraries and modules,
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index d41c827..d70cacd 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -347,6 +347,9 @@ public:
/** Get the name of the pdb file for the target. */
std::string GetPDBName(const char* config=0);
+ /** Whether this library has soname enabled and platform supports it. */
+ bool HasSOName(const char* config);
+
/** Get the soname of the target. Allowed only for a shared library. */
std::string GetSOName(const char* config);
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index be866c3..63114d2 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -64,7 +64,8 @@ public:
"Specify libraries or flags to use when linking a given target. "
"The named <target> must have been created in the current directory "
"by a command such as add_executable or add_library. "
- "The remaining arguments specify library names or flags."
+ "The remaining arguments specify library names or flags. "
+ "Repeated calls for the same <target> append items in the order called."
"\n"
"If a library name matches that of another target in the project "
"a dependency will automatically be added in the build system to make "
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6caaad1..9a97ab0 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -459,8 +459,9 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
command)
{
std::string sourcePath = source->GetFullPath();
- // the rule file seems to need to exist for vs10
- if (source->GetExtension() == "rule")
+ // VS 10 will always rebuild a custom command attached to a .rule
+ // file that doesn't exist so create the file explicitly.
+ if (source->GetPropertyAsBool("__CMAKE_RULE"))
{
if(!cmSystemTools::FileExists(sourcePath.c_str()))
{
@@ -490,14 +491,9 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
- this->WriteString("<CustomBuild Include=\"", 2);
- // custom command have to use relative paths or they do not
- // show up in the GUI
- std::string path = cmSystemTools::RelativePath(
- this->Makefile->GetCurrentOutputDirectory(),
- sourcePath.c_str());
- this->ConvertToWindowsSlash(path);
- (*this->BuildFileStream ) << path << "\">\n";
+
+ this->WriteSource("CustomBuild", source, ">\n");
+
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
{
@@ -540,6 +536,18 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
this->WriteString("</CustomBuild>\n", 2);
}
+std::string
+cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path,
+ bool forceRelative)
+{
+ return forceRelative
+ ? cmSystemTools::RelativePath(
+ this->Makefile->GetCurrentOutputDirectory(), path.c_str())
+ : this->LocalGenerator->Convert(path.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED);
+}
+
void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s)
{
// first convert all of the slashes
@@ -558,13 +566,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::vector<cmSourceFile*> classes = this->Target->GetSourceFiles();
std::set<cmSourceGroup*> groupsUsed;
- std::vector<cmSourceFile*> clCompile;
- std::vector<cmSourceFile*> customBuild;
- std::vector<cmSourceFile*> none;
- std::vector<cmSourceFile*> headers;
- std::vector<cmSourceFile*> idls;
- std::vector<cmSourceFile*> resource;
-
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
s != classes.end(); s++)
{
@@ -573,40 +574,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
cmSourceGroup& sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
groupsUsed.insert(&sourceGroup);
- const char* lang = sf->GetLanguage();
- bool header = (*s)->GetPropertyAsBool("HEADER_FILE_ONLY")
- || this->GlobalGenerator->IgnoreFile
- ((*s)->GetExtension().c_str());
- std::string ext =
- cmSystemTools::LowerCase((*s)->GetExtension());
- if(!lang)
- {
- lang = "None";
- }
- if(header)
- {
- headers.push_back(sf);
- }
- else if(lang[0] == 'C')
- {
- clCompile.push_back(sf);
- }
- else if(strcmp(lang, "RC") == 0)
- {
- resource.push_back(sf);
- }
- else if(sf->GetCustomCommand())
- {
- customBuild.push_back(sf);
- }
- else if(ext == "idl")
- {
- idls.push_back(sf);
- }
- else
- {
- none.push_back(sf);
- }
}
this->AddMissingSourceGroups(groupsUsed, sourceGroups);
@@ -628,11 +595,11 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
"xmlns=\"http://schemas.microsoft.com/"
"developer/msbuild/2003\">\n",
0);
- this->WriteGroupSources("ClCompile", clCompile, sourceGroups);
- this->WriteGroupSources("ClInclude", headers, sourceGroups);
- this->WriteGroupSources("ResourceCompile", resource, sourceGroups);
- this->WriteGroupSources("Midl", idls, sourceGroups);
- this->WriteGroupSources("CustomBuild", customBuild, sourceGroups);
+ for(ToolSourceMap::const_iterator ti = this->Tools.begin();
+ ti != this->Tools.end(); ++ti)
+ {
+ this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
+ }
// Add object library contents as external objects.
std::vector<std::string> objs;
@@ -689,7 +656,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
this->WriteString("</Filter>\n", 2);
}
this->WriteString("</ItemGroup>\n", 1);
- this->WriteGroupSources("None", none, sourceGroups);
this->WriteString("</Project>\n", 0);
// restore stream pointer
this->BuildFileStream = save;
@@ -749,32 +715,20 @@ cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
void
cmVisualStudio10TargetGenerator::
WriteGroupSources(const char* name,
- std::vector<cmSourceFile*> const& sources,
+ ToolSources const& sources,
std::vector<cmSourceGroup>& sourceGroups)
{
this->WriteString("<ItemGroup>\n", 1);
- for(std::vector<cmSourceFile*>::const_iterator s = sources.begin();
+ for(ToolSources::const_iterator s = sources.begin();
s != sources.end(); ++s)
{
- cmSourceFile* sf = *s;
- if(sf->GetExtension() == "obj")
- {
- continue;
- }
+ cmSourceFile* sf = s->SourceFile;
std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
const char* filter = sourceGroup.GetFullName();
this->WriteString("<", 2);
- std::string path = source;
- // custom command sources must use relative paths or they will
- // not show up in the GUI.
- if(sf->GetCustomCommand())
- {
- path = cmSystemTools::RelativePath(
- this->Makefile->GetCurrentOutputDirectory(),
- source.c_str());
- }
+ std::string path = this->ConvertPath(source, s->RelativePath);
this->ConvertToWindowsSlash(path);
(*this->BuildFileStream) << name << " Include=\""
<< path;
@@ -795,15 +749,47 @@ WriteGroupSources(const char* name,
}
void cmVisualStudio10TargetGenerator::WriteSource(
- const char* tool, cmSourceFile* sf, bool end)
+ const char* tool, cmSourceFile* sf, const char* end)
{
- std::string sourceFile = sf->GetFullPath();
- // do not use a relative path here because it means that you
- // can not use as long a path to the file.
+ // Visual Studio tools append relative paths to the current dir, as in:
+ //
+ // c:\path\to\current\dir\..\..\..\relative\path\to\source.c
+ //
+ // and fail if this exceeds the maximum allowed path length. Our path
+ // conversion uses full paths outside the build tree to allow deeper trees.
+ bool forceRelative = false;
+ std::string sourceFile = this->ConvertPath(sf->GetFullPath(), false);
+ if(this->LocalGenerator->GetVersion() == cmLocalVisualStudioGenerator::VS10
+ && cmSystemTools::FileIsFullPath(sourceFile.c_str()))
+ {
+ // Normal path conversion resulted in a full path. VS 10 (but not 11)
+ // refuses to show the property page in the IDE for a source file with a
+ // full path (not starting in a '.' or '/' AFAICT). CMake <= 2.8.4 used a
+ // relative path but to allow deeper build trees CMake 2.8.[5678] used a
+ // full path except for custom commands. Custom commands do not work
+ // without a relative path, but they do not seem to be involved in tools
+ // with the above behavior. For other sources we now use a relative path
+ // when the combined path will not be too long so property pages appear.
+ std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true);
+ size_t const maxLen = 250;
+ if(sf->GetCustomCommand() ||
+ ((strlen(this->Makefile->GetCurrentOutputDirectory()) + 1 +
+ sourceRel.length()) <= maxLen))
+ {
+ forceRelative = true;
+ sourceFile = sourceRel;
+ }
+ else
+ {
+ this->GlobalGenerator->PathTooLong(this->Target, sf, sourceRel);
+ }
+ }
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
(*this->BuildFileStream ) << tool <<
- " Include=\"" << sourceFile << (end? "\" />\n" : "\" ");
+ " Include=\"" << sourceFile << "\"" << (end? end : " />\n");
+ ToolSource toolSource = {sf, forceRelative};
+ this->Tools[tool].push_back(toolSource);
}
void cmVisualStudio10TargetGenerator::WriteSources(
@@ -835,7 +821,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
bool cl = strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0;
bool rc = strcmp(lang, "RC") == 0;
const char* tool = cl? "ClCompile" : (rc? "ResourceCompile" : "None");
- this->WriteSource(tool, *si, false);
+ this->WriteSource(tool, *si, " ");
// ouput any flags specific to this source file
if(cl && this->OutputSourceSpecificFlags(*si))
{
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 20a443b..2d5ec2a 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -43,11 +43,19 @@ public:
);
private:
+ struct ToolSource
+ {
+ cmSourceFile* SourceFile;
+ bool RelativePath;
+ };
+ struct ToolSources: public std::vector<ToolSource> {};
+
+ std::string ConvertPath(std::string const& path, bool forceRelative);
void ConvertToWindowsSlash(std::string& s);
void WriteString(const char* line, int indentLevel);
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
- void WriteSource(const char* tool, cmSourceFile* sf, bool end = true);
+ void WriteSource(const char* tool, cmSourceFile* sf, const char* end = 0);
void WriteSources(const char* tool, std::vector<cmSourceFile*> const&);
void WriteAllSources();
void WriteDotNetReferences();
@@ -77,8 +85,7 @@ private:
void WriteEvents(std::string const& configName);
void WriteEvent(const char* name, std::vector<cmCustomCommand> & commands,
std::string const& configName);
- void WriteGroupSources(const char* name,
- std::vector<cmSourceFile*> const& sources,
+ void WriteGroupSources(const char* name, ToolSources const& sources,
std::vector<cmSourceGroup>& );
void AddMissingSourceGroups(std::set<cmSourceGroup*>& groupsUsed,
const std::vector<cmSourceGroup>& allGroups);
@@ -99,6 +106,9 @@ private:
cmGeneratedFileStream* BuildFileStream;
cmLocalVisualStudio7Generator* LocalGenerator;
std::set<cmSourceFile*> SourcesVisited;
+
+ typedef std::map<cmStdString, ToolSources> ToolSourceMap;
+ ToolSourceMap Tools;
};
#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 846aef5..451aec8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -70,6 +70,7 @@
# include "cmGlobalVisualStudio10Win64Generator.h"
# include "cmGlobalVisualStudio11Generator.h"
# include "cmGlobalVisualStudio11Win64Generator.h"
+# include "cmGlobalVisualStudio11ARMGenerator.h"
# include "cmGlobalVisualStudio8Win64Generator.h"
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
@@ -1698,8 +1699,8 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
else if (args[1] == "cmake_automoc")
{
cmQtAutomoc automoc;
- automoc.Run(args[2].c_str());
- return 0;
+ bool automocSuccess = automoc.Run(args[2].c_str());
+ return automocSuccess ? 0 : 1;
}
#endif
@@ -2569,6 +2570,8 @@ void cmake::AddDefaultGenerators()
&cmGlobalVisualStudio11Generator::New;
this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] =
&cmGlobalVisualStudio11Win64Generator::New;
+ this->Generators[cmGlobalVisualStudio11ARMGenerator::GetActualName()] =
+ &cmGlobalVisualStudio11ARMGenerator::New;
this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
&cmGlobalVisualStudio71Generator::New;
this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
new file mode 100644
index 0000000..7d3c4bd
--- /dev/null
+++ b/Source/cmcldeps.cxx
@@ -0,0 +1,736 @@
+/*
+ ninja's subprocess.h
+*/
+
+// Copyright 2012 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef NINJA_SUBPROCESS_H_
+#define NINJA_SUBPROCESS_H_
+
+#include <string>
+#include <vector>
+#include <queue>
+#include <cstdio>
+#include <algorithm>
+
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <signal.h>
+#endif
+
+
+#if defined(_WIN64)
+typedef unsigned __int64 cmULONG_PTR;
+#else
+typedef unsigned long cmULONG_PTR;
+#endif
+
+//#include "exit_status.h"
+enum ExitStatus {
+ ExitSuccess,
+ ExitFailure,
+ ExitInterrupted
+};
+
+/// Subprocess wraps a single async subprocess. It is entirely
+/// passive: it expects the caller to notify it when its fds are ready
+/// for reading, as well as call Finish() to reap the child once done()
+/// is true.
+struct Subprocess {
+ ~Subprocess();
+
+ /// Returns ExitSuccess on successful process exit, ExitInterrupted if
+ /// the process was interrupted, ExitFailure if it otherwise failed.
+ ExitStatus Finish();
+
+ bool Done() const;
+
+ const std::string& GetOutput() const;
+
+ int ExitCode() const { return exit_code_; }
+
+ private:
+ Subprocess();
+ bool Start(struct SubprocessSet* set, const std::string& command,
+ const std::string& dir);
+ void OnPipeReady();
+
+ std::string buf_;
+
+#ifdef _WIN32
+ /// Set up pipe_ as the parent-side pipe of the subprocess; return the
+ /// other end of the pipe, usable in the child process.
+ HANDLE SetupPipe(HANDLE ioport);
+
+ PROCESS_INFORMATION child_;
+ HANDLE pipe_;
+ OVERLAPPED overlapped_;
+ char overlapped_buf_[4 << 10];
+ bool is_reading_;
+ int exit_code_;
+#else
+ int fd_;
+ pid_t pid_;
+#endif
+
+ friend struct SubprocessSet;
+};
+
+/// SubprocessSet runs a ppoll/pselect() loop around a set of Subprocesses.
+/// DoWork() waits for any state change in subprocesses; finished_
+/// is a queue of subprocesses as they finish.
+struct SubprocessSet {
+ SubprocessSet();
+ ~SubprocessSet();
+
+ Subprocess* Add(const std::string& command, const std::string& dir);
+ bool DoWork();
+ Subprocess* NextFinished();
+ void Clear();
+
+ std::vector<Subprocess*> running_;
+ std::queue<Subprocess*> finished_;
+
+#ifdef _WIN32
+ static BOOL WINAPI NotifyInterrupted(DWORD dwCtrlType);
+ static HANDLE ioport_;
+#else
+ static void SetInterruptedFlag(int signum);
+ static bool interrupted_;
+
+ struct sigaction old_act_;
+ sigset_t old_mask_;
+#endif
+};
+
+#endif // NINJA_SUBPROCESS_H_
+
+
+/*
+ ninja's util functions
+*/
+
+
+static void Fatal(const char* msg, ...) {
+ va_list ap;
+ fprintf(stderr, "ninja: FATAL: ");
+ va_start(ap, msg);
+ vfprintf(stderr, msg, ap);
+ va_end(ap);
+ fprintf(stderr, "\n");
+#ifdef _WIN32
+ // On Windows, some tools may inject extra threads.
+ // exit() may block on locks held by those threads, so forcibly exit.
+ fflush(stderr);
+ fflush(stdout);
+ ExitProcess(1);
+#else
+ exit(1);
+#endif
+}
+
+
+#ifdef _WIN32
+std::string GetLastErrorString() {
+ DWORD err = GetLastError();
+
+ char* msg_buf;
+ FormatMessageA(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ err,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (char*)&msg_buf,
+ 0,
+ NULL);
+ std::string msg = msg_buf;
+ LocalFree(msg_buf);
+ return msg;
+}
+#endif
+
+#define snprintf _snprintf
+
+
+/*
+ ninja's subprocess-win32.cc
+*/
+
+// Copyright 2012 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//#include "subprocess.h"
+
+#include <stdio.h>
+
+#include <algorithm>
+
+//#include "util.h"
+
+namespace {
+
+void Win32Fatal(const char* function) {
+ Fatal("%s: %s", function, GetLastErrorString().c_str());
+}
+
+} // anonymous namespace
+
+Subprocess::Subprocess() : overlapped_(), is_reading_(false),
+ exit_code_(1) {
+ child_.hProcess = NULL;
+}
+
+Subprocess::~Subprocess() {
+ if (pipe_) {
+ if (!CloseHandle(pipe_))
+ Win32Fatal("CloseHandle");
+ }
+ // Reap child if forgotten.
+ if (child_.hProcess)
+ Finish();
+}
+
+HANDLE Subprocess::SetupPipe(HANDLE ioport) {
+ char pipe_name[100];
+ snprintf(pipe_name, sizeof(pipe_name),
+ "\\\\.\\pipe\\ninja_pid%u_sp%p", GetCurrentProcessId(), this);
+
+ pipe_ = ::CreateNamedPipeA(pipe_name,
+ PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
+ PIPE_TYPE_BYTE,
+ PIPE_UNLIMITED_INSTANCES,
+ 0, 0, INFINITE, NULL);
+ if (pipe_ == INVALID_HANDLE_VALUE)
+ Win32Fatal("CreateNamedPipe");
+
+ if (!CreateIoCompletionPort(pipe_, ioport, (cmULONG_PTR)this, 0))
+ Win32Fatal("CreateIoCompletionPort");
+
+ memset(&overlapped_, 0, sizeof(overlapped_));
+ if (!ConnectNamedPipe(pipe_, &overlapped_) &&
+ GetLastError() != ERROR_IO_PENDING) {
+ Win32Fatal("ConnectNamedPipe");
+ }
+
+ // Get the write end of the pipe as a handle inheritable across processes.
+ HANDLE output_write_handle = CreateFile(pipe_name, GENERIC_WRITE, 0,
+ NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE output_write_child;
+ if (!DuplicateHandle(GetCurrentProcess(), output_write_handle,
+ GetCurrentProcess(), &output_write_child,
+ 0, TRUE, DUPLICATE_SAME_ACCESS)) {
+ Win32Fatal("DuplicateHandle");
+ }
+ CloseHandle(output_write_handle);
+
+ return output_write_child;
+}
+
+bool Subprocess::Start(SubprocessSet* set, const std::string& command,
+ const std::string& dir) {
+ HANDLE child_pipe = SetupPipe(set->ioport_);
+
+ SECURITY_ATTRIBUTES security_attributes;
+ memset(&security_attributes, 0, sizeof(SECURITY_ATTRIBUTES));
+ security_attributes.nLength = sizeof(SECURITY_ATTRIBUTES);
+ security_attributes.bInheritHandle = TRUE;
+ // Must be inheritable so subprocesses can dup to children.
+ HANDLE nul = CreateFile("NUL", GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ &security_attributes, OPEN_EXISTING, 0, NULL);
+ if (nul == INVALID_HANDLE_VALUE)
+ Fatal("couldn't open nul");
+
+ STARTUPINFOA startup_info;
+ memset(&startup_info, 0, sizeof(startup_info));
+ startup_info.cb = sizeof(STARTUPINFO);
+ startup_info.dwFlags = STARTF_USESTDHANDLES;
+ startup_info.hStdInput = nul;
+ startup_info.hStdOutput = child_pipe;
+ startup_info.hStdError = child_pipe;
+
+ PROCESS_INFORMATION process_info;
+ memset(&process_info, 0, sizeof(process_info));
+
+ // Do not prepend 'cmd /c' on Windows, this breaks command
+ // lines greater than 8,191 chars.
+ if (!CreateProcessA(NULL, (char*)command.c_str(), NULL, NULL,
+ /* inherit handles */ TRUE, CREATE_NEW_PROCESS_GROUP,
+ NULL, (dir.empty() ? NULL : dir.c_str()),
+ &startup_info, &process_info)) {
+ DWORD error = GetLastError();
+ if (error == ERROR_FILE_NOT_FOUND) {
+ // file (program) not found error is treated
+ // as a normal build action failure
+ if (child_pipe)
+ CloseHandle(child_pipe);
+ CloseHandle(pipe_);
+ CloseHandle(nul);
+ pipe_ = NULL;
+ // child_ is already NULL;
+ buf_ =
+ "CreateProcess failed: The system cannot find the file specified.\n";
+ return true;
+ } else {
+ Win32Fatal("CreateProcess"); // pass all other errors to Win32Fatal
+ }
+ }
+
+ // Close pipe channel only used by the child.
+ if (child_pipe)
+ CloseHandle(child_pipe);
+ CloseHandle(nul);
+
+ CloseHandle(process_info.hThread);
+ child_ = process_info;
+
+ return true;
+}
+
+void Subprocess::OnPipeReady() {
+ DWORD bytes;
+ if (!GetOverlappedResult(pipe_, &overlapped_, &bytes, TRUE)) {
+ if (GetLastError() == ERROR_BROKEN_PIPE) {
+ CloseHandle(pipe_);
+ pipe_ = NULL;
+ return;
+ }
+ Win32Fatal("GetOverlappedResult");
+ }
+
+ if (is_reading_ && bytes)
+ buf_.append(overlapped_buf_, bytes);
+
+ memset(&overlapped_, 0, sizeof(overlapped_));
+ is_reading_ = true;
+ if (!::ReadFile(pipe_, overlapped_buf_, sizeof(overlapped_buf_),
+ &bytes, &overlapped_)) {
+ if (GetLastError() == ERROR_BROKEN_PIPE) {
+ CloseHandle(pipe_);
+ pipe_ = NULL;
+ return;
+ }
+ if (GetLastError() != ERROR_IO_PENDING)
+ Win32Fatal("ReadFile");
+ }
+
+ // Even if we read any bytes in the readfile call, we'll enter this
+ // function again later and get them at that point.
+}
+
+ExitStatus Subprocess::Finish() {
+ if (!child_.hProcess)
+ return ExitFailure;
+
+ // TODO: add error handling for all of these.
+ WaitForSingleObject(child_.hProcess, INFINITE);
+
+ DWORD exit_code = 0;
+ GetExitCodeProcess(child_.hProcess, &exit_code);
+
+ CloseHandle(child_.hProcess);
+ child_.hProcess = NULL;
+ exit_code_ = exit_code;
+ return exit_code == 0 ? ExitSuccess :
+ exit_code == CONTROL_C_EXIT ? ExitInterrupted :
+ ExitFailure;
+}
+
+bool Subprocess::Done() const {
+ return pipe_ == NULL;
+}
+
+const std::string& Subprocess::GetOutput() const {
+ return buf_;
+}
+
+HANDLE SubprocessSet::ioport_;
+
+SubprocessSet::SubprocessSet() {
+ ioport_ = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1);
+ if (!ioport_)
+ Win32Fatal("CreateIoCompletionPort");
+ if (!SetConsoleCtrlHandler(NotifyInterrupted, TRUE))
+ Win32Fatal("SetConsoleCtrlHandler");
+}
+
+SubprocessSet::~SubprocessSet() {
+ Clear();
+
+ SetConsoleCtrlHandler(NotifyInterrupted, FALSE);
+ CloseHandle(ioport_);
+}
+
+BOOL WINAPI SubprocessSet::NotifyInterrupted(DWORD dwCtrlType) {
+ if (dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_BREAK_EVENT) {
+ if (!PostQueuedCompletionStatus(ioport_, 0, 0, NULL))
+ Win32Fatal("PostQueuedCompletionStatus");
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+Subprocess *SubprocessSet::Add(const std::string& command,
+ const std::string& dir) {
+ Subprocess *subprocess = new Subprocess;
+ if (!subprocess->Start(this, command, dir)) {
+ delete subprocess;
+ return 0;
+ }
+ if (subprocess->child_.hProcess)
+ running_.push_back(subprocess);
+ else
+ finished_.push(subprocess);
+ return subprocess;
+}
+
+bool SubprocessSet::DoWork() {
+ DWORD bytes_read;
+ Subprocess* subproc;
+ OVERLAPPED* overlapped;
+
+ if (!GetQueuedCompletionStatus(ioport_, &bytes_read, (cmULONG_PTR*)&subproc,
+ &overlapped, INFINITE)) {
+ if (GetLastError() != ERROR_BROKEN_PIPE)
+ Win32Fatal("GetQueuedCompletionStatus");
+ }
+
+ if (!subproc) // A NULL subproc indicates that we were interrupted and is
+ // delivered by NotifyInterrupted above.
+ return true;
+
+ subproc->OnPipeReady();
+
+ if (subproc->Done()) {
+ std::vector<Subprocess*>::iterator end =
+ std::remove(running_.begin(), running_.end(), subproc);
+ if (running_.end() != end) {
+ finished_.push(subproc);
+ running_.resize(end - running_.begin());
+ }
+ }
+
+ return false;
+}
+
+Subprocess* SubprocessSet::NextFinished() {
+ if (finished_.empty())
+ return NULL;
+ Subprocess* subproc = finished_.front();
+ finished_.pop();
+ return subproc;
+}
+
+void SubprocessSet::Clear() {
+ std::vector<Subprocess*>::iterator it = running_.begin();
+ for (; it != running_.end(); ++it) {
+ if ((*it)->child_.hProcess) {
+ if (!GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT,
+ (*it)->child_.dwProcessId))
+ Win32Fatal("GenerateConsoleCtrlEvent");
+ }
+ }
+ it = running_.begin();
+ for (; it != running_.end(); ++it)
+ delete *it;
+ running_.clear();
+}
+
+
+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+// Wrapper around cl that adds /showIncludes to command line, and uses that to
+// generate .d files that match the style from gcc -MD.
+//
+// /showIncludes is equivalent to -MD, not -MMD, that is, system headers are
+// included.
+
+
+#include <windows.h>
+#include <sstream>
+//#include "subprocess.h"
+//#include "util.h"
+
+// We don't want any wildcard expansion.
+// See http://msdn.microsoft.com/en-us/library/zay8tzh6(v=vs.85).aspx
+void _setargv() {}
+
+static void usage(const char* msg) {
+ Fatal("%s\n\nusage:\n "
+ "cmcldeps "
+ "<language C, CXX or RC> "
+ "<source file path> "
+ "<output path for *.d file> "
+ "<output path for *.obj file> "
+ "<prefix of /showIncludes> "
+ "<path to cl.exe> "
+ "<path to tool (cl or rc)> "
+ "<rest of command ...>\n", msg);
+}
+
+static std::string trimLeadingSpace(const std::string& cmdline) {
+ int i = 0;
+ for (; cmdline[i] == ' '; ++i)
+ ;
+ return cmdline.substr(i);
+}
+
+static void doEscape(std::string& str, const std::string& search,
+ const std::string& repl) {
+ std::string::size_type pos = 0;
+ while ((pos = str.find(search, pos)) != std::string::npos) {
+ str.replace(pos, search.size(), repl);
+ pos += repl.size();
+ }
+}
+
+// Strips one argument from the cmdline and returns it. "surrounding quotes"
+// are removed from the argument if there were any.
+static std::string getArg(std::string& cmdline) {
+ std::string ret;
+ bool in_quoted = false;
+ unsigned int i = 0;
+
+ cmdline = trimLeadingSpace(cmdline);
+
+ for (;; ++i) {
+ if (i >= cmdline.size())
+ usage("Couldn't parse arguments.");
+ if (!in_quoted && cmdline[i] == ' ')
+ break; // "a b" "x y"
+ if (cmdline[i] == '"')
+ in_quoted = !in_quoted;
+ }
+
+ ret = cmdline.substr(0, i);
+ if (ret[0] == '"' && ret[i - 1] == '"')
+ ret = ret.substr(1, ret.size() - 2);
+ cmdline = cmdline.substr(i);
+ return ret;
+}
+
+static void parseCommandLine(LPTSTR wincmdline,
+ std::string& lang,
+ std::string& srcfile,
+ std::string& dfile,
+ std::string& objfile,
+ std::string& prefix,
+ std::string& clpath,
+ std::string& binpath,
+ std::string& rest) {
+ std::string cmdline(wincmdline);
+ /* self */ getArg(cmdline);
+ lang = getArg(cmdline);
+ srcfile = getArg(cmdline);
+ dfile = getArg(cmdline);
+ objfile = getArg(cmdline);
+ prefix = getArg(cmdline);
+ clpath = getArg(cmdline);
+ binpath = getArg(cmdline);
+ rest = trimLeadingSpace(cmdline);
+}
+
+static void outputDepFile(const std::string& dfile, const std::string& objfile,
+ std::vector<std::string>& incs) {
+
+ if (dfile.empty())
+ return;
+
+ // strip duplicates
+ std::sort(incs.begin(), incs.end());
+ incs.erase(std::unique(incs.begin(), incs.end()), incs.end());
+
+ FILE* out = fopen(dfile.c_str(), "wb");
+
+ // FIXME should this be fatal or not? delete obj? delete d?
+ if (!out)
+ return;
+
+ std::string tmp = objfile;
+ doEscape(tmp, " ", "\\ ");
+ fprintf(out, "%s: \\\n", tmp.c_str());
+
+ std::vector<std::string>::iterator it = incs.begin();
+ for (; it != incs.end(); ++it) {
+ tmp = *it;
+ doEscape(tmp, "\\", "/");
+ doEscape(tmp, " ", "\\ ");
+ fprintf(out, "%s \\\n", tmp.c_str());
+ }
+
+ fprintf(out, "\n");
+ fclose(out);
+}
+
+
+bool startsWith(const std::string& str, const std::string& what) {
+ return str.compare(0, what.size(), what) == 0;
+}
+
+bool contains(const std::string& str, const std::string& what) {
+ return str.find(what) != std::string::npos;
+}
+
+std::string replace(const std::string& str, const std::string& what,
+ const std::string& replacement) {
+ size_t pos = str.find(what);
+ if (pos == std::string::npos)
+ return str;
+ std::string replaced = str;
+ return replaced.replace(pos, what.size(), replacement);
+}
+
+
+
+static int process( const std::string& srcfilename,
+ const std::string& dfile,
+ const std::string& objfile,
+ const std::string& prefix,
+ const std::string& cmd,
+ const std::string& dir = "",
+ bool quiet = false) {
+
+ SubprocessSet subprocs;
+ Subprocess* subproc = subprocs.Add(cmd, dir);
+
+ if(!subproc)
+ return 2;
+
+ while ((subproc = subprocs.NextFinished()) == NULL) {
+ subprocs.DoWork();
+ }
+
+ bool success = subproc->Finish() == ExitSuccess;
+ int exit_code = subproc->ExitCode();
+
+ std::string output = subproc->GetOutput();
+ delete subproc;
+
+ // process the include directives and output everything else
+ std::stringstream ss(output);
+ std::string line;
+ std::vector<std::string> includes;
+ bool isFirstLine = true; // cl prints always first the source filename
+ while (std::getline(ss, line)) {
+ if (startsWith(line, prefix)) {
+ std::string inc = trimLeadingSpace(line.substr(prefix.size()).c_str());
+ if (inc[inc.size() - 1] == '\r') // blech, stupid \r\n
+ inc = inc.substr(0, inc.size() - 1);
+ includes.push_back(inc);
+ } else {
+ if (!isFirstLine || !startsWith(line, srcfilename)) {
+ if (!quiet) {
+ fprintf(stdout, "%s\n", line.c_str());
+ }
+ } else {
+ isFirstLine = false;
+ }
+ }
+ }
+
+ if (!success) {
+ return exit_code;
+ }
+
+ // don't update .d until/unless we succeed compilation
+ outputDepFile(dfile, objfile, includes);
+
+ return 0;
+}
+
+
+int main() {
+
+ // Use the Win32 api instead of argc/argv so we can avoid interpreting the
+ // rest of command line after the .d and .obj. Custom parsing seemed
+ // preferable to the ugliness you get into in trying to re-escape quotes for
+ // subprocesses, so by avoiding argc/argv, the subprocess is called with
+ // the same command line verbatim.
+
+ std::string lang, srcfile, dfile, objfile, prefix, cl, binpath, rest;
+ parseCommandLine(GetCommandLine(), lang, srcfile, dfile, objfile,
+ prefix, cl, binpath, rest);
+
+ // needed to suppress filename output of msvc tools
+ std::string srcfilename;
+ std::string::size_type pos = srcfile.rfind("\\");
+ if (pos != std::string::npos) {
+ srcfilename = srcfile.substr(pos + 1);
+ }
+
+ std::string nol = " /nologo ";
+ std::string show = " /showIncludes ";
+ if (lang == "C" || lang == "CXX") {
+ return process(srcfilename, dfile, objfile, prefix,
+ binpath + nol + show + rest);
+ } else if (lang == "RC") {
+ // "misuse" cl.exe to get headers from .rc files
+
+ std::string clrest = rest;
+ // rc: /fo x.dir\x.rc.res -> cl: /out:x.dir\x.rc.res.dep.obj
+ clrest = replace(clrest, "/fo", "/out:");
+ clrest = replace(clrest, objfile, objfile + ".dep.obj ");
+ // rc: src\x\x.rc -> cl: /Tc src\x\x.rc
+ clrest = replace(clrest, srcfile, "/Tc " + srcfile);
+
+ cl = "\"" + cl + "\" /P /DRC_INVOKED ";
+
+ // call cl in object dir so the .i is generated there
+ std::string objdir;
+ std::string::size_type pos = objfile.rfind("\\");
+ if (pos != std::string::npos) {
+ objdir = objfile.substr(0, pos);
+ }
+
+ // extract dependencies with cl.exe
+ process(srcfilename, dfile, objfile,
+ prefix, cl + nol + show + clrest, objdir, true);
+
+ // compile rc file with rc.exe
+ return process(srcfilename, "" , objfile, prefix, binpath + " " + rest);
+ }
+
+ usage("Invalid language specified.");
+ return 1;
+}
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 0ef4e28..a132357 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -123,7 +123,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
SET(KWSYS_USE_FundamentalType 1)
SET(KWSYS_USE_Terminal 1)
SET(KWSYS_USE_IOStream 1)
- SET(KWSYS_USE_DateStamp 1)
SET(KWSYS_USE_String 1)
SET(KWSYS_USE_SystemInformation 1)
SET(KWSYS_USE_CPU 1)
@@ -142,7 +141,6 @@ IF(KWSYS_USE_Process)
SET(KWSYS_USE_System 1)
ENDIF(KWSYS_USE_Process)
IF(KWSYS_USE_SystemInformation)
- SET(KWSYS_USE_FundamentalType 1)
SET(KWSYS_USE_Process 1)
ENDIF(KWSYS_USE_SystemInformation)
@@ -414,6 +412,39 @@ IF(UNIX)
"Checking whether struct stat has st_mtim member" DIRECT)
ENDIF(UNIX)
+# Check existence and uniqueness of long long and __int64.
+KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_LONG_LONG
+ "Checking whether C++ compiler has 'long long'" DIRECT)
+KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS___INT64
+ "Checking whether C++ compiler has '__int64'" DIRECT)
+IF(KWSYS_CXX_HAS___INT64)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_AND___INT64
+ "Checking whether long and __int64 are the same type" DIRECT)
+ IF(KWSYS_CXX_HAS_LONG_LONG)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_LONG_AND___INT64
+ "Checking whether long long and __int64 are the same type" DIRECT)
+ ENDIF()
+ENDIF()
+
+# Enable the "long long" type if it is available. It is standard in
+# C99 and C++03 but not in earlier standards.
+IF(KWSYS_CXX_HAS_LONG_LONG)
+ SET(KWSYS_USE_LONG_LONG 1)
+ELSE()
+ SET(KWSYS_USE_LONG_LONG 0)
+ENDIF()
+
+# Enable the "__int64" type if it is available and unique. It is not
+# standard.
+SET(KWSYS_USE___INT64 0)
+IF(KWSYS_CXX_HAS___INT64)
+ IF(NOT KWSYS_CXX_SAME_LONG_AND___INT64)
+ IF(NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64)
+ SET(KWSYS_USE___INT64 1)
+ ENDIF()
+ ENDIF()
+ENDIF()
+
IF(KWSYS_USE_FundamentalType)
# Look for type size helper macros.
KWSYS_PLATFORM_INFO_TEST(C KWSYS_C_TYPE_MACROS
@@ -464,34 +495,6 @@ IF(KWSYS_USE_FundamentalType)
ENDIF()
ENDFOREACH()
- # Check uniqueness of types.
- IF(KWSYS_SIZEOF___INT64)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_AND___INT64
- "Checking whether long and __int64 are the same type" DIRECT)
- IF(KWSYS_SIZEOF_LONG_LONG)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_LONG_AND___INT64
- "Checking whether long long and __int64 are the same type" DIRECT)
- ENDIF(KWSYS_SIZEOF_LONG_LONG)
- ENDIF(KWSYS_SIZEOF___INT64)
-
- # Enable the "long long" type if it is available. It is standard in
- # C99 and C++03 but not in earlier standards.
- IF(KWSYS_SIZEOF_LONG_LONG)
- SET(KWSYS_USE_LONG_LONG 1)
- ELSE(KWSYS_SIZEOF_LONG_LONG)
- SET(KWSYS_USE_LONG_LONG 0)
- ENDIF(KWSYS_SIZEOF_LONG_LONG)
-
- # Enable the "__int64" type if it is available and unique. It is not
- # standard.
- SET(KWSYS_USE___INT64 0)
- IF(KWSYS_SIZEOF___INT64)
- IF(NOT KWSYS_CXX_SAME_LONG_AND___INT64)
- IF(NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64)
- SET(KWSYS_USE___INT64 1)
- ENDIF(NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64)
- ENDIF(NOT KWSYS_CXX_SAME_LONG_AND___INT64)
- ENDIF(KWSYS_SIZEOF___INT64)
IF(KWSYS_USE___INT64)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
"Checking whether unsigned __int64 can convert to double" DIRECT)
@@ -506,8 +509,6 @@ ENDIF(KWSYS_USE_FundamentalType)
IF(KWSYS_USE_IOStream)
# Determine whether iostreams support long long.
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_LONG_LONG
- "Checking whether C++ compiler has 'long long'" DIRECT)
IF(KWSYS_CXX_HAS_LONG_LONG)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
-DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
@@ -553,11 +554,22 @@ SET_SOURCE_FILES_PROPERTIES(ProcessUNIX.c System.c PROPERTIES
COMPILE_FLAGS "-DKWSYS_C_HAS_PTRDIFF_T=${KWSYS_C_HAS_PTRDIFF_T} -DKWSYS_C_HAS_SSIZE_T=${KWSYS_C_HAS_SSIZE_T}"
)
-IF(KWSYS_DO_NOT_CLEAN_PUTENV)
- # Disable cleanup of putenv memory for issues with GCOV.
+IF(KWSYS_USE_SystemTools)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_SETENV
+ "Checking whether CXX compiler has setenv" DIRECT)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UNSETENV
+ "Checking whether CXX compiler has unsetenv" DIRECT)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
+ "Checking whether CXX compiler has environ in stdlib.h" DIRECT)
SET_SOURCE_FILES_PROPERTIES(SystemTools.cxx PROPERTIES
- COMPILE_FLAGS -DKWSYS_DO_NOT_CLEAN_PUTENV=1)
-ENDIF(KWSYS_DO_NOT_CLEAN_PUTENV)
+ COMPILE_FLAGS "-DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV} -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV} -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}")
+ENDIF()
+
+IF(KWSYS_USE_SystemInformation)
+ SET_PROPERTY(SOURCE SystemInformation.cxx PROPERTY
+ COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=${KWSYS_USE_LONG_LONG}
+ KWSYS_USE___INT64=${KWSYS_USE___INT64})
+ENDIF()
#-----------------------------------------------------------------------------
# Choose a directory for the generated headers.
@@ -690,7 +702,7 @@ ENDFOREACH(cpp)
# Add selected C components.
FOREACH(c
- Process Base64 FundamentalType MD5 Terminal System DateStamp String CPU
+ Process Base64 FundamentalType MD5 Terminal System String CPU
)
IF(KWSYS_USE_${c})
# Use the corresponding header file.
diff --git a/Source/kwsys/DateStamp.h.in b/Source/kwsys/DateStamp.h.in
deleted file mode 100644
index c3d0099..0000000
--- a/Source/kwsys/DateStamp.h.in
+++ /dev/null
@@ -1,42 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- 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 @KWSYS_NAMESPACE@_DateStamp_h
-#define @KWSYS_NAMESPACE@_DateStamp_h
-
-/** Version date integer year. The format is CCYY. */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_YEAR @KWSYS_DATE_STAMP_YEAR@
-
-/** Version date integer month. The format is MM. */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_MONTH @KWSYS_DATE_STAMP_MONTH@
-
-/** Version date integer day. The format is DD. */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_DAY @KWSYS_DATE_STAMP_DAY@
-
-/** Version date full integer. The format is CCYYMMDD. */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_FULL @KWSYS_DATE_STAMP_YEAR@@KWSYS_DATE_STAMP_MONTH@@KWSYS_DATE_STAMP_DAY@
-
-/** Version date string year. The format is "CCYY". */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_STRING_YEAR "@KWSYS_DATE_STAMP_YEAR@"
-
-/** Version date string month. The format is "MM". */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_STRING_MONTH "@KWSYS_DATE_STAMP_MONTH@"
-
-/** Version date string day. The format is "DD". */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_STRING_DAY "@KWSYS_DATE_STAMP_DAY@"
-
-/** Version date full string. The format is "CCYYMMDD". */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_STRING_FULL "@KWSYS_DATE_STAMP_YEAR@@KWSYS_DATE_STAMP_MONTH@@KWSYS_DATE_STAMP_DAY@"
-
-/** Version date formatted string. The format is "CCYY-MM-DD". */
-#define @KWSYS_NAMESPACE@_DATE_STAMP_STRING "@KWSYS_DATE_STAMP_YEAR@-@KWSYS_DATE_STAMP_MONTH@-@KWSYS_DATE_STAMP_DAY@"
-
-#endif
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index d49c0d7..e1ee873 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -26,7 +26,6 @@
// http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx
#include "kwsysPrivate.h"
-#include KWSYS_HEADER(FundamentalType.h)
#include KWSYS_HEADER(stl/string)
#include KWSYS_HEADER(stl/vector)
#include KWSYS_HEADER(ios/iosfwd)
@@ -38,7 +37,6 @@
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
-# include "FundamentalType.h.in"
# include "SystemInformation.hxx.in"
# include "Process.h.in"
# include "Configure.hxx.in"
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 4d83293..66850e9 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -25,6 +25,8 @@
#include KWSYS_HEADER(ios/fstream)
#include KWSYS_HEADER(ios/sstream)
+#include KWSYS_HEADER(stl/set)
+
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
@@ -78,6 +80,10 @@
# undef _WIN32
#endif
+#if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
+extern char **environ;
+#endif
+
#ifdef __CYGWIN__
extern "C" void cygwin_conv_to_win32_path(const char *path, char *win32_path);
#endif
@@ -371,38 +377,224 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result)
}
}
-#ifdef __INTEL_COMPILER
-#pragma warning disable 444
+//----------------------------------------------------------------------------
+
+#if defined(__CYGWIN__) || defined(__GLIBC__)
+# define KWSYS_PUTENV_NAME /* putenv("A") removes A. */
+#elif defined(_WIN32)
+# define KWSYS_PUTENV_EMPTY /* putenv("A=") removes A. */
#endif
-class kwsysDeletingCharVector : public kwsys_stl::vector<char*>
+#if KWSYS_CXX_HAS_UNSETENV
+/* unsetenv("A") removes A from the environment.
+ On older platforms it returns void instead of int. */
+static int kwsysUnPutEnv(const char* env)
{
-public:
- ~kwsysDeletingCharVector();
-};
+ if(const char* eq = strchr(env, '='))
+ {
+ std::string name(env, eq-env);
+ unsetenv(name.c_str());
+ }
+ else
+ {
+ unsetenv(env);
+ }
+ return 0;
+}
-kwsysDeletingCharVector::~kwsysDeletingCharVector()
+#elif defined(KWSYS_PUTENV_EMPTY) || defined(KWSYS_PUTENV_NAME)
+/* putenv("A=") or putenv("A") removes A from the environment. */
+static int kwsysUnPutEnv(const char* env)
{
-#ifndef KWSYS_DO_NOT_CLEAN_PUTENV
- for(kwsys_stl::vector<char*>::iterator i = this->begin();
- i != this->end(); ++i)
+ int err = 0;
+ const char* eq = strchr(env, '=');
+ size_t const len = eq? (size_t)(eq-env) : strlen(env);
+# ifdef KWSYS_PUTENV_EMPTY
+ size_t const sz = len + 2;
+# else
+ size_t const sz = len + 1;
+# endif
+ char local_buf[256];
+ char* buf = sz > sizeof(local_buf) ? (char*)malloc(sz) : local_buf;
+ if(!buf)
+ {
+ return -1;
+ }
+ strncpy(buf, env, len);
+# ifdef KWSYS_PUTENV_EMPTY
+ buf[len] = '=';
+ buf[len+1] = 0;
+ if(putenv(buf) < 0)
+ {
+ err = errno;
+ }
+# else
+ buf[len] = 0;
+ if(putenv(buf) < 0 && errno != EINVAL)
+ {
+ err = errno;
+ }
+# endif
+ if(buf != local_buf)
{
- delete []*i;
+ free(buf);
}
+ if(err)
+ {
+ errno = err;
+ return -1;
+ }
+ return 0;
+}
+
+#else
+/* Manipulate the "environ" global directly. */
+static int kwsysUnPutEnv(const char* env)
+{
+ const char* eq = strchr(env, '=');
+ size_t const len = eq? (size_t)(eq-env) : strlen(env);
+ int in = 0;
+ int out = 0;
+ while(environ[in])
+ {
+ if(strlen(environ[in]) > len &&
+ environ[in][len] == '=' &&
+ strncmp(env, environ[in], len) == 0)
+ {
+ ++in;
+ }
+ else
+ {
+ environ[out++] = environ[in++];
+ }
+ }
+ while(out < in)
+ {
+ environ[out++] = 0;
+ }
+ return 0;
+}
#endif
+
+//----------------------------------------------------------------------------
+
+#if KWSYS_CXX_HAS_SETENV
+
+/* setenv("A", "B", 1) will set A=B in the environment and makes its
+ own copies of the strings. */
+bool SystemTools::PutEnv(const char* env)
+{
+ if(const char* eq = strchr(env, '='))
+ {
+ std::string name(env, eq-env);
+ return setenv(name.c_str(), eq+1, 1) == 0;
+ }
+ else
+ {
+ return kwsysUnPutEnv(env) == 0;
+ }
+}
+
+bool SystemTools::UnPutEnv(const char* env)
+{
+ return kwsysUnPutEnv(env) == 0;
+}
+
+#else
+
+/* putenv("A=B") will set A=B in the environment. Most putenv implementations
+ put their argument directly in the environment. They never free the memory
+ on program exit. Keep an active set of pointers to memory we allocate and
+ pass to putenv, one per environment key. At program exit remove any
+ environment values that may still reference memory we allocated. Then free
+ the memory. This will not affect any environment values we never set. */
+
+# ifdef __INTEL_COMPILER
+# pragma warning disable 444 /* base has non-virtual destructor */
+# endif
+
+/* Order by environment key only (VAR from VAR=VALUE). */
+struct kwsysEnvCompare
+{
+ bool operator() (const char* l, const char* r) const
+ {
+ const char* leq = strchr(l, '=');
+ const char* req = strchr(r, '=');
+ size_t llen = leq? (leq-l) : strlen(l);
+ size_t rlen = req? (req-r) : strlen(r);
+ if(llen == rlen)
+ {
+ return strncmp(l,r,llen) < 0;
+ }
+ else
+ {
+ return strcmp(l,r) < 0;
+ }
+ }
+};
+
+class kwsysEnv: public kwsys_stl::set<const char*, kwsysEnvCompare>
+{
+ class Free
+ {
+ const char* Env;
+ public:
+ Free(const char* env): Env(env) {}
+ ~Free() { free(const_cast<char*>(this->Env)); }
+ };
+public:
+ typedef kwsys_stl::set<const char*, kwsysEnvCompare> derived;
+ ~kwsysEnv()
+ {
+ for(derived::iterator i = this->begin(); i != this->end(); ++i)
+ {
+ kwsysUnPutEnv(*i);
+ free(const_cast<char*>(*i));
+ }
+ }
+ const char* Release(const char* env)
+ {
+ const char* old = 0;
+ derived::iterator i = this->find(env);
+ if(i != this->end())
+ {
+ old = *i;
+ this->erase(i);
+ }
+ return old;
+ }
+ bool Put(const char* env)
+ {
+ Free oldEnv(this->Release(env));
+ static_cast<void>(oldEnv);
+ char* newEnv = strdup(env);
+ this->insert(newEnv);
+ return putenv(newEnv) == 0;
+ }
+ bool UnPut(const char* env)
+ {
+ Free oldEnv(this->Release(env));
+ static_cast<void>(oldEnv);
+ return kwsysUnPutEnv(env) == 0;
+ }
+};
+
+static kwsysEnv kwsysEnvInstance;
+
+bool SystemTools::PutEnv(const char* env)
+{
+ return kwsysEnvInstance.Put(env);
}
-bool SystemTools::PutEnv(const char* value)
+
+bool SystemTools::UnPutEnv(const char* env)
{
- static kwsysDeletingCharVector localEnvironment;
- char* envVar = new char[strlen(value)+1];
- strcpy(envVar, value);
- int ret = putenv(envVar);
- // save the pointer in the static vector so that it can
- // be deleted on exit
- localEnvironment.push_back(envVar);
- return ret == 0;
+ return kwsysEnvInstance.UnPut(env);
}
+#endif
+
+//----------------------------------------------------------------------------
+
const char* SystemTools::GetExecutableExtension()
{
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS)
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 04f1978..5171125 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -749,7 +749,11 @@ public:
/** Put a string into the environment
of the form var=value */
- static bool PutEnv(const char* value);
+ static bool PutEnv(const char* env);
+
+ /** Remove a string from the environment.
+ Input is of the form "var" or "var=value" (value is ignored). */
+ static bool UnPutEnv(const char* env);
/**
* Get current working directory CWD
diff --git a/Source/kwsys/hash_fun.hxx.in b/Source/kwsys/hash_fun.hxx.in
index 8c5eb6a..6f787dd 100644
--- a/Source/kwsys/hash_fun.hxx.in
+++ b/Source/kwsys/hash_fun.hxx.in
@@ -38,7 +38,6 @@
#define @KWSYS_NAMESPACE@_hash_fun_hxx
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/FundamentalType.h>
#include <@KWSYS_NAMESPACE@/cstddef> // size_t
#include <@KWSYS_NAMESPACE@/stl/string> // string
@@ -124,7 +123,7 @@ struct hash<unsigned long> {
};
// use long long or __int64
-#if @KWSYS_NAMESPACE@_USE_LONG_LONG
+#if @KWSYS_USE_LONG_LONG@
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
struct hash<long long> {
size_t operator()(long long __x) const { return __x; }
@@ -134,7 +133,7 @@ struct hash<long long> {
struct hash<unsigned long long> {
size_t operator()(unsigned long long __x) const { return __x; }
};
-#elif @KWSYS_NAMESPACE@_USE___INT64
+#elif @KWSYS_USE___INT64@
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
struct hash<__int64> {
size_t operator()(__int64 __x) const { return __x; }
diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in
index db52fc8..c835503 100644
--- a/Source/kwsys/hashtable.hxx.in
+++ b/Source/kwsys/hashtable.hxx.in
@@ -394,7 +394,7 @@ enum { _stl_num_primes = 31 };
// create a function with a static local to that function that returns
// the static
-inline const unsigned long* get_stl_prime_list() {
+static inline const unsigned long* get_stl_prime_list() {
static const unsigned long _stl_prime_list[_stl_num_primes] =
{
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
deleted file mode 100644
index f157607..0000000
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-# Do not edit! Generated by kwsysDateStamp.py
-#=============================================================================
-# KWSys - Kitware System Library
-# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-#
-# 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.
-#=============================================================================
-
-# KWSys version date year component. Format is CCYY.
-SET(KWSYS_DATE_STAMP_YEAR 2012)
-
-# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 04)
-
-# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 18)
diff --git a/Source/kwsys/kwsysDateStamp.py b/Source/kwsys/kwsysDateStamp.py
deleted file mode 100755
index bd2e49a..0000000
--- a/Source/kwsys/kwsysDateStamp.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-#=============================================================================
-# KWSys - Kitware System Library
-# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-#
-# 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.
-#=============================================================================
-
-import sys,os
-import time
-
-# Get the path to the directory containing this script.
-if __name__ == '__main__':
- selfdir = os.path.abspath(sys.path[0] or os.curdir)
-else:
- selfdir = os.path.abspath(os.path.dirname(__file__))
-
-# Open the CMake code file.
-fname = os.path.join(selfdir, 'kwsysDateStamp.cmake')
-fout = open(fname, 'w');
-
-# Get the current time.
-ct = time.localtime()
-
-# Write the CMake code describing the date.
-fout.write("""# Do not edit! Generated by kwsysDateStamp.py
-#=============================================================================
-# KWSys - Kitware System Library
-# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-#
-# 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.
-#=============================================================================
-
-# KWSys version date year component. Format is CCYY.
-SET(KWSYS_DATE_STAMP_YEAR %04u)
-
-# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH %02u)
-
-# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY %02u)
-""" % (ct.tm_year, ct.tm_mon, ct.tm_mday))
-
-fout.close()
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
index 903be9b..7b73d06 100644
--- a/Source/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -122,6 +122,15 @@ int main()
}
#endif
+#ifdef TEST_KWSYS_CXX_HAS___INT64
+__int64 f(__int64 n) { return n; }
+int main()
+{
+ __int64 n = 0;
+ return static_cast<int>(f(n));
+}
+#endif
+
#ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
template <class T> class A;
template <class T> int f(A<T>&);
@@ -393,6 +402,32 @@ int main(int, char **argv)
}
#endif
+#ifdef TEST_KWSYS_CXX_HAS_SETENV
+#include <stdlib.h>
+int main()
+{
+ return setenv("A", "B", 1);
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_UNSETENV
+#include <stdlib.h>
+int main()
+{
+ unsetenv("A");
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
+#include <stdlib.h>
+int main()
+{
+ char* e = environ[0];
+ return e? 0:1;
+}
+#endif
+
#ifdef TEST_KWSYS_CXX_TYPE_INFO
/* Collect fundamental type information and save it to a CMake script. */
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index c0e74af..3ac0cb3 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -328,6 +328,58 @@ bool CheckStringOperations()
}
//----------------------------------------------------------------------------
+
+bool CheckPutEnv(const char* env, const char* name, const char* value)
+{
+ if(!kwsys::SystemTools::PutEnv(env))
+ {
+ kwsys_ios::cerr << "PutEnv(\"" << env
+ << "\") failed!" << kwsys_ios::endl;
+ return false;
+ }
+ const char* v = kwsys::SystemTools::GetEnv(name);
+ v = v? v : "(null)";
+ if(strcmp(v, value) != 0)
+ {
+ kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \""
+ << v << "\", not \"" << value << "\"!" << kwsys_ios::endl;
+ return false;
+ }
+ return true;
+}
+
+bool CheckUnPutEnv(const char* env, const char* name)
+{
+ if(!kwsys::SystemTools::UnPutEnv(env))
+ {
+ kwsys_ios::cerr << "UnPutEnv(\"" << env << "\") failed!"
+ << kwsys_ios::endl;
+ return false;
+ }
+ if(const char* v = kwsys::SystemTools::GetEnv(name))
+ {
+ kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \""
+ << v << "\", not (null)!" << kwsys_ios::endl;
+ return false;
+ }
+ return true;
+}
+
+bool CheckEnvironmentOperations()
+{
+ bool res = true;
+ res &= CheckPutEnv("A=B", "A", "B");
+ res &= CheckPutEnv("B=C", "B", "C");
+ res &= CheckPutEnv("C=D", "C", "D");
+ res &= CheckPutEnv("D=E", "D", "E");
+ res &= CheckUnPutEnv("A", "A");
+ res &= CheckUnPutEnv("B=", "B");
+ res &= CheckUnPutEnv("C=D", "C");
+ /* Leave "D=E" in environment so a memory checker can test for leaks. */
+ return res;
+}
+
+//----------------------------------------------------------------------------
int testSystemTools(int, char*[])
{
bool res = true;
@@ -356,5 +408,7 @@ int testSystemTools(int, char*[])
res &= CheckStringOperations();
+ res &= CheckEnvironmentOperations();
+
return res ? 0 : 1;
}