summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CPackRPM.cmake42
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx2
-rw-r--r--Source/cmFileCommand.cxx5
-rw-r--r--Source/cmGlobalGenerator.cxx11
-rw-r--r--Source/cmGlobalGenerator.h5
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx6
-rw-r--r--Source/cmGlobalNinjaGenerator.h2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h2
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmLocalGenerator.cxx17
-rw-r--r--Source/cmake.cxx7
-rw-r--r--Source/kwsys/Glob.cxx24
-rw-r--r--Source/kwsys/SystemTools.cxx58
-rw-r--r--Source/kwsys/SystemTools.hxx.in7
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in9
-rw-r--r--Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake50
-rw-r--r--Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Build.cmake5
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake16
29 files changed, 189 insertions, 104 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index cb987f8..fce8236 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -482,6 +482,7 @@ function(cpack_rpm_prepare_relocation_paths)
endif()
endforeach()
+ set(RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}" PARENT_SCOPE)
set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE)
endfunction()
@@ -964,24 +965,31 @@ set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
# CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list"
# which is passed to the find command that generates the content-list
if(CPACK_RPM_PACKAGE_RELOCATABLE)
- # get a list of the elements in CPACK_RPM_PACKAGE_PREFIX and remove
- # the final element (so the install-prefix dir itself is not omitted
+ # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are
+ # destinct parent paths of other relocation paths and remove the
+ # final element (so the install-prefix dir itself is not omitted
# from the RPM's content-list)
- foreach(CPACK_RPM_PACKAGE_PREFIX ${RPM_PACKAGE_PREFIXES})
- string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${CPACK_RPM_PACKAGE_PREFIX}")
- list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
- unset(_TMP_LIST)
- # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX
- foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
- list(APPEND _TMP_LIST "${_ELEM}")
- string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}")
- list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND)
- if(_DUPLICATE_FOUND EQUAL -1)
- set(_OMIT_DIR "-o -path ${_OMIT_DIR}")
- separate_arguments(_OMIT_DIR)
- list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR})
- endif()
- endforeach()
+ list(SORT RPM_USED_PACKAGE_PREFIXES)
+ set(_DISTINCT_PATH "NOT_SET")
+ foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES})
+ if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*")
+ set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}")
+
+ string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${_RPM_RELOCATION_PREFIX}")
+ list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
+ unset(_TMP_LIST)
+ # Now generate all of the parent dirs of the relocation path
+ foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
+ list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}")
+ string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}")
+ list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND)
+ if(_DUPLICATE_FOUND EQUAL -1)
+ set(_OMIT_DIR "-o -path ${_OMIT_DIR}")
+ separate_arguments(_OMIT_DIR)
+ list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR})
+ endif()
+ endforeach()
+ endif()
endforeach()
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index b64641a..8c01479 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 2)
-set(CMake_VERSION_PATCH 20150226)
+set(CMake_VERSION_PATCH 20150227)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 006239a..ee255af 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -664,7 +664,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram,
installProjectName, installDirectory,
globalGenerator->GetPreinstallTargetName(),
- buildConfig, false);
+ buildConfig, false, false);
std::string buildCommandStr =
cmSystemTools::PrintSingleCommand(buildCommand);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 4cdce71..0827037 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -310,7 +310,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
output, this->BuildMakeProgram,
config,
!this->BuildNoClean,
- false, remainingTime);
+ false, false, remainingTime);
out << output;
// if the build failed then return
if (retVal)
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 212603c..0290c92 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1903,7 +1903,10 @@ protected:
std::string Manifest;
void ManifestAppend(std::string const& file)
{
- this->Manifest += ";";
+ if (!this->Manifest.empty())
+ {
+ this->Manifest += ";";
+ }
this->Manifest += file.substr(this->DestDirLength);
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6147009..36395aa 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1677,14 +1677,14 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir,
mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
return this->Build(srcdir,bindir,projectName,
newTarget,
- output,"",config,false,fast,
+ output,"",config,false,fast,false,
this->TryCompileTimeout);
}
void cmGlobalGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, const std::string&,
const std::string&, const std::string&, const std::string&,
- const std::string&, bool,
+ const std::string&, bool, bool,
std::vector<std::string> const&)
{
makeCommand.push_back(
@@ -1697,7 +1697,7 @@ int cmGlobalGenerator::Build(
std::string& output,
const std::string& makeCommandCSTR,
const std::string& config,
- bool clean, bool fast,
+ bool clean, bool fast, bool verbose,
double timeout,
cmSystemTools::OutputOption outputflag,
std::vector<std::string> const& nativeOptions)
@@ -1722,7 +1722,7 @@ int cmGlobalGenerator::Build(
{
std::vector<std::string> cleanCommand;
this->GenerateBuildCommand(cleanCommand, makeCommandCSTR, projectName,
- bindir, "clean", config, fast);
+ bindir, "clean", config, fast, verbose);
output += "\nRun Clean Command:";
output += cmSystemTools::PrintSingleCommand(cleanCommand);
output += "\n";
@@ -1745,7 +1745,8 @@ int cmGlobalGenerator::Build(
// now build
std::vector<std::string> makeCommand;
this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName,
- bindir, target, config, fast, nativeOptions);
+ bindir, target, config, fast, verbose,
+ nativeOptions);
std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand);
output += "\nRun Build Command:";
output += makeCommandStr;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 08f061a..5b9ddee 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -134,7 +134,7 @@ public:
const std::string& projectName, const std::string& targetName,
std::string& output,
const std::string& makeProgram, const std::string& config,
- bool clean, bool fast,
+ bool clean, bool fast, bool verbose,
double timeout,
cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE,
std::vector<std::string> const& nativeOptions =
@@ -144,7 +144,8 @@ public:
std::vector<std::string>& makeCommand,
const std::string& makeProgram,
const std::string& projectName, const std::string& projectDir,
- const std::string& targetName, const std::string& config, bool fast,
+ const std::string& targetName, const std::string& config,
+ bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3c07be1..69b1a9d 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -574,12 +574,18 @@ void cmGlobalNinjaGenerator
const std::string& targetName,
const std::string& /*config*/,
bool /*fast*/,
+ bool verbose,
std::vector<std::string> const& makeOptions)
{
makeCommand.push_back(
this->SelectMakeProgram(makeProgram)
);
+ if(verbose)
+ {
+ makeCommand.push_back("-v");
+ }
+
makeCommand.insert(makeCommand.end(),
makeOptions.begin(), makeOptions.end());
if(!targetName.empty())
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 3d443d8..c7bb782 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -196,7 +196,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
- bool fast,
+ bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index e0ccaa9..1d2dd34 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -554,7 +554,7 @@ void cmGlobalUnixMakefileGenerator3
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& /*config*/,
- bool fast,
+ bool fast, bool /*verbose*/,
std::vector<std::string> const& makeOptions)
{
makeCommand.push_back(
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index c61c36e..50a901e 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -114,7 +114,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
- bool fast,
+ bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 531a714..7df2073 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -459,7 +459,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
- bool fast,
+ bool fast, bool verbose,
std::vector<std::string> const& makeOptions)
{
// Select the caller- or user-preferred make program, else MSBuild.
@@ -507,7 +507,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
// Use devenv to build solutions containing Intel Fortran projects.
cmGlobalVisualStudio7Generator::GenerateBuildCommand(
makeCommand, makeProgram, projectName, projectDir,
- targetName, config, fast, makeOptions);
+ targetName, config, fast, verbose, makeOptions);
return;
}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 3b0a5cf..92202ba 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -41,7 +41,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
- bool fast,
+ bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 455a7a2..62a308e 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -120,7 +120,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
- bool /*fast*/,
+ bool /*fast*/, bool /*verbose*/,
std::vector<std::string> const& makeOptions
)
{
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 58efb25..a59a0b2 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -59,7 +59,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
- bool fast,
+ bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 401e475..0e0e63a 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -191,7 +191,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
- bool /*fast*/,
+ bool /*fast*/, bool /*verbose*/,
std::vector<std::string> const& makeOptions)
{
// Select the caller- or user-preferred make program, else devenv.
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index b591653..d641c02 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -69,7 +69,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
- bool fast,
+ bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index aea134e..e89161d 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -310,7 +310,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
- bool /*fast*/,
+ bool /*fast*/, bool /*verbose*/,
std::vector<std::string> const& makeOptions)
{
// now build the test
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index f513e28..b272f6a 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -60,7 +60,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
- bool fast,
+ bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2accf47..42e943a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -535,17 +535,12 @@ void cmLocalGenerator::GenerateInstallRules()
"${CMAKE_INSTALL_COMPONENT}.txt\")\n"
"else()\n"
" set(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n"
- "endif()\n\n";
- fout
- << "file(WRITE \""
- << homedir << "/${CMAKE_INSTALL_MANIFEST}\" "
- << "\"\")" << std::endl;
- fout
- << "foreach(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl
- << " file(APPEND \""
- << homedir << "/${CMAKE_INSTALL_MANIFEST}\" "
- << "\"${file}\\n\")" << std::endl
- << "endforeach()" << std::endl;
+ "endif()\n"
+ "\n"
+ "string(REPLACE \";\" \"\\n\" CMAKE_INSTALL_MANIFEST_CONTENT\n"
+ " \"${CMAKE_INSTALL_MANIFEST_FILES}\")\n"
+ "file(WRITE \"" << homedir << "/${CMAKE_INSTALL_MANIFEST}\"\n"
+ " \"${CMAKE_INSTALL_MANIFEST_CONTENT}\")\n";
}
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 47be481..80e90a8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2789,11 +2789,16 @@ int cmake::Build(const std::string& dir,
return 1;
}
projName = it.GetValue();
+ bool verbose = false;
+ if(it.Find("CMAKE_VERBOSE_MAKEFILE"))
+ {
+ verbose = it.GetValueAsBool();
+ }
return gen->Build("", dir,
projName, target,
output,
"",
- config, clean, false, 0,
+ config, clean, false, verbose, 0,
cmSystemTools::OUTPUT_PASSTHROUGH,
nativeOptions);
}
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 5a96aed..1476c25 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -223,7 +223,6 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
return;
}
unsigned long cc;
- kwsys_stl::string fullname;
kwsys_stl::string realname;
kwsys_stl::string fname;
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
@@ -248,15 +247,6 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
fname = kwsys::SystemTools::LowerCase(fname);
#endif
- if ( start == 0 )
- {
- fullname = dir + fname;
- }
- else
- {
- fullname = dir + "/" + fname;
- }
-
bool isDir = kwsys::SystemTools::FileIsDirectory(realname);
bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname);
@@ -302,7 +292,6 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
return;
}
unsigned long cc;
- kwsys_stl::string fullname;
kwsys_stl::string realname;
kwsys_stl::string fname;
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
@@ -327,19 +316,10 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
fname = kwsys::SystemTools::LowerCase(fname);
#endif
- if ( start == 0 )
- {
- fullname = dir + fname;
- }
- else
- {
- fullname = dir + "/" + fname;
- }
-
//kwsys_ios::cout << "Look at file: " << fname << kwsys_ios::endl;
//kwsys_ios::cout << "Match: "
// << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl;
- //kwsys_ios::cout << "Full name: " << fullname << kwsys_ios::endl;
+ //kwsys_ios::cout << "Real name: " << realname << kwsys_ios::endl;
if ( !last &&
!kwsys::SystemTools::FileIsDirectory(realname) )
@@ -355,7 +335,7 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
}
else
{
- this->ProcessDirectory(start+1, realname + "/");
+ this->ProcessDirectory(start+1, realname);
}
}
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 2708211..bf6f458 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -250,17 +250,46 @@ inline int Chdir(const kwsys_stl::string& dir)
return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str());
#endif
}
-inline void Realpath(const kwsys_stl::string& path, kwsys_stl::string & resolved_path)
+inline void Realpath(const kwsys_stl::string& path,
+ kwsys_stl::string& resolved_path,
+ kwsys_stl::string* errorMessage = 0)
{
kwsys_stl::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path);
wchar_t *ptemp;
wchar_t fullpath[MAX_PATH];
- if( GetFullPathNameW(tmp.c_str(), sizeof(fullpath)/sizeof(fullpath[0]),
- fullpath, &ptemp) )
+ DWORD bufferLen = GetFullPathNameW(tmp.c_str(),
+ sizeof(fullpath) / sizeof(fullpath[0]),
+ fullpath, &ptemp);
+ if( bufferLen < sizeof(fullpath)/sizeof(fullpath[0]) )
{
resolved_path = KWSYS_NAMESPACE::Encoding::ToNarrow(fullpath);
KWSYS_NAMESPACE::SystemTools::ConvertToUnixSlashes(resolved_path);
}
+ else if(errorMessage)
+ {
+ if(bufferLen)
+ {
+ *errorMessage = "Destination path buffer size too small.";
+ }
+ else if(unsigned int errorId = GetLastError())
+ {
+ LPSTR message = NULL;
+ DWORD size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER
+ | FORMAT_MESSAGE_FROM_SYSTEM
+ | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, errorId,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPSTR)&message, 0, NULL);
+ *errorMessage = std::string(message, size);
+ LocalFree(message);
+ }
+ else
+ {
+ *errorMessage = "Unknown error.";
+ }
+
+ resolved_path = "";
+ }
else
{
resolved_path = path;
@@ -287,15 +316,31 @@ inline int Chdir(const kwsys_stl::string& dir)
{
return chdir(dir.c_str());
}
-inline void Realpath(const kwsys_stl::string& path, kwsys_stl::string & resolved_path)
+inline void Realpath(const kwsys_stl::string& path,
+ kwsys_stl::string& resolved_path,
+ kwsys_stl::string* errorMessage = 0)
{
char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
+ errno = 0;
char *ret = realpath(path.c_str(), resolved_name);
if(ret)
{
resolved_path = ret;
}
+ else if(errorMessage)
+ {
+ if(errno)
+ {
+ *errorMessage = strerror(errno);
+ }
+ else
+ {
+ *errorMessage = "Unknown error.";
+ }
+
+ resolved_path = "";
+ }
else
{
// if path resolution fails, return what was passed in
@@ -3046,10 +3091,11 @@ kwsys_stl::string SystemTools
return "";
}
-kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path)
+kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path,
+ kwsys_stl::string* errorMessage)
{
kwsys_stl::string ret;
- Realpath(path, ret);
+ Realpath(path, ret, errorMessage);
return ret;
}
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index beb2a7e..93cde02 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -385,9 +385,12 @@ public:
/**
* Get the real path for a given path, removing all symlinks. In
* the event of an error (non-existent path, permissions issue,
- * etc.) the original path is returned.
+ * etc.) the original path is returned if errorMessage pointer is
+ * NULL. Otherwise empty string is returned and errorMessage
+ * contains error description.
*/
- static kwsys_stl::string GetRealPath(const kwsys_stl::string& path);
+ static kwsys_stl::string GetRealPath(const kwsys_stl::string& path,
+ kwsys_stl::string* errorMessage = 0);
/**
* Split a path name into its root component and the rest of the
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
index 4119b8d..e4780d3 100644
--- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
@@ -6,9 +6,14 @@ if(CPACK_GENERATOR MATCHES "ZIP")
endif()
if(CPACK_GENERATOR MATCHES "RPM")
- set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
-
set(CPACK_RPM_COMPONENT_INSTALL "ON")
+
+ # test that /usr and /usr/foo get omitted in relocatable
+ # rpms as shortest relocation path is treated as base of
+ # package (/usr/foo/bar is relocatable and must exist)
+ set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/foo/bar")
+
+ # test requires
set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries")
# test a "noarch" rpm
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
index f06605a..c7ec709 100644
--- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -145,7 +145,7 @@ if(CPackGen MATCHES "RPM")
# CMAKE_SIZEOF_VOID_P is not set here but lib is prefix of lib64 so
# relocation path test won't fail on OSes with lib64 library location
include(GNUInstallDirs)
- set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+ set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/foo/bar")
foreach(check_file ${expected_file})
string(REGEX MATCH ".*libraries.*" check_file_libraries_match ${check_file})
@@ -158,34 +158,52 @@ if(CPackGen MATCHES "RPM")
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${check_file}
+ OUTPUT_VARIABLE check_package_content
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
if(check_file_libraries_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*")
set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_applications_PACKAGE_ARCHITECTURE}")
set(spec_regex "*libraries*")
+ set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$")
elseif(check_file_headers_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*")
set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_libraries_PACKAGE_ARCHITECTURE}")
set(spec_regex "*headers*")
+ set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/include\n/usr/foo/bar/include/mylib.h$")
elseif(check_file_applications_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*")
set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_headers_PACKAGE_ARCHITECTURE}")
set(spec_regex "*applications*")
+ set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$")
elseif(check_file_Unspecified_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*DESCRIPTION.*")
set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_Unspecified_PACKAGE_ARCHITECTURE}")
set(spec_regex "*Unspecified*")
+ set(check_content_list "^/usr/foo/bar
+/usr/foo/bar/bin
+/usr/foo/bar/bin/@in@_@path@@with
+/usr/foo/bar/bin/@in@_@path@@with/@and
+/usr/foo/bar/bin/@in@_@path@@with/@and/@
+/usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@
+/usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@/mylibapp2$")
else()
message(FATAL_ERROR "error: unexpected rpm package '${check_file}'")
endif()
+ #######################
+ # test package info
+ #######################
string(REGEX MATCH ${check_file_match_expected_summary} check_file_match_summary ${check_file_content})
if(NOT check_file_match_summary)
@@ -209,33 +227,25 @@ if(CPackGen MATCHES "RPM")
message(FATAL_ERROR "error: '${check_file}' rpm package relocation path does not match expected value - regex '${check_file_match_expected_relocation_path}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'")
endif()
+
string(REGEX MATCH ${check_file_match_expected_architecture} check_file_match_architecture ${check_file_content})
if (NOT check_file_match_architecture)
message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'")
endif()
- endforeach()
-
- # test package content
- foreach(check_file ${expected_file})
- string(REGEX MATCH ".*Unspecified.*" check_file_Unspecified_match ${check_file})
-
- if(check_file_Unspecified_match)
- execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${check_file}
- OUTPUT_VARIABLE check_file_content
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX MATCH ".*bin/@in@_@path@@with/@and/@/@in_path@/mylibapp2$" check_at_in_path ${check_file_content})
+ #######################
+ # test package content
+ #######################
+ string(REGEX MATCH "${check_content_list}" expected_content_list "${check_package_content}")
- if(NOT check_at_in_path)
- file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*Unspecified*.spec")
-
- if(spec_file)
- file(READ ${spec_file} spec_file_content)
- endif()
+ if(NOT expected_content_list)
+ file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/${spec_regex}.spec")
- message(FATAL_ERROR "error: '${check_file}' rpm package path with @ characters is missing or invalid. RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'")
+ if(spec_file)
+ file(READ ${spec_file} spec_file_content)
endif()
+
+ message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'")
endif()
endforeach()
endif()
diff --git a/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt b/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt
new file mode 100644
index 0000000..83c62ec
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt
@@ -0,0 +1 @@
+-E echo CustomCommand
diff --git a/Tests/RunCMake/CommandLine/Build.cmake b/Tests/RunCMake/CommandLine/Build.cmake
new file mode 100644
index 0000000..20df108
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Build.cmake
@@ -0,0 +1,5 @@
+add_custom_command(
+ OUTPUT output.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+ )
+add_custom_target(CustomTarget ALL DEPENDS output.txt)
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 2be6651..a9c49e7 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -18,6 +18,22 @@ run_cmake_command(build-no-generator
run_cmake_command(build-bad-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator)
+if(RunCMake_GENERATOR STREQUAL "Ninja")
+ # Use a single build tree for a few tests without cleaning.
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1)
+ run_cmake(Build)
+ unset(RunCMake_TEST_OPTIONS)
+ run_cmake_command(Build-ninja-v ${CMAKE_COMMAND} --build .)
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endif()
+
if(UNIX)
run_cmake_command(E_create_symlink-missing-dir
${CMAKE_COMMAND} -E create_symlink T missing-dir/L