diff options
34 files changed, 330 insertions, 118 deletions
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index ee2016f..5d20c54 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -68,11 +68,21 @@ literal block after ``::`` space. We prefer the ``::`` to appear at the end of a paragraph line instead of as its own line. +``note`` directive + Call out a side note. The command-line help processor prints the + block content as if the lines were normal paragraph text with + interpretation. + ``parsed-literal`` directive Add a literal block with markup interpretation. The command-line help processor prints the block content without the leading directive line and with common indentation replaced by one space. +``productionlist`` directive + Render context-free grammar productions. The command-line help + processor prints the block content as if the lines were normal + paragraph text with interpretation. + ``replace`` directive Define a ``|substitution|`` replacement. The command-line help processor requires a substitution replacement diff --git a/Help/prop_tgt/INCLUDE_DIRECTORIES.rst b/Help/prop_tgt/INCLUDE_DIRECTORIES.rst index 40709a4..cf358b3 100644 --- a/Help/prop_tgt/INCLUDE_DIRECTORIES.rst +++ b/Help/prop_tgt/INCLUDE_DIRECTORIES.rst @@ -5,17 +5,20 @@ List of preprocessor include file search directories. This property specifies the list of directories given so far to the include_directories command. This property exists on directories and -targets. In addition to accepting values from the include_directories +targets. In addition to accepting values from the :command:`include_directories` command, values may be set directly on any directory or any target -using the set_property command. A target gets its initial value for +using the :command:`set_property` command. A target gets its initial value for this property from the value of the directory property. A directory gets its initial value from its parent directory if it has one. Both directory and target property values are adjusted by calls to the -include_directories command. +:command:`include_directories` command. The target property values are used by the generators to set the -include paths for the compiler. See also the include_directories -command. +include paths for the compiler. See also the :command:`include_directories` +and :command:`target_include_directories` commands. + +Relative paths should not be added to this property directly. Use one of +the commands above instead to handle relative paths. Contents of INCLUDE_DIRECTORIES may use "generator expressions" with the syntax "$<...>". See the :manual:`cmake-generator-expressions(7)` manual for diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index da6b2e0..2d641f5 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -519,6 +519,11 @@ cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") # WiX specific variables cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}") +# set sysroot so SDK tools can be used +if(CMAKE_OSX_SYSROOT) + cpack_set_if_not_set(CPACK_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}") +endif() + if(DEFINED CPACK_COMPONENTS_ALL) if(CPACK_MONOLITHIC_INSTALL) message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 6e1c926..51a3d77 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -4,9 +4,7 @@ # # Find Boost include dirs and libraries # -# Use this module by invoking find_package with the form: -# -# :: +# Use this module by invoking find_package with the form:: # # find_package(Boost # [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 @@ -17,9 +15,7 @@ # This module finds headers and requested component libraries OR a CMake # package configuration file provided by a "Boost CMake" build. For the # latter case skip to the "Boost CMake" section below. For the former -# case results are reported in variables: -# -# :: +# case results are reported in variables:: # # Boost_FOUND - True if headers and requested libraries were found # Boost_INCLUDE_DIRS - Boost include directories @@ -38,11 +34,7 @@ # information about Boost's automatic linking # displayed during compilation # -# -# -# This module reads hints about search locations from variables: -# -# :: +# This module reads hints about search locations from variables:: # # BOOST_ROOT - Preferred installation prefix # (or BOOSTROOT) @@ -54,9 +46,7 @@ # - List of Boost versions not known to this module # (Boost install locations may contain the version) # -# and saves search results persistently in CMake cache entries: -# -# :: +# and saves search results persistently in CMake cache entries:: # # Boost_INCLUDE_DIR - Directory containing Boost headers # Boost_LIBRARY_DIR - Directory containing Boost libraries @@ -83,9 +73,7 @@ # # Boost libraries come in many variants encoded in their file name. # Users or projects may tell this module which variant to find by -# setting variables: -# -# :: +# setting variables:: # # Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded # libraries ('mt' tag). Default is ON. @@ -109,9 +97,7 @@ # such as "pthread" or "win32". Names with # and without this suffix will both be tried. # -# Other variables one may set to control this module are: -# -# :: +# Other variables one may set to control this module are:: # # Boost_DEBUG - Set to ON to enable debug output from FindBoost. # Please enable this before filing any bug report. @@ -132,17 +118,13 @@ # to be linked explicitly or available in the link library search path. # In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve # dynamic linking. Boost automatic linking typically requests static -# libraries with a few exceptions (such as Boost.Python). Use -# -# :: +# libraries with a few exceptions (such as Boost.Python). Use:: # # add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) # # to ask Boost to report information about automatic linking requests. # -# Example to find Boost headers only: -# -# :: +# Example to find Boost headers only:: # # find_package(Boost 1.36.0) # if(Boost_FOUND) @@ -150,11 +132,9 @@ # add_executable(foo foo.cc) # endif() # -# Example to find Boost headers and some libraries: +# Example to find Boost headers and some *static* libraries:: # -# :: -# -# set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_STATIC_LIBS ON) # only find static libs # set(Boost_USE_MULTITHREADED ON) # set(Boost_USE_STATIC_RUNTIME OFF) # find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...) @@ -164,9 +144,8 @@ # target_link_libraries(foo ${Boost_LIBRARIES}) # endif() # -# -# -# Boost CMake ---------------------------------------------------------- +# Boost CMake +# ^^^^^^^^^^^ # # If Boost was built using the boost-cmake project it provides a package # configuration file for use with find_package's Config mode. This diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a9c3b98..47caddd 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 12) -set(CMake_VERSION_TWEAK 20131102) +set(CMake_VERSION_TWEAK 20131104) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index d973c01..dfb2f15 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -474,7 +474,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); udco_image_command << " convert \"" << temp_image << "\""; udco_image_command << " -format UDCO"; - udco_image_command << " -o \"" << temp_udco << "\""; + udco_image_command << " -ov -o \"" << temp_udco << "\""; std::string error; if(!this->RunCommand(udco_image_command, &error)) @@ -504,6 +504,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // Rez the SLA cmOStringStream embed_sla_command; embed_sla_command << this->GetOption("CPACK_COMMAND_REZ"); + const char* sysroot = this->GetOption("CPACK_OSX_SYSROOT"); + if(sysroot && sysroot[0] != '\0') + { + embed_sla_command << " -isysroot \"" << sysroot << "\""; + } embed_sla_command << " \"" << sla_r << "\""; embed_sla_command << " -a -o "; embed_sla_command << "\"" << temp_udco << "\""; diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index a504157..0058721 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -144,17 +144,7 @@ private: if(!this->Line.empty() && this->Line[0] == '=' && this->RegexDiff.find(this->Line)) { - std::string Path = this->RegexDiff.match(1); - // See if we need to remove the //depot prefix - if(Path.length() > 2 && Path[0] == '/' && Path[1] == '/') - { - size_t found = Path.find('/', 2); - if(found != std::string::npos) - { - Path = Path.substr(found + 1); - } - } - CurrentPath = Path; + CurrentPath = this->RegexDiff.match(1); AlreadyNotified = false; } else diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 64bcd59..7d33cf3 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -22,6 +22,7 @@ //#include <cmsys/RegularExpression.hxx> #include <cmsys/Process.h> +#include <cmsys/Directory.hxx> // used for sleep #ifdef _WIN32 @@ -1056,15 +1057,71 @@ bool cmCTestScriptHandler::EmptyBinaryDirectory(const char *sname) return false; } + // consider non existing target directory a success + if(!cmSystemTools::FileExists(sname)) + { + return true; + } + // try to avoid deleting directories that we shouldn't std::string check = sname; check += "/CMakeCache.txt"; - if(cmSystemTools::FileExists(check.c_str()) && - !cmSystemTools::RemoveADirectory(sname)) + + if(!cmSystemTools::FileExists(check.c_str())) { return false; } - return true; + + for(int i = 0; i < 5; ++i) + { + if(TryToRemoveBinaryDirectoryOnce(sname)) + { + return true; + } + cmSystemTools::Delay(100); + } + + return false; +} + +//------------------------------------------------------------------------- +bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce( + const std::string& directoryPath) +{ + cmsys::Directory directory; + directory.Load(directoryPath.c_str()); + + for(unsigned long i = 0; i < directory.GetNumberOfFiles(); ++i) + { + std::string path = directory.GetFile(i); + + if(path == "." || path == ".." || path == "CMakeCache.txt") + { + continue; + } + + std::string fullPath = directoryPath + std::string("/") + path; + + bool isDirectory = cmSystemTools::FileIsDirectory(fullPath.c_str()) && + !cmSystemTools::FileIsSymlink(fullPath.c_str()); + + if(isDirectory) + { + if(!cmSystemTools::RemoveADirectory(fullPath.c_str())) + { + return false; + } + } + else + { + if(!cmSystemTools::RemoveFile(fullPath.c_str())) + { + return false; + } + } + } + + return cmSystemTools::RemoveADirectory(directoryPath.c_str()); } //------------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 80d5831..44e9dd0 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -135,6 +135,9 @@ private: // Add ctest command void AddCTestCommand(cmCTestCommand* command); + // Try to remove the binary directory once + static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath); + std::vector<cmStdString> ConfigurationScripts; std::vector<bool> ScriptProcessScope; diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index a4dfdc9..a7665c8 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -1230,7 +1230,7 @@ void CMakeSetupDialog::doOutputFindNext(bool directionForward) QString search = this->FindHistory.front(); - QTextCursor cursor = this->Output->textCursor(); + QTextCursor textCursor = this->Output->textCursor(); QTextDocument* document = this->Output->document(); QTextDocument::FindFlags flags; if (!directionForward) @@ -1238,67 +1238,67 @@ void CMakeSetupDialog::doOutputFindNext(bool directionForward) flags |= QTextDocument::FindBackward; } - cursor = document->find(search, cursor, flags); + textCursor = document->find(search, textCursor, flags); - if (cursor.isNull()) + if (textCursor.isNull()) { // first search found nothing, wrap around and search again - cursor = this->Output->textCursor(); - cursor.movePosition(directionForward ? QTextCursor::Start - : QTextCursor::End); - cursor = document->find(search, cursor, flags); + textCursor = this->Output->textCursor(); + textCursor.movePosition(directionForward ? QTextCursor::Start + : QTextCursor::End); + textCursor = document->find(search, textCursor, flags); } - if (cursor.hasSelection()) + if (textCursor.hasSelection()) { - this->Output->setTextCursor(cursor); + this->Output->setTextCursor(textCursor); } } void CMakeSetupDialog::doOutputErrorNext() { - QTextCursor cursor = this->Output->textCursor(); + QTextCursor textCursor = this->Output->textCursor(); bool atEnd = false; // move cursor out of current error-block - if (cursor.blockCharFormat() == this->ErrorFormat) + if (textCursor.blockCharFormat() == this->ErrorFormat) { - atEnd = !cursor.movePosition(QTextCursor::NextBlock); + atEnd = !textCursor.movePosition(QTextCursor::NextBlock); } // move cursor to next error-block - while (cursor.blockCharFormat() != this->ErrorFormat && !atEnd) + while (textCursor.blockCharFormat() != this->ErrorFormat && !atEnd) { - atEnd = !cursor.movePosition(QTextCursor::NextBlock); + atEnd = !textCursor.movePosition(QTextCursor::NextBlock); } if (atEnd) { // first search found nothing, wrap around and search again - atEnd = !cursor.movePosition(QTextCursor::Start); + atEnd = !textCursor.movePosition(QTextCursor::Start); // move cursor to next error-block - while (cursor.blockCharFormat() != this->ErrorFormat && !atEnd) + while (textCursor.blockCharFormat() != this->ErrorFormat && !atEnd) { - atEnd = !cursor.movePosition(QTextCursor::NextBlock); + atEnd = !textCursor.movePosition(QTextCursor::NextBlock); } } if (!atEnd) { - cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); + textCursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); QTextCharFormat selectionFormat; selectionFormat.setBackground(Qt::yellow); - QTextEdit::ExtraSelection extraSelection = {cursor, selectionFormat}; + QTextEdit::ExtraSelection extraSelection = {textCursor, selectionFormat}; this->Output->setExtraSelections(QList<QTextEdit::ExtraSelection>() << extraSelection); // make the whole error-block visible - this->Output->setTextCursor(cursor); + this->Output->setTextCursor(textCursor); // remove the selection to see the extraSelection - cursor.setPosition(cursor.anchor()); - this->Output->setTextCursor(cursor); + textCursor.setPosition(textCursor.anchor()); + this->Output->setTextCursor(textCursor); } } diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 97a20ce..7beeda0 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -140,25 +140,14 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths) } const char* rootPath = this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH"); - const char* osxRootPath = - this->Makefile->GetDefinition("_CMAKE_OSX_SYSROOT_PATH"); - const bool noRootPath = !rootPath || !*rootPath; - const bool noOSXRootPath = !osxRootPath || !*osxRootPath; - if(noRootPath && noOSXRootPath) + if((rootPath == 0) || (strlen(rootPath) == 0)) { return; } // Construct the list of path roots with no trailing slashes. std::vector<std::string> roots; - if(rootPath) - { - cmSystemTools::ExpandListArgument(rootPath, roots); - } - if(osxRootPath) - { - roots.push_back(osxRootPath); - } + cmSystemTools::ExpandListArgument(rootPath, roots); for(std::vector<std::string>::iterator ri = roots.begin(); ri != roots.end(); ++ri) { diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 5374451..107ef73 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1341,7 +1341,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode "No target \"" + name + "\""); return std::string(); } - if(target->GetType() >= cmTarget::UTILITY && + if(target->GetType() >= cmTarget::OBJECT_LIBRARY && target->GetType() != cmTarget::UNKNOWN_LIBRARY) { ::reportError(context, content->GetOriginalExpression(), diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8a8d61a..4fe5033 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1242,6 +1242,7 @@ bool cmGlobalGenerator::CheckTargets() target.GetType() == cmTarget::STATIC_LIBRARY || target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY || + target.GetType() == cmTarget::OBJECT_LIBRARY || target.GetType() == cmTarget::UTILITY) { if(!target.FindSourceFiles()) diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 6d4e281..3aa8e1b 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -34,6 +34,8 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot): ReplaceDirective("^.. (\\|[^|]+\\|) replace::[ \t]*(.*)$"), IncludeDirective("^.. include::[ \t]+([^ \t\n]+)$"), TocTreeDirective("^.. toctree::[ \t]*(.*)$"), + ProductionListDirective("^.. productionlist::[ \t]*(.*)$"), + NoteDirective("^.. note::[ \t]*(.*)$"), ModuleRST("^#\\[(=*)\\[\\.rst:$"), CMakeRole("(:cmake)?:(" "command|generator|variable|module|policy|" @@ -227,6 +229,16 @@ void cmRST::ProcessLine(std::string const& line) this->Directive = DirectiveTocTree; this->MarkupLines.push_back(this->TocTreeDirective.match(1)); } + else if(this->ProductionListDirective.find(line)) + { + // Output productionlist directives and their content normally. + this->NormalLine(line); + } + else if(this->NoteDirective.find(line)) + { + // Output note directives and their content normally. + this->NormalLine(line); + } } // An explicit markup start followed nothing but whitespace and a // blank line does not consume any indented text following. diff --git a/Source/cmRST.h b/Source/cmRST.h index fa987cd..3356008 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -84,6 +84,8 @@ private: cmsys::RegularExpression ReplaceDirective; cmsys::RegularExpression IncludeDirective; cmsys::RegularExpression TocTreeDirective; + cmsys::RegularExpression ProductionListDirective; + cmsys::RegularExpression NoteDirective; cmsys::RegularExpression ModuleRST; cmsys::RegularExpression CMakeRole; cmsys::RegularExpression Substitution; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 8320ecf..1ecda88 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1619,18 +1619,23 @@ bool extract_tar(const char* outFileName, bool verbose, archive_error_string(a)); break; } - if (verbose && extract) + if(verbose) { - cmSystemTools::Stdout("x "); - cmSystemTools::Stdout(archive_entry_pathname(entry)); - } - if(verbose && !extract) - { - list_item_verbose(stdout, entry); + if(extract) + { + cmSystemTools::Stdout("x "); + cmSystemTools::Stdout(archive_entry_pathname(entry)); + } + else + { + list_item_verbose(stdout, entry); + } + cmSystemTools::Stdout("\n"); } else if(!extract) { cmSystemTools::Stdout(archive_entry_pathname(entry)); + cmSystemTools::Stdout("\n"); } if(extract) { @@ -1644,15 +1649,7 @@ bool extract_tar(const char* outFileName, bool verbose, } r = archive_write_header(ext, entry); - if (r != ARCHIVE_OK) - { - cmSystemTools::Error("Problem with archive_write_header(): ", - archive_error_string(ext)); - cmSystemTools::Error("Current file: ", - archive_entry_pathname(entry)); - break; - } - else + if (r == ARCHIVE_OK) { copy_data(a, ext); r = archive_write_finish_entry(ext); @@ -1663,10 +1660,22 @@ bool extract_tar(const char* outFileName, bool verbose, break; } } - } - if (verbose || !extract) - { - cmSystemTools::Stdout("\n"); +#ifdef _WIN32 + else if(const char* linktext = archive_entry_symlink(entry)) + { + std::cerr << "cmake -E tar: warning: skipping symbolic link \"" + << archive_entry_pathname(entry) << "\" -> \"" + << linktext << "\"." << std::endl; + } +#endif + else + { + cmSystemTools::Error("Problem with archive_write_header(): ", + archive_error_string(ext)); + cmSystemTools::Error("Current file: ", + archive_entry_pathname(entry)); + break; + } } } archive_read_close(a); diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 6b6fe4c..9add198 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -384,13 +384,8 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, } } - if(this->CurrentProcessingState == ProcessingLinkLibraries - && !this->Target->GetProperty("LINK_INTERFACE_LIBRARIES")) - { - this->Makefile - ->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt); - } - else if(this->CurrentProcessingState != ProcessingKeywordLinkInterface + // Handle normal case first. + if(this->CurrentProcessingState != ProcessingKeywordLinkInterface && this->CurrentProcessingState != ProcessingPlainLinkInterface) { this->Makefile diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect index 744cb88..fa436cb 100644 --- a/Tests/CMakeLib/testRST.expect +++ b/Tests/CMakeLib/testRST.expect @@ -76,6 +76,13 @@ or after a paragraph ending in two colons:: but not after a line ending in two colons:: in the middle of a paragraph. +.. productionlist:: + grammar: `production` + production: "content rendered" + +.. note:: + Notes are called out. + substituted text with multiple lines becomes one line End of first include. diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst index 5cb6d91..54952dd 100644 --- a/Tests/CMakeLib/testRST.rst +++ b/Tests/CMakeLib/testRST.rst @@ -83,6 +83,13 @@ or after a paragraph ending in two colons:: but not after a line ending in two colons:: in the middle of a paragraph. +.. productionlist:: + grammar: `production` + production: "content rendered" + +.. note:: + Notes are called out. + .. |substitution| replace:: |nested substitution| with multiple lines becomes one line diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7c939ed..d4a55fc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1943,6 +1943,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ PASS_REGULAR_EXPRESSION "Upload\\.xml") configure_file( + "${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(CTestTestEmptyBinaryDirectory ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/testOut.log" + ) + set_tests_properties(CTestTestEmptyBinaryDirectory PROPERTIES + PASS_REGULAR_EXPRESSION "TEST_SUCCESS") + + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" @ONLY ESCAPE_QUOTES) diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 8162f0c..ff40e30 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -59,6 +59,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "1") set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "2") set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") +set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/license.txt) # Tell CPack all of the components to install. The "ALL" # refers to the fact that this is the set of components that @@ -120,4 +121,4 @@ if (NOT ("${CPackComponentWay}" STREQUAL "default")) set(CPACK_PROJECT_CONFIG_FILE ${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake) endif () # Include CPack to introduce the appropriate targets -include(CPack)
\ No newline at end of file +include(CPack) diff --git a/Tests/CPackComponentsForAll/license.txt b/Tests/CPackComponentsForAll/license.txt new file mode 100644 index 0000000..ba8ba48 --- /dev/null +++ b/Tests/CPackComponentsForAll/license.txt @@ -0,0 +1,3 @@ +LICENSE +------- +This is an installer created using CPack (http://www.cmake.org). No license provided. diff --git a/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in b/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in new file mode 100644 index 0000000..8eb808f --- /dev/null +++ b/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 2.8.12) + +set(CTEST_RUN_CURRENT_SCRIPT 0) + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestEmptyBinaryDirectory") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestEmptyBinaryDirectory") + +# make sure ctest does not remove directories without a CMakeCache.txt in it +set(EMPTY_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/empty_binary_dir") +file(MAKE_DIRECTORY "${EMPTY_BINARY_DIR}") + +if(NOT EXISTS "${EMPTY_BINARY_DIR}" + OR EXISTS "${EMPTY_BINARY_DIR}/CMakeCache.txt") + message(FATAL_ERROR "empty_binary_dir precondition failed") +endif() + +ctest_empty_binary_directory("${EMPTY_BINARY_DIR}") + +if(NOT EXISTS "${EMPTY_BINARY_DIR}") + message(FATAL_ERROR "empty_binary_dir should not have been removed") +endif() + +# make sure ctest does remove directories with a CMakeCache.txt +set(VALID_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/valid_binary_dir") +file(MAKE_DIRECTORY "${VALID_BINARY_DIR}") +file(WRITE "${VALID_BINARY_DIR}/CMakeCache.txt") + +if(NOT EXISTS "${VALID_BINARY_DIR}" + OR NOT EXISTS "${VALID_BINARY_DIR}/CMakeCache.txt") + message(FATAL_ERROR "valid_binary_dir precondition failed") +endif() + +ctest_empty_binary_directory("${VALID_BINARY_DIR}") + +if(EXISTS "${VALID_BINARY_DIR}") + message(FATAL_ERROR "valid_binary_dir should have been removed") +endif() + +# make sure ctest removes build directories recursively +set(DEEP_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/deep_binary_dir") +file(MAKE_DIRECTORY "${DEEP_BINARY_DIR}") +file(WRITE "${DEEP_BINARY_DIR}/CMakeCache.txt") + +foreach(SUBDIR A Z A/A A/Z Z/A Z/Z) + set(FULL_SUBDIR "${DEEP_BINARY_DIR}/${SUBDIR}") + file(MAKE_DIRECTORY "${FULL_SUBDIR}") + + foreach(SUBFILE A.cpp Z.bat) + set(FULL_SUBFILE "${FULL_SUBDIR}/${SUBFILE}") + file(WRITE "${FULL_SUBFILE}" "I am '${FULL_SUBFILE}'") + endforeach() +endforeach() + +if(NOT EXISTS "${DEEP_BINARY_DIR}" + OR NOT EXISTS "${DEEP_BINARY_DIR}/CMakeCache.txt" + OR NOT EXISTS "${DEEP_BINARY_DIR}/Z/A/Z.bat") + message(FATAL_ERROR "deep_binary_dir precondition failed") +endif() + +ctest_empty_binary_directory("${DEEP_BINARY_DIR}") + +if(EXISTS "${DEEP_BINARY_DIR}") + message(FATAL_ERROR "deep_binary_dir should have been removed") +endif() + +message("TEST_SUCCESS") diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index ae8fda2..db4e08d 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -37,10 +37,19 @@ function(check_updates build) REGEX "<(${types}|FullName)>" LIMIT_INPUT ${max_update_xml_size} ) + string(REGEX REPLACE "[ \t]*<(${types})>[ \t]*;[ \t]*<FullName>([^<]*)</FullName>" "\\1{\\2}" UPDATE_XML_ENTRIES "${UPDATE_XML_ENTRIES}") + # If specified, remove the given prefix from the files in Update.xml. + # Some VCS systems, like Perforce, return absolute locations + if(DEFINED REPOSITORY_FILE_PREFIX) + string(REPLACE + "${REPOSITORY_FILE_PREFIX}" "" + UPDATE_XML_ENTRIES "${UPDATE_XML_ENTRIES}") + endif() + # Compare expected and actual entries set(EXTRA "${UPDATE_XML_ENTRIES}") list(REMOVE_ITEM EXTRA ${ARGN} ${UPDATE_EXTRA} ${UPDATE_MAYBE}) diff --git a/Tests/CTestUpdateP4.cmake.in b/Tests/CTestUpdateP4.cmake.in index f23bd11..f0420c4 100644 --- a/Tests/CTestUpdateP4.cmake.in +++ b/Tests/CTestUpdateP4.cmake.in @@ -8,6 +8,7 @@ set(P4_TOP "${TOP}") set(TOP "${TOP}/@CTestUpdateP4_DIR@") # Include code common to all update tests. +set(REPOSITORY_FILE_PREFIX "//ctest/") include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake") #----------------------------------------------------------------------------- diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt new file mode 100644 index 0000000..533d38c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt @@ -0,0 +1,26 @@ +CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_SONAME_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake new file mode 100644 index 0000000..c47ee2b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake @@ -0,0 +1,7 @@ +enable_language(C) +add_library(objlib OBJECT empty.c) +add_custom_target(check ALL COMMAND echo + $<TARGET_FILE:objlib> + $<TARGET_SONAME_FILE:objlib> + $<TARGET_LINKER_FILE:objlib> + ) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 62bf29b..54d5064 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -7,4 +7,5 @@ run_cmake(BadNOT) run_cmake(BadStrEqual) run_cmake(BadZero) run_cmake(BadTargetName) +run_cmake(BadTargetTypeObject) run_cmake(BadInstallPrefix) diff --git a/Tests/RunCMake/GeneratorExpression/empty.c b/Tests/RunCMake/GeneratorExpression/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty.c diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource-result.txt b/Tests/RunCMake/ObjectLibrary/MissingSource-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/MissingSource-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt new file mode 100644 index 0000000..411cd7c --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at MissingSource.cmake:1 \(add_library\): + Cannot find source file: + + missing.c + + Tried extensions( \.[A-Za-z+]+| + )* +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource.cmake b/Tests/RunCMake/ObjectLibrary/MissingSource.cmake new file mode 100644 index 0000000..258eaed --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/MissingSource.cmake @@ -0,0 +1 @@ +add_library(A OBJECT missing.c) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index a74eaa8..42973f8 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -11,6 +11,7 @@ run_cmake(Install) run_cmake(LinkObjLHS) run_cmake(LinkObjRHS1) run_cmake(LinkObjRHS2) +run_cmake(MissingSource) run_cmake(ObjWithObj) run_cmake(PostBuild) run_cmake(PreBuild) |