summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx3
-rw-r--r--Source/cmExportFileGenerator.cxx21
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx61
-rw-r--r--Source/cmSystemTools.cxx9
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx7
-rw-r--r--Source/cmTimestamp.cxx64
-rw-r--r--Source/cmTimestamp.h11
8 files changed, 151 insertions, 27 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d81477a..b983213 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 5)
-set(CMake_VERSION_PATCH 20160216)
+set(CMake_VERSION_PATCH 20160224)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 22d4bf0..3eca280 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -723,10 +723,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(
new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" )
{
- realInstallDirectory += installSubDirectory;
+ tempInstallDirectory += installSubDirectory;
}
if (componentInstall)
{
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index e8a2e6a..c005995 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -772,6 +772,27 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
lastPos = endPos;
}
+ pos = 0;
+ lastPos = pos;
+ while (errorString.empty() &&
+ (pos = input.find("$<LINK_ONLY:", lastPos)) != input.npos)
+ {
+ std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1;
+ std::string::size_type endPos = input.find(">", nameStartPos);
+ if (endPos == input.npos)
+ {
+ errorString = "$<LINK_ONLY:...> expression incomplete";
+ break;
+ }
+ std::string libName = input.substr(nameStartPos, endPos - nameStartPos);
+ if (cmGeneratorExpression::IsValidTargetName(libName) &&
+ this->AddTargetNamespace(libName, target, missingTargets))
+ {
+ input.replace(nameStartPos, endPos - nameStartPos, libName);
+ }
+ lastPos = nameStartPos + libName.size() + 1;
+ }
+
this->ReplaceInstallPrefix(input);
if (!errorString.empty())
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 9348ef2..026958a 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -684,18 +684,38 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
{
// figure out which language to use
- // for now care only for C and C++
- std::string compilerIdVar = "CMAKE_CXX_COMPILER_ID";
- if (this->GlobalGenerator->GetLanguageEnabled("CXX") == false)
+ // for now care only for C, C++, and Fortran
+
+ // projects with C/C++ and Fortran are handled as C/C++ projects
+ bool pureFortran = false;
+ std::string compilerIdVar;
+ if (this->GlobalGenerator->GetLanguageEnabled("CXX") == true)
+ {
+ compilerIdVar = "CMAKE_CXX_COMPILER_ID";
+ }
+ else if (this->GlobalGenerator->GetLanguageEnabled("C") == true)
{
compilerIdVar = "CMAKE_C_COMPILER_ID";
}
+ else if (this->GlobalGenerator->GetLanguageEnabled("Fortran") == true)
+ {
+ compilerIdVar = "CMAKE_Fortran_COMPILER_ID";
+ pureFortran = true;
+ }
+
std::string compilerId = mf->GetSafeDefinition(compilerIdVar);
std::string compiler = "gcc"; // default to gcc
if (compilerId == "MSVC")
{
- compiler = "msvc8";
+ if( mf->IsDefinitionSet("MSVC10") == true )
+ {
+ compiler = "msvc10";
+ }
+ else
+ {
+ compiler = "msvc8";
+ }
}
else if (compilerId == "Borland")
{
@@ -707,15 +727,44 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
}
else if (compilerId == "Intel")
{
- compiler = "icc";
+ if (pureFortran && mf->IsDefinitionSet("WIN32"))
+ {
+ compiler = "ifcwin"; // Intel Fortran for Windows (known by cbFortran)
+ }
+ else
+ {
+ compiler = "icc";
+ }
}
else if (compilerId == "Watcom" || compilerId == "OpenWatcom")
{
compiler = "ow";
}
+ else if (compilerId == "Clang")
+ {
+ compiler = "clang";
+ }
+ else if (compilerId == "PGI")
+ {
+ if (pureFortran)
+ {
+ compiler = "pgifortran";
+ }
+ else
+ {
+ compiler = "pgi"; // does not exist as default in CodeBlocks 16.01
+ }
+ }
else if (compilerId == "GNU")
{
- compiler = "gcc";
+ if (pureFortran)
+ {
+ compiler = "gfortran";
+ }
+ else
+ {
+ compiler = "gcc";
+ }
}
return compiler;
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 3ba7287..9af54bf 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -60,8 +60,7 @@
#endif
#if defined(CMAKE_BUILD_WITH_CMAKE)
-# include <fcntl.h>
-# include "cmCryptoHash.h"
+# include "cmCryptoHash.h"
#endif
#if defined(CMAKE_USE_ELF_PARSER)
@@ -2184,8 +2183,10 @@ unsigned int cmSystemTools::RandomSeed()
} seed;
// Try using a real random source.
- cmsys::ifstream fin("/dev/urandom");
- if(fin && fin.read(seed.bytes, sizeof(seed)) &&
+ cmsys::ifstream fin;
+ fin.rdbuf()->pubsetbuf(0, 0); // Unbuffered read.
+ fin.open("/dev/urandom");
+ if(fin.good() && fin.read(seed.bytes, sizeof(seed)) &&
fin.gcount() == sizeof(seed))
{
return seed.integer;
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 5f3246a..435346a 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -432,11 +432,8 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
{
std::string configLib = this->Target
->GetDebugGeneratorExpressions(lib, llt);
- if (cmGeneratorExpression::IsValidTargetName(configLib))
- {
- configLib = "$<LINK_ONLY:$<TARGET_NAME:" + configLib + ">>";
- }
- else if (cmGeneratorExpression::Find(configLib) != std::string::npos)
+ if (cmGeneratorExpression::IsValidTargetName(lib)
+ || cmGeneratorExpression::Find(lib) != std::string::npos)
{
configLib = "$<LINK_ONLY:" + configLib + ">";
}
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index 6fd6ab7..1c795c4 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -12,9 +12,11 @@
#include "cmTimestamp.h"
#include <cstring>
+#include <cstdlib>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sstream>
//----------------------------------------------------------------------------
std::string cmTimestamp::CurrentTime(
@@ -44,7 +46,7 @@ std::string cmTimestamp::FileModificationTime(const char* path,
//----------------------------------------------------------------------------
std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT,
- std::string formatString, bool utcFlag)
+ std::string formatString, bool utcFlag) const
{
if(formatString.empty())
{
@@ -79,12 +81,12 @@ std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT,
for(std::string::size_type i = 0; i < formatString.size(); ++i)
{
char c1 = formatString[i];
- char c2 = (i+1 < formatString.size()) ?
- formatString[i+1] : static_cast<char>(0);
+ char c2 = (i + 1 < formatString.size()) ?
+ formatString[i + 1] : static_cast<char>(0);
if(c1 == '%' && c2 != 0)
{
- result += AddTimestampComponent(c2, timeStruct);
+ result += AddTimestampComponent(c2, timeStruct, timeT);
++i;
}
else
@@ -97,8 +99,40 @@ std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT,
}
//----------------------------------------------------------------------------
+time_t cmTimestamp::CreateUtcTimeTFromTm(struct tm &tm) const
+{
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+ return _mkgmtime(&tm);
+#else
+ // From Linux timegm() manpage.
+
+ std::string tz_old = "TZ=";
+ if (const char* tz = cmSystemTools::GetEnv("TZ"))
+ {
+ tz_old += tz;
+ }
+
+ // The standard says that "TZ=" or "TZ=[UNRECOGNIZED_TZ]" means UTC.
+ // It seems that "TZ=" does NOT work, at least under Windows
+ // with neither MSVC nor MinGW, so let's use explicit "TZ=UTC"
+
+ cmSystemTools::PutEnv("TZ=UTC");
+
+ tzset();
+
+ time_t result = mktime(&tm);
+
+ cmSystemTools::PutEnv(tz_old);
+
+ tzset();
+
+ return result;
+#endif
+}
+
+//----------------------------------------------------------------------------
std::string cmTimestamp::AddTimestampComponent(
- char flag, struct tm& timeStruct)
+ char flag, struct tm& timeStruct, const time_t timeT) const
{
std::string formatString = "%";
formatString += flag;
@@ -117,6 +151,26 @@ std::string cmTimestamp::AddTimestampComponent(
case 'y':
case 'Y':
break;
+ case 's': // Seconds since UNIX epoch (midnight 1-jan-1970)
+ {
+ // Build a time_t for UNIX epoch and substract from the input "timeT":
+ struct tm tmUnixEpoch;
+ memset(&tmUnixEpoch, 0, sizeof(tmUnixEpoch));
+ tmUnixEpoch.tm_mday = 1;
+ tmUnixEpoch.tm_year = 1970-1900;
+
+ const time_t unixEpoch = this->CreateUtcTimeTFromTm(tmUnixEpoch);
+ if (unixEpoch == -1)
+ {
+ cmSystemTools::Error("Error generating UNIX epoch in "
+ "STRING(TIMESTAMP ...). Please, file a bug report aginst CMake");
+ return std::string();
+ }
+
+ std::stringstream ss;
+ ss << static_cast<long int>(difftime(timeT, unixEpoch));
+ return ss.str();
+ }
default:
{
return formatString;
diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h
index 24c1869..7c4b216 100644
--- a/Source/cmTimestamp.h
+++ b/Source/cmTimestamp.h
@@ -16,7 +16,7 @@
#include <time.h>
/** \class cmTimestamp
- * \brief Utility class to generate sting representation of a timestamp
+ * \brief Utility class to generate string representation of a timestamp
*
*/
class cmTimestamp
@@ -30,10 +30,13 @@ public:
const std::string& formatString, bool utcFlag);
private:
- std::string CreateTimestampFromTimeT(time_t timeT,
- std::string formatString, bool utcFlag);
+ time_t CreateUtcTimeTFromTm(struct tm& timeStruct) const;
- std::string AddTimestampComponent(char flag, struct tm& timeStruct);
+ std::string CreateTimestampFromTimeT(
+ time_t timeT, std::string formatString, bool utcFlag) const;
+
+ std::string AddTimestampComponent(
+ char flag, struct tm& timeStruct, time_t timeT) const;
};