Merge branch 'UseSWIG-fix-CMP0054-warnings' into release
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 7516393..e3f74d8 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -481,6 +481,7 @@
endif()
endforeach()
+ set(RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}" PARENT_SCOPE)
set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE)
endfunction()
@@ -945,24 +946,31 @@
# 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 0ab2a58..006e65a 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,4 +2,4 @@
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 2)
set(CMake_VERSION_PATCH 0)
-set(CMake_VERSION_RC 2)
+#set(CMake_VERSION_RC 0)
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index fa7f486..6876388 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -100,6 +100,13 @@
{
/* Ignore legacy option. */
}
+ else if(args[i] == "NEWLINE_STYLE" ||
+ args[i] == "LF" || args[i] == "UNIX" ||
+ args[i] == "CRLF" || args[i] == "WIN32" ||
+ args[i] == "DOS")
+ {
+ /* Options handled by NewLineStyle member above. */
+ }
else
{
unknown_args += " ";
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 579e715..d994659 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1907,7 +1907,10 @@
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/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 950d440..6c20952 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -49,7 +49,6 @@
lg->SetUnixCD(false);
lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true);
- lg->SetNoMultiOutputMultiDepRules(true);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 64f9cee..a67a649 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -93,11 +93,6 @@
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
-#ifdef CMAKE_ENCODING_UTF8
- // Add UTF-8 BOM for .sln file to indicate encoding
- const unsigned char utf8_bom[3] = {0xEF,0xBB,0xBF};
- fout.write(reinterpret_cast<const char*>(utf8_bom), 3);
-#endif
// Write out the header for a SLN file
this->WriteSLNHeader(fout);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 0eb7d2c..401e475 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -558,11 +558,6 @@
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
-#ifdef CMAKE_ENCODING_UTF8
- // Add UTF-8 BOM for .sln file to indicate encoding
- const unsigned char utf8_bom[3] = {0xEF,0xBB,0xBF};
- fout.write(reinterpret_cast<const char*>(utf8_bom), 3);
-#endif
// Write out the header for a SLN file
this->WriteSLNHeader(fout);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7ca7684..dd4a8f8 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -535,17 +535,12 @@
"${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";
}
}
@@ -2270,7 +2265,14 @@
std::vector<std::string>::const_iterator stdIt =
std::find(stds.begin(), stds.end(), standard);
- assert(stdIt != stds.end());
+ if (stdIt == stds.end())
+ {
+ std::string e =
+ lang + "_STANDARD is set to invalid value '" + standard + "'";
+ this->GetGlobalGenerator()->GetCMakeInstance()
+ ->IssueMessage(cmake::FATAL_ERROR, e, target->GetBacktrace());
+ return;
+ }
std::vector<std::string>::const_iterator defaultStdIt =
std::find(stds.begin(), stds.end(), defaultStd);
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 3a9d5be..d64ae0f 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -130,7 +130,7 @@
std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote);
///! set/get the parent generator
- cmLocalGenerator* GetParent(){return this->Parent;}
+ cmLocalGenerator* GetParent() const {return this->Parent;}
void SetParent(cmLocalGenerator* g) { this->Parent = g; g->AddChild(this); }
///! set/get the children
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 413dc0f..640c1b3 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -182,8 +182,7 @@
bool cmLocalNinjaGenerator::isRootMakefile() const
{
- return (strcmp(this->Makefile->GetCurrentDirectory(),
- this->GetCMakeInstance()->GetHomeDirectory()) == 0);
+ return !this->GetParent();
}
void cmLocalNinjaGenerator::WriteBuildFileTop()
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index dfa6cc9..9213ad6 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -92,7 +92,6 @@
this->SkipAssemblySourceRules = false;
this->MakeCommandEscapeTargetTwice = false;
this->BorlandMakeCurlyHack = false;
- this->NoMultiOutputMultiDepRules = false;
}
//----------------------------------------------------------------------------
@@ -600,7 +599,6 @@
return this->HomeRelativeOutputPath;
}
-
//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3
@@ -619,30 +617,6 @@
comment);
return;
}
- std::vector<std::string> outputs(1, target);
- this->WriteMakeRule(os, comment,
- outputs, depends, commands,
- symbolic, in_help);
-}
-
-//----------------------------------------------------------------------------
-void
-cmLocalUnixMakefileGenerator3
-::WriteMakeRule(std::ostream& os,
- const char* comment,
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& depends,
- const std::vector<std::string>& commands,
- bool symbolic,
- bool in_help)
-{
- // Make sure there is an output.
- if(outputs.empty())
- {
- cmSystemTools::Error("No outputs for WriteMakeRule! called with comment: ",
- comment);
- return;
- }
std::string replace;
@@ -661,17 +635,7 @@
}
// Construct the left hand side of the rule.
- std::string tgt;
- {
- const char* sep = "";
- for (std::vector<std::string>::const_iterator i = outputs.begin();
- i != outputs.end(); ++i)
- {
- tgt += sep;
- tgt += this->Convert(*i,HOME_OUTPUT,MAKERULE);
- sep = " ";
- }
- }
+ std::string tgt = this->Convert(target, HOME_OUTPUT, MAKERULE);
const char* space = "";
if(tgt.size() == 1)
@@ -697,19 +661,6 @@
// No dependencies. The commands will always run.
os << cmMakeSafe(tgt) << space << ":\n";
}
- else if(this->NoMultiOutputMultiDepRules && outputs.size() >= 2)
- {
- // Borland make does not understand multiple dependency rules when
- // there are multiple outputs, so write them all on one line.
- os << cmMakeSafe(tgt) << space << ":";
- for(std::vector<std::string>::const_iterator dep = depends.begin();
- dep != depends.end(); ++dep)
- {
- replace = this->Convert(*dep, HOME_OUTPUT, MAKERULE);
- os << " " << cmMakeSafe(replace);
- }
- os << "\n";
- }
else
{
// Split dependencies into multiple rule lines. This allows for
@@ -738,8 +689,7 @@
// Add the output to the local help if requested.
if(in_help)
{
- this->LocalHelp.insert(this->LocalHelp.end(),
- outputs.begin(), outputs.end());
+ this->LocalHelp.push_back(target);
}
}
@@ -1758,8 +1708,6 @@
//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
{
- // Nothing populates multiple output pairs anymore, but we need to
- // honor it when working in a build tree generated by an older CMake.
cmMakefile* mf = this->Makefile;
// Get the string listing the multiple output pairs.
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 7c8e27f..4f2e4a0 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -61,13 +61,6 @@
const std::vector<std::string>& commands,
bool symbolic,
bool in_help = false);
- void WriteMakeRule(std::ostream& os,
- const char* comment,
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& depends,
- const std::vector<std::string>& commands,
- bool symbolic,
- bool in_help = false);
// write the main variables used by the makefiles
void WriteMakeVariables(std::ostream& makefileStream);
@@ -161,9 +154,6 @@
void SetBorlandMakeCurlyHack(bool b)
{ this->BorlandMakeCurlyHack = b; }
- void SetNoMultiOutputMultiDepRules(bool b)
- { this->NoMultiOutputMultiDepRules = b; }
-
// used in writing out Cmake files such as WriteDirectoryInformation
static void WriteCMakeArgument(std::ostream& os, const char* s);
@@ -348,7 +338,6 @@
bool PassMakeflags;
bool MakeCommandEscapeTargetTwice;
bool BorlandMakeCurlyHack;
- bool NoMultiOutputMultiDepRules;
//==========================================================================
std::string HomeRelativeOutputPath;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index cdda36c..e55f651 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -765,9 +765,8 @@
}
// Write the build rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
- outputs, depends, commands, false);
-
+ this->WriteMakeRule(*this->BuildFileStream, 0, outputs,
+ depends, commands, false);
// Write the main driver rule to build everything in this target.
this->WriteTargetDriverRule(targetFullPath, relink);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 7ed0c10..4ece016 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -766,8 +766,8 @@
}
// Write the rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
- outputs, depends, commands, false);
+ this->WriteMakeRule(*this->BuildFileStream, 0, outputs,
+ depends, commands, false);
bool do_preprocess_rules = lang_has_preprocessor &&
this->LocalGenerator->GetCreatePreprocessedSourceRules();
@@ -988,6 +988,57 @@
depends, commands, true);
}
+//----------------------------------------------------------------------------
+void cmMakefileTargetGenerator::WriteMakeRule(
+ std::ostream& os,
+ const char* comment,
+ const std::vector<std::string>& outputs,
+ const std::vector<std::string>& depends,
+ const std::vector<std::string>& commands,
+ bool symbolic,
+ bool in_help)
+{
+ if (outputs.size() == 0)
+ {
+ return;
+ }
+
+ // We always attach the actual commands to the first output.
+ this->LocalGenerator->WriteMakeRule(os, comment, outputs[0], depends,
+ commands, symbolic, in_help);
+
+ // For single outputs, we are done.
+ if (outputs.size() == 1)
+ {
+ return;
+ }
+
+ // For multiple outputs, make the extra ones depend on the first one.
+ std::vector<std::string> const output_depends(1, outputs[0]);
+ for (std::vector<std::string>::const_iterator o = outputs.begin()+1;
+ o != outputs.end(); ++o)
+ {
+ // Touch the extra output so "make" knows that it was updated,
+ // but only if the output was acually created.
+ std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT,
+ cmLocalGenerator::SHELL);
+ std::vector<std::string> output_commands;
+ if (!symbolic)
+ {
+ output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out);
+ }
+ this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends,
+ output_commands, symbolic, in_help);
+
+ if (!symbolic)
+ {
+ // At build time, remove the first output if this one does not exist
+ // so that "make" will rerun the real commands that create this one.
+ MultipleOutputPairsType::value_type p(*o, outputs[0]);
+ this->MultipleOutputPairs.insert(p);
+ }
+ }
+}
//----------------------------------------------------------------------------
void cmMakefileTargetGenerator::WriteTargetDependRules()
@@ -1008,6 +1059,25 @@
this->LocalGenerator->
WriteDependLanguageInfo(*this->InfoFileStream,*this->Target);
+ // Store multiple output pairs in the depend info file.
+ if(!this->MultipleOutputPairs.empty())
+ {
+ *this->InfoFileStream
+ << "\n"
+ << "# Pairs of files generated by the same build rule.\n"
+ << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
+ for(MultipleOutputPairsType::const_iterator pi =
+ this->MultipleOutputPairs.begin();
+ pi != this->MultipleOutputPairs.end(); ++pi)
+ {
+ *this->InfoFileStream
+ << " " << this->LocalGenerator->EscapeForCMake(pi->first)
+ << " " << this->LocalGenerator->EscapeForCMake(pi->second)
+ << "\n";
+ }
+ *this->InfoFileStream << " )\n\n";
+ }
+
// Store list of targets linked directly or transitively.
{
*this->InfoFileStream
@@ -1234,9 +1304,8 @@
symbolic = sf->GetPropertyAsBool("SYMBOLIC");
}
}
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
- outputs, depends, commands,
- symbolic);
+ this->WriteMakeRule(*this->BuildFileStream, 0, outputs,
+ depends, commands, symbolic);
// If the rule has changed make sure the output is rebuilt.
if(!symbolic)
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index e31e086..f62c51d 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -222,6 +222,16 @@
// Set of extra output files to be driven by the build.
std::set<std::string> ExtraFiles;
+ typedef std::map<std::string, std::string> MultipleOutputPairsType;
+ MultipleOutputPairsType MultipleOutputPairs;
+ void WriteMakeRule(std::ostream& os,
+ const char* comment,
+ const std::vector<std::string>& outputs,
+ const std::vector<std::string>& depends,
+ const std::vector<std::string>& commands,
+ bool symbolic,
+ bool in_help = false);
+
// Target name info.
std::string TargetNameOut;
std::string TargetNameSO;
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 2708211..b03e7b0 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2330,6 +2330,10 @@
{
fout.write(buffer, fin.gcount());
}
+ else
+ {
+ break;
+ }
}
// Make sure the operating system has finished writing the file
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index ce36830..d5524c3 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -19,7 +19,6 @@
AddCMakeTest(Version "")
AddCMakeTest(Message "")
AddCMakeTest(File "")
-AddCMakeTest(ConfigureFile "")
AddCMakeTest(SeparateArguments "")
AddCMakeTest(ImplicitLinkInfo "")
AddCMakeTest(ModuleNotices "")
diff --git a/Tests/CMakeTests/ConfigureFile-DirOutput.cmake b/Tests/CMakeTests/ConfigureFile-DirOutput.cmake
deleted file mode 100644
index d682a2d..0000000
--- a/Tests/CMakeTests/ConfigureFile-DirOutput.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-DirOutput.txt "DirOutput test file\n")
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-DirOutput)
-configure_file(ConfigureFile-DirOutput.txt ConfigureFile-DirOutput)
-file(READ ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-DirOutput/ConfigureFile-DirOutput.txt out)
-message("${out}")
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake
deleted file mode 100644
index 3b09eb0..0000000
--- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
-file(WRITE ${file_name} "Data\n")
-configure_file(${file_name} ${file_name}.out COPYONLY NEWLINE_STYLE DOS)
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake
deleted file mode 100644
index 133a67a..0000000
--- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
-file(WRITE ${file_name} "Data\n")
-configure_file(${file_name} ${file_name}.out NEWLINE_STYLE)
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake
deleted file mode 100644
index e8887c1..0000000
--- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
-file(WRITE ${file_name} "Data\n")
-configure_file(${file_name} ${file_name}.out NEWLINE_STYLE FOO)
diff --git a/Tests/CMakeTests/ConfigureFile-Relative.cmake b/Tests/CMakeTests/ConfigureFile-Relative.cmake
deleted file mode 100644
index 532580a..0000000
--- a/Tests/CMakeTests/ConfigureFile-Relative.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-Relative-In.txt "Relative test file\n")
-configure_file(ConfigureFile-Relative-In.txt ConfigureFile-Relative-Out.txt)
-file(READ ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-Relative-Out.txt out)
-message("${out}")
diff --git a/Tests/CMakeTests/ConfigureFileTest.cmake.in b/Tests/CMakeTests/ConfigureFileTest.cmake.in
deleted file mode 100644
index 6cc61d9..0000000
--- a/Tests/CMakeTests/ConfigureFileTest.cmake.in
+++ /dev/null
@@ -1,28 +0,0 @@
-set(DirInput-RESULT 1)
-set(DirInput-STDERR "is a directory")
-set(DirOutput-RESULT 0)
-set(DirOutput-STDERR "DirOutput test file")
-set(Relative-RESULT 0)
-set(Relative-STDERR "Relative test file")
-set(BadArg-RESULT 1)
-set(BadArg-STDERR "called with incorrect number of arguments")
-set(NewLineStyle-NoArg-RESULT 1)
-set(NewLineStyle-NoArg-STDERR "NEWLINE_STYLE must set a style:")
-set(NewLineStyle-WrongArg-RESULT 1)
-set(NewLineStyle-WrongArg-STDERR "NEWLINE_STYLE sets an unknown style")
-set(NewLineStyle-ValidArg-RESULT 0)
-set(NewLineStyle-ValidArg-STDERR )
-set(NewLineStyle-COPYONLY-RESULT 1)
-set(NewLineStyle-COPYONLY-STDERR "COPYONLY could not be used in combination")
-
-include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
-check_cmake_test(ConfigureFile
- DirInput
- DirOutput
- Relative
- BadArg
- NewLineStyle-NoArg
- NewLineStyle-WrongArg
- NewLineStyle-ValidArg
- NewLineStyle-COPYONLY
- )
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
index de0ee46..e20f11a 100644
--- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
@@ -6,9 +6,14 @@
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 package summary override
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
index 68d846f..69af374 100644
--- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -144,7 +144,7 @@
# 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})
@@ -157,30 +157,44 @@
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(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(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(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(spec_regex "*Unspecified*")
+ set(check_content_list "^/usr/foo/bar
+/usr/foo/bar/bin
+/usr/foo/bar/bin/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)
@@ -204,6 +218,21 @@
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()
+
+ #######################
+ # test package content
+ #######################
+ string(REGEX MATCH "${check_content_list}" expected_content_list "${check_package_content}")
+
+ if(NOT expected_content_list)
+ file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/${spec_regex}.spec")
+
+ 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()
elseif(${CPackComponentWay} STREQUAL "IgnoreGroup")
endif()
diff --git a/Tests/RunCMake/CompileFeatures/NotAStandard-result.txt b/Tests/RunCMake/CompileFeatures/NotAStandard-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAStandard-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt
new file mode 100644
index 0000000..deab12f
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NotAStandard.cmake:[0-9]+ \(add_library\):
+ CXX_STANDARD is set to invalid value 'bad'
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CompileFeatures/NotAStandard.cmake b/Tests/RunCMake/CompileFeatures/NotAStandard.cmake
new file mode 100644
index 0000000..11529d8
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAStandard.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_CXX_STANDARD bad)
+add_library(somelib STATIC empty.cpp)
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index 833a315..c1b2227 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -43,6 +43,8 @@
endif()
if(CXX_STANDARD_DEFAULT)
+ run_cmake(NotAStandard)
+
foreach(standard 98 11)
file(READ
"${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt"
diff --git a/Tests/RunCMake/configure_file/BadArg-result.txt b/Tests/RunCMake/configure_file/BadArg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/configure_file/BadArg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/configure_file/BadArg-stderr.txt b/Tests/RunCMake/configure_file/BadArg-stderr.txt
new file mode 100644
index 0000000..4567d3f
--- /dev/null
+++ b/Tests/RunCMake/configure_file/BadArg-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at BadArg.cmake:[0-9]+ \(configure_file\):
+ configure_file called with incorrect number of arguments, expected 2
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/CMakeTests/ConfigureFile-BadArg.cmake b/Tests/RunCMake/configure_file/BadArg.cmake
similarity index 100%
rename from Tests/CMakeTests/ConfigureFile-BadArg.cmake
rename to Tests/RunCMake/configure_file/BadArg.cmake
diff --git a/Tests/RunCMake/configure_file/DirInput-result.txt b/Tests/RunCMake/configure_file/DirInput-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/configure_file/DirInput-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/configure_file/DirInput-stderr.txt b/Tests/RunCMake/configure_file/DirInput-stderr.txt
new file mode 100644
index 0000000..2e0cd14
--- /dev/null
+++ b/Tests/RunCMake/configure_file/DirInput-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at DirInput.cmake:[0-9]+ \(configure_file\):
+ configure_file input location
+
+ .*/Tests/RunCMake/configure_file/.
+
+ is a directory but a file was expected.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/CMakeTests/ConfigureFile-DirInput.cmake b/Tests/RunCMake/configure_file/DirInput.cmake
similarity index 100%
rename from Tests/CMakeTests/ConfigureFile-DirInput.cmake
rename to Tests/RunCMake/configure_file/DirInput.cmake
diff --git a/Tests/RunCMake/configure_file/DirOutput-stderr.txt b/Tests/RunCMake/configure_file/DirOutput-stderr.txt
new file mode 100644
index 0000000..d051f7c
--- /dev/null
+++ b/Tests/RunCMake/configure_file/DirOutput-stderr.txt
@@ -0,0 +1 @@
+^DirOutput test file$
diff --git a/Tests/RunCMake/configure_file/DirOutput.cmake b/Tests/RunCMake/configure_file/DirOutput.cmake
new file mode 100644
index 0000000..aa0fadf
--- /dev/null
+++ b/Tests/RunCMake/configure_file/DirOutput.cmake
@@ -0,0 +1,4 @@
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DirOutput)
+configure_file(DirOutput.txt DirOutput)
+file(READ ${CMAKE_CURRENT_BINARY_DIR}/DirOutput/DirOutput.txt out)
+message("${out}")
diff --git a/Tests/RunCMake/configure_file/DirOutput.txt b/Tests/RunCMake/configure_file/DirOutput.txt
new file mode 100644
index 0000000..16388a6
--- /dev/null
+++ b/Tests/RunCMake/configure_file/DirOutput.txt
@@ -0,0 +1 @@
+DirOutput test file
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt
new file mode 100644
index 0000000..3f66909
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NewLineStyle-COPYONLY.cmake:[0-9]+ \(configure_file\):
+ configure_file COPYONLY could not be used in combination with NEWLINE_STYLE
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake
new file mode 100644
index 0000000..c07b8f5
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake
@@ -0,0 +1,3 @@
+set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
+file(WRITE ${file_name} "Data\n")
+configure_file(${file_name} ${file_name}.out COPYONLY NEWLINE_STYLE DOS)
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt
new file mode 100644
index 0000000..3652657
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at NewLineStyle-NoArg.cmake:[0-9]+ \(configure_file\):
+ configure_file NEWLINE_STYLE must set a style: LF, CRLF, UNIX, DOS, or
+ WIN32
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake
new file mode 100644
index 0000000..b35bde1
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake
@@ -0,0 +1,3 @@
+set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
+file(WRITE ${file_name} "Data\n")
+configure_file(${file_name} ${file_name}.out NEWLINE_STYLE)
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake
similarity index 85%
rename from Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake
rename to Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake
index b7e619c..8d9f474 100644
--- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake
+++ b/Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake
@@ -1,4 +1,4 @@
-set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
+set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
function(test_eol style in out)
file(WRITE ${file_name} "${in}")
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt
new file mode 100644
index 0000000..0d6855f
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at NewLineStyle-WrongArg.cmake:[0-9]+ \(configure_file\):
+ configure_file NEWLINE_STYLE sets an unknown style, only LF, CRLF, UNIX,
+ DOS, and WIN32 are supported
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake
new file mode 100644
index 0000000..3ae906d
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake
@@ -0,0 +1,3 @@
+set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
+file(WRITE ${file_name} "Data\n")
+configure_file(${file_name} ${file_name}.out NEWLINE_STYLE FOO)
diff --git a/Tests/RunCMake/configure_file/Relative-In.txt b/Tests/RunCMake/configure_file/Relative-In.txt
new file mode 100644
index 0000000..572fe53
--- /dev/null
+++ b/Tests/RunCMake/configure_file/Relative-In.txt
@@ -0,0 +1 @@
+Relative test file
diff --git a/Tests/RunCMake/configure_file/Relative-stderr.txt b/Tests/RunCMake/configure_file/Relative-stderr.txt
new file mode 100644
index 0000000..b94de0d
--- /dev/null
+++ b/Tests/RunCMake/configure_file/Relative-stderr.txt
@@ -0,0 +1 @@
+^Relative test file$
diff --git a/Tests/RunCMake/configure_file/Relative.cmake b/Tests/RunCMake/configure_file/Relative.cmake
new file mode 100644
index 0000000..085991c
--- /dev/null
+++ b/Tests/RunCMake/configure_file/Relative.cmake
@@ -0,0 +1,3 @@
+configure_file(Relative-In.txt Relative-Out.txt)
+file(READ ${CMAKE_CURRENT_BINARY_DIR}/Relative-Out.txt out)
+message("${out}")
diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake
index 489652b..de14468 100644
--- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake
@@ -7,6 +7,14 @@
run_cmake(UTF32LE-BOM)
run_cmake(UTF32BE-BOM)
run_cmake(UnknownArg)
+run_cmake(DirInput)
+run_cmake(DirOutput)
+run_cmake(Relative)
+run_cmake(BadArg)
+run_cmake(NewLineStyle-NoArg)
+run_cmake(NewLineStyle-WrongArg)
+run_cmake(NewLineStyle-ValidArg)
+run_cmake(NewLineStyle-COPYONLY)
if(RunCMake_GENERATOR MATCHES "Make")
# Use a single build tree for a few tests without cleaning.