summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCacheManager.cxx10
-rw-r--r--Source/cmGlobalGenerator.cxx2
-rw-r--r--Source/cmInstallTargetGenerator.cxx16
-rw-r--r--Source/cmSystemTools.cxx102
-rw-r--r--Source/cmSystemTools.h4
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx7
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx15
-rw-r--r--Source/cmcmd.cxx11
9 files changed, 92 insertions, 77 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 17ed248..06c5a99 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 4)
-set(CMake_VERSION_PATCH 20160115)
+set(CMake_VERSION_PATCH 20160121)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index ce8af55..7466c29 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -64,12 +64,14 @@ bool cmCacheManager::LoadCache(const std::string& path,
const char *realbuffer;
std::string buffer;
std::string entryKey;
+ unsigned int lineno = 0;
while(fin)
{
// Format is key:type=value
std::string helpString;
CacheEntry e;
cmSystemTools::GetLineFromStream(fin, buffer);
+ lineno++;
realbuffer = buffer.c_str();
while(*realbuffer != '0' &&
(*realbuffer == ' ' ||
@@ -77,6 +79,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
*realbuffer == '\r' ||
*realbuffer == '\n'))
{
+ if (*realbuffer == '\n') lineno++;
realbuffer++;
}
// skip blank lines and comment lines
@@ -96,6 +99,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
helpString += &realbuffer[2];
}
cmSystemTools::GetLineFromStream(fin, buffer);
+ lineno++;
realbuffer = buffer.c_str();
if(!fin)
{
@@ -138,8 +142,10 @@ bool cmCacheManager::LoadCache(const std::string& path,
}
else
{
- cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str(),
- ". Offending entry: ", realbuffer);
+ std::ostringstream error;
+ error << "Parse error in cache file " << cacheFile;
+ error << " on line " << lineno << ". Offending entry: " << realbuffer;
+ cmSystemTools::Error(error.str().c_str());
}
}
this->CacheMajorVersion = 0;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index b9296c1..d7bec44 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1850,7 +1850,7 @@ int cmGlobalGenerator::Build(
!makeCommand.empty() && cmSystemTools::LowerCase(
cmSystemTools::GetFilenameName(makeCommand[0])) == "vcexpress.exe")
{
- outputflag = cmSystemTools::OUTPUT_NORMAL;
+ outputflag = cmSystemTools::OUTPUT_FORWARD;
}
// should we do a clean first?
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 1158a27..5e88fa2 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -791,18 +791,10 @@ cmInstallTargetGenerator
}
// Write a rule to run chrpath to set the install-tree RPATH
- if(newRpath.empty())
- {
- os << indent << "file(RPATH_REMOVE\n"
- << indent << " FILE \"" << toDestDirPath << "\")\n";
- }
- else
- {
- os << indent << "file(RPATH_CHANGE\n"
- << indent << " FILE \"" << toDestDirPath << "\"\n"
- << indent << " OLD_RPATH \"" << oldRpath << "\"\n"
- << indent << " NEW_RPATH \"" << newRpath << "\")\n";
- }
+ os << indent << "file(RPATH_CHANGE\n"
+ << indent << " FILE \"" << toDestDirPath << "\"\n"
+ << indent << " OLD_RPATH \"" << oldRpath << "\"\n"
+ << indent << " NEW_RPATH \"" << newRpath << "\")\n";
}
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 008272c..3ba7287 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -17,6 +17,7 @@
#include <time.h>
#include <string.h>
#include <stdlib.h>
+#include <assert.h>
#ifdef __QNX__
# include <malloc.h> /* for malloc/free on QNX */
#endif
@@ -660,14 +661,6 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string>const& command,
argv.push_back(a->c_str());
}
argv.push_back(0);
- if ( captureStdOut )
- {
- *captureStdOut = "";
- }
- if (captureStdErr && captureStdErr != captureStdOut)
- {
- *captureStdErr = "";
- }
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*argv.begin());
@@ -681,7 +674,16 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string>const& command,
{
cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1);
cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
+ captureStdOut = 0;
+ captureStdErr = 0;
}
+ else if (outputflag == OUTPUT_MERGE ||
+ (captureStdErr && captureStdErr == captureStdOut))
+ {
+ cmsysProcess_SetOption(cp, cmsysProcess_Option_MergeOutput, 1);
+ captureStdErr = 0;
+ }
+ assert(!captureStdErr || captureStdErr != captureStdOut);
cmsysProcess_SetTimeout(cp, timeout);
cmsysProcess_Execute(cp);
@@ -696,65 +698,50 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string>const& command,
{
while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0)
{
- if(captureStdOut || captureStdErr || outputflag != OUTPUT_NONE)
+ // Translate NULL characters in the output into valid text.
+ // Visual Studio 7 puts these characters in the output of its
+ // build process.
+ for(int i=0; i < length; ++i)
{
- // Translate NULL characters in the output into valid text.
- // Visual Studio 7 puts these characters in the output of its
- // build process.
- for(int i=0; i < length; ++i)
+ if(data[i] == '\0')
{
- if(data[i] == '\0')
- {
- data[i] = ' ';
- }
+ data[i] = ' ';
}
}
- if(pipe == cmsysProcess_Pipe_STDOUT ||
- (pipe == cmsysProcess_Pipe_STDERR &&
- captureStdOut == captureStdErr))
+
+ if (pipe == cmsysProcess_Pipe_STDOUT)
{
- if (captureStdOut)
+ if (outputflag != OUTPUT_NONE)
{
- tempStdOut.insert(tempStdOut.end(), data, data+length);
+ cmSystemTools::Stdout(data, length);
}
- }
- else if(pipe == cmsysProcess_Pipe_STDERR)
- {
- if (captureStdErr)
+ if (captureStdOut)
{
- tempStdErr.insert(tempStdErr.end(), data, data+length);
+ tempStdOut.insert(tempStdOut.end(), data, data+length);
}
}
- if(outputflag != OUTPUT_NONE)
+ else if (pipe == cmsysProcess_Pipe_STDERR)
{
- if(outputflag == OUTPUT_MERGE)
+ if (outputflag != OUTPUT_NONE)
{
- cmSystemTools::Stdout(data, length);
+ cmSystemTools::Stderr(data, length);
}
- else
+ if (captureStdErr)
{
- if(pipe == cmsysProcess_Pipe_STDERR)
- {
- cmSystemTools::Stderr(data, length);
- }
- else if(pipe == cmsysProcess_Pipe_STDOUT)
- {
- cmSystemTools::Stdout(data, length);
- }
+ tempStdErr.insert(tempStdErr.end(), data, data+length);
}
}
}
}
cmsysProcess_WaitForExit(cp, 0);
- if ( captureStdOut && tempStdOut.begin() != tempStdOut.end())
+ if (captureStdOut)
{
- captureStdOut->append(&*tempStdOut.begin(), tempStdOut.size());
+ captureStdOut->assign(tempStdOut.begin(), tempStdOut.end());
}
- if ( captureStdErr && captureStdErr != captureStdOut &&
- tempStdErr.begin() != tempStdErr.end())
+ if (captureStdErr)
{
- captureStdErr->append(&*tempStdErr.begin(), tempStdErr.size());
+ captureStdErr->assign(tempStdErr.begin(), tempStdErr.end());
}
bool result = true;
@@ -2565,6 +2552,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
*changed = false;
}
int rp_count = 0;
+ bool remove_rpath = true;
cmSystemToolsRPathInfo rp[2];
{
// Parse the ELF binary.
@@ -2622,6 +2610,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
// If it contains the new rpath instead then it is okay.
if(cmSystemToolsFindRPath(se[i]->Value, newRPath) != std::string::npos)
{
+ remove_rpath = false;
continue;
}
if(emsg)
@@ -2642,13 +2631,30 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
rp[rp_count].Size = se[i]->Size;
rp[rp_count].Name = se_name[i];
+ std::string::size_type prefix_len = pos;
+
+ // If oldRPath was at the end of the file's RPath, and newRPath is empty,
+ // we should remove the unnecessary ':' at the end.
+ if (newRPath.empty() &&
+ pos > 0 &&
+ se[i]->Value[pos - 1] == ':' &&
+ pos + oldRPath.length() == se[i]->Value.length())
+ {
+ prefix_len--;
+ }
+
// Construct the new value which preserves the part of the path
// not being changed.
- rp[rp_count].Value = se[i]->Value.substr(0, pos);
+ rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
rp[rp_count].Value += newRPath;
rp[rp_count].Value += se[i]->Value.substr(pos+oldRPath.length(),
oldRPath.npos);
+ if (!rp[rp_count].Value.empty())
+ {
+ remove_rpath = false;
+ }
+
// Make sure there is enough room to store the new rpath and at
// least one null terminator.
if(rp[rp_count].Size < rp[rp_count].Value.length()+1)
@@ -2673,6 +2679,12 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
return true;
}
+ // If the resulting rpath is empty, just remove the entire entry instead.
+ if (remove_rpath)
+ {
+ return cmSystemTools::RemoveRPath(file, emsg, changed);
+ }
+
{
// Open the file for update.
cmsys::ofstream f(file.c_str(),
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 9cafbec..f511ae4 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -203,7 +203,7 @@ public:
* Output is controlled with outputflag. If outputflag is OUTPUT_NONE, no
* user-viewable output from the program being run will be generated.
* OUTPUT_MERGE is the legacy behaviour where stdout and stderr are merged
- * into stdout. OUTPUT_NORMAL passes through the output to stdout/stderr as
+ * into stdout. OUTPUT_FORWARD copies the output to stdout/stderr as
* it was received. OUTPUT_PASSTHROUGH passes through the original handles.
*
* If timeout is specified, the command will be terminated after
@@ -223,7 +223,7 @@ public:
{
OUTPUT_NONE = 0,
OUTPUT_MERGE,
- OUTPUT_NORMAL,
+ OUTPUT_FORWARD,
OUTPUT_PASSTHROUGH
};
static bool RunSingleCommand(const char* command,
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 435346a..5f3246a 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -432,8 +432,11 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
{
std::string configLib = this->Target
->GetDebugGeneratorExpressions(lib, llt);
- if (cmGeneratorExpression::IsValidTargetName(lib)
- || cmGeneratorExpression::Find(lib) != std::string::npos)
+ if (cmGeneratorExpression::IsValidTargetName(configLib))
+ {
+ configLib = "$<LINK_ONLY:$<TARGET_NAME:" + configLib + ">>";
+ }
+ else if (cmGeneratorExpression::Find(configLib) != std::string::npos)
{
configLib = "$<LINK_ONLY:" + configLib + ">";
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 27ae685..09d4a90 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -762,13 +762,16 @@ void cmVisualStudio10TargetGenerator
std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
std::string useOfMfcValue = "false";
- if(mfcFlagValue == "1")
- {
- useOfMfcValue = "Static";
- }
- else if(mfcFlagValue == "2")
+ if(this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY)
{
- useOfMfcValue = "Dynamic";
+ if(mfcFlagValue == "1")
+ {
+ useOfMfcValue = "Static";
+ }
+ else if(mfcFlagValue == "2")
+ {
+ useOfMfcValue = "Dynamic";
+ }
}
std::string mfcLine = "<UseOfMfc>";
mfcLine += useOfMfcValue + "</UseOfMfc>\n";
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index fb7b1f5..1dc304c 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -361,11 +361,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Now run the real compiler command and return its result value.
- if(!cmSystemTools::RunSingleCommand(orig_cmd, 0, &stdErr, &ret, 0,
+ if(!cmSystemTools::RunSingleCommand(orig_cmd, 0, 0, &ret, 0,
cmSystemTools::OUTPUT_PASSTHROUGH))
{
- std::cerr << "Error running '" << orig_cmd[0] << "': "
- << stdErr << "\n";
+ std::cerr << "Error running '" << orig_cmd[0] << "'\n";
return 1;
}
return ret;
@@ -555,7 +554,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Clock command
else if (args[1] == "time" && args.size() > 2)
{
- std::string command = cmJoin(cmMakeRange(args).advance(2), " ");
+ std::vector<std::string> command(args.begin()+2, args.end());
clock_t clock_start, clock_finish;
time_t time_start, time_finish;
@@ -563,7 +562,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
time(&time_start);
clock_start = clock();
int ret =0;
- cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &ret);
+ cmSystemTools::RunSingleCommand(command, 0, 0, &ret);
clock_finish = clock();
time(&time_finish);
@@ -621,7 +620,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
int retval = 0;
int timeout = 0;
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &retval,
- directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) )
+ directory.c_str(), cmSystemTools::OUTPUT_PASSTHROUGH, timeout) )
{
return retval;
}