diff options
72 files changed, 861 insertions, 140 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 79d2319..9c73647 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -1,3 +1,5 @@ +;;; cmake-mode.el --- major-mode for editing CMake sources + ;============================================================================= ; CMake - Cross Platform Makefile Generator ; Copyright 2000-2009 Kitware, Inc., Insight Software Consortium @@ -9,7 +11,6 @@ ; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ; See the License for more information. ;============================================================================= -;;; cmake-mode.el --- major-mode for editing CMake sources ;------------------------------------------------------------------------------ @@ -22,10 +23,6 @@ ;; ;; (setq load-path (cons (expand-file-name "/dir/with/cmake-mode") load-path)) ;; (require 'cmake-mode) -;; (setq auto-mode-alist -;; (append '(("CMakeLists\\.txt\\'" . cmake-mode) -;; ("\\.cmake\\'" . cmake-mode)) -;; auto-mode-alist)) ;------------------------------------------------------------------------------ @@ -235,6 +232,7 @@ the indentation. Otherwise it retains the same position on the line" ;; ;; CMake mode startup function. ;; +;;;###autoload (defun cmake-mode () "Major mode for editing CMake listfiles." (interactive) @@ -269,6 +267,7 @@ the indentation. Otherwise it retains the same position on the line" ; Help mode starts here +;;;###autoload (defun cmake-command-run (type &optional topic) "Runs the command cmake with the arguments specified. The optional argument topic will be appended to the argument list." @@ -302,6 +301,7 @@ optional argument topic will be appended to the argument list." ) ) +;;;###autoload (defun cmake-help-list-commands () "Prints out a list of the cmake commands." (interactive) @@ -311,6 +311,7 @@ optional argument topic will be appended to the argument list." (defvar cmake-help-command-history nil "Topic read history.") (require 'thingatpt) +;;;###autoload (defun cmake-get-topic (type) "Gets the topic from the minibuffer input. The default is the word the cursor is on." (interactive) @@ -327,6 +328,7 @@ optional argument topic will be appended to the argument list." ) +;;;###autoload (defun cmake-help-command () "Prints out the help message corresponding to the command the cursor is on." (interactive) @@ -334,6 +336,10 @@ optional argument topic will be appended to the argument list." (cmake-command-run "--help-command" (downcase command)) ) +;;;###autoload +(progn + (add-to-list 'auto-mode-alist '("CMakeLists\\.txt\\'" . cmake-mode)) + (add-to-list 'auto-mode-alist '("\\.cmake\\'" . cmake-mode))) ; This file provides cmake-mode. (provide 'cmake-mode) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 495d156..eb0b2f6 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -32,6 +32,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "warning .980: wrong number of actual arguments to intrinsic function .std::basic_" "LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF" + "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" "Warning: library was too large for page size.*" "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" diff --git a/Copyright.txt b/Copyright.txt index 9342249..214d7de 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,5 +1,5 @@ CMake - Cross Platform Makefile Generator -Copyright 2000-2013 Kitware, Inc. +Copyright 2000-2014 Kitware, Inc. Copyright 2000-2011 Insight Software Consortium All rights reserved. diff --git a/Help/command/export.rst b/Help/command/export.rst index c293340..6b83587 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -5,8 +5,7 @@ Export targets from the build tree for use by outside projects. :: - export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>] - [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES]) + export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>]) Create a file <filename> that may be included by outside projects to import targets from the current project's build tree. This is useful @@ -14,14 +13,10 @@ during cross-compiling to build utility executables that can run on the host platform in one project and then import them into another project being compiled for the target platform. If the NAMESPACE option is given the <namespace> string will be prepended to all target -names written to the file. If the APPEND option is given the -generated code will be appended to the file instead of overwriting it. -The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the -contents of the properties matching -``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when -policy CMP0022 is NEW. If a library target is included in the export -but a target to which it links is not included the behavior is -unspecified. +names written to the file. + +Target installations are associated with the export <export-name> +using the ``EXPORT`` option of the :command:`install(TARGETS)` command. The file created by this command is specific to the build tree and should never be installed. See the install(EXPORT) command to export @@ -32,6 +27,21 @@ same values as the final values of the input TARGETS. :: + export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>] + [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES]) + +This signature is similar to the ``EXPORT`` signature, but targets are listed +explicitly rather than specified as an export-name. If the APPEND option is +given the generated code will be appended to the file instead of overwriting it. +The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the +contents of the properties matching +``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when +policy CMP0022 is NEW. If a library target is included in the export +but a target to which it links is not included the behavior is +unspecified. + +:: + export(PACKAGE <name>) Store the current build directory in the CMake user package registry diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index 952da3c..dc301ba 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -266,6 +266,7 @@ shared library: project(UpstreamLib) set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) set(Upstream_VERSION 3.4.1) @@ -292,11 +293,20 @@ shared library: include(CMakePackageConfigHelpers) write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStatsConfigVersion.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfigVersion.cmake" VERSION ${Upstream_VERSION} COMPATIBILITY AnyNewerVersion ) + export(EXPORT ClimbingStatsTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsTargets.cmake" + NAMESPACE Upstream:: + ) + configure_file(cmake/ClimbingStatsConfig.cmake + "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfig.cmake" + COPY_ONLY + ) + set(ConfigPackageLocation lib/cmake/ClimbingStats) install(EXPORT ClimbingStatsTargets FILE @@ -309,7 +319,7 @@ shared library: install( FILES cmake/ClimbingStatsConfig.cmake - "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStatsConfigVersion.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfigVersion.cmake" DESTINATION ${ConfigPackageLocation} COMPONENT @@ -354,6 +364,14 @@ should be provided by the ``ClimbingStats`` package, they should be in a separate file which is installed to the same location as the ``ClimbingStatsConfig.cmake`` file, and included from there. +The :command:`export(EXPORT)` command creates an :prop_tgt:`IMPORTED` targets +definition file which is specific to the build-tree. This can similiarly be +used with a suitable package configuration file and package version file to +define a package for the build tree which may be used without installation. +Consumers of the build tree can simply ensure that the +:variable:`CMAKE_PREFIX_PATH` contains the build directory, or set the +``ClimbingStats_DIR`` to ``<build_dir>/ClimbingStats`` in the cache. + This can also be extended to cover dependencies: .. code-block:: cmake @@ -375,7 +393,7 @@ dependencies of a package should be found in the ``Config.cmake`` file: .. code-block:: cmake - include(CMakePackageConfigHelpers) + include(CMakeFindDependencyMacro) find_dependency(Stats 2.6.4) include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") @@ -392,7 +410,7 @@ be true. This can be tested with logic in the package configuration file: .. code-block:: cmake - include(CMakePackageConfigHelpers) + include(CMakeFindDependencyMacro) find_dependency(Stats 2.6.4) include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") @@ -405,7 +423,7 @@ be true. This can be tested with logic in the package configuration file: set(ClimbingStats_FOUND False) set(ClimbingStats_NOTFOUND_MESSAGE "Specified unsupported component: ${_comp}") endif() - include("${CMAKE_CURRENT_LIST_DIR}ClimbingStats${_comp}Targets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStats${_comp}Targets.cmake") endforeach() Here, the ``ClimbingStats_NOTFOUND_MESSAGE`` is set to a diagnosis that the package diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 9e26392..d467c36 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -89,3 +89,4 @@ All Policies /policy/CMP0039 /policy/CMP0040 /policy/CMP0041 + /policy/CMP0042 diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index d86db37..aebfe87 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -207,6 +207,7 @@ Variables that Control the Build /variable/CMAKE_LINK_LIBRARY_FILE_FLAG /variable/CMAKE_LINK_LIBRARY_FLAG /variable/CMAKE_MACOSX_BUNDLE + /variable/CMAKE_MACOSX_RPATH /variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG /variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG /variable/CMAKE_MODULE_LINKER_FLAGS diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst new file mode 100644 index 0000000..0ed3bd1 --- /dev/null +++ b/Help/policy/CMP0042.rst @@ -0,0 +1,19 @@ +CMP0042 +------- + +:prop_tgt:`MACOSX_RPATH` is enabled by default. + +CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install +name. This was enabled by setting the target property +:prop_tgt:`MACOSX_RPATH`. The ``@rpath`` in an install name is a more +flexible and powerful mechanism than ``@executable_path`` or ``@loader_path`` +for locating shared libraries. + +CMake 3.0.0 and later prefer this property to be ON by default. Projects +wanting ``@rpath`` in a target's install name may remove any setting of +the :prop_tgt:`INSTALL_NAME_DIR` and :variable:`CMAKE_INSTALL_NAME_DIR` +variables. + +This policy was introduced in CMake version 3.0.0. CMake version +|release| warns when the policy is not set and uses OLD behavior. Use +the cmake_policy command to set it to OLD or NEW explicitly. diff --git a/Help/prop_tgt/MACOSX_RPATH.rst b/Help/prop_tgt/MACOSX_RPATH.rst index f2d8078..d3934ba 100644 --- a/Help/prop_tgt/MACOSX_RPATH.rst +++ b/Help/prop_tgt/MACOSX_RPATH.rst @@ -4,7 +4,15 @@ MACOSX_RPATH Whether to use rpaths on Mac OS X. When this property is set to true, the directory portion of -the"install_name" field of shared libraries will default to -"@rpath".Runtime paths will also be embedded in binaries using this -target.This property is initialized by the value of the variable -CMAKE_MACOSX_RPATH if it is set when a target is created. +the "install_name" field of shared libraries will be ``@rpath`` +unless overridden by :prop_tgt:`INSTALL_NAME_DIR`. Runtime +paths will also be embedded in binaries using this target and +can be controlled by the :prop_tgt:`INSTALL_RPATH` target property. +This property is initialized by the value of the variable +:variable:`CMAKE_MACOSX_RPATH` if it is set when a target is +created. + +Policy CMP0042 was introduced to change the default value of +MACOSX_RPATH to ON. This is because use of ``@rpath`` is a +more flexible and powerful alternative to ``@executable_path`` and +``@loader_path``. diff --git a/Help/variable/CMAKE_MACOSX_RPATH.rst b/Help/variable/CMAKE_MACOSX_RPATH.rst new file mode 100644 index 0000000..ac897c0 --- /dev/null +++ b/Help/variable/CMAKE_MACOSX_RPATH.rst @@ -0,0 +1,7 @@ +CMAKE_MACOSX_RPATH +------------------- + +Whether to use rpaths on Mac OS X. + +This variable is used to initialize the :prop_tgt:`MACOSX_RPATH` property on +all targets. diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 2c1c613..f388fe0 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -11,8 +11,7 @@ # CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path> # [PATH_VARS <var1> <var2> ... <varN>] # [NO_SET_AND_CHECK_MACRO] -# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] -# [NO_FIND_DEPENDENCY_MACRO]) +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) # # # @@ -196,7 +195,6 @@ include(CMakeParseArguments) include(WriteBasicConfigVersionFile) -include(CMakeFindDependencyMacro) macro(WRITE_BASIC_PACKAGE_VERSION_FILE) write_basic_config_version_file(${ARGN}) @@ -205,7 +203,7 @@ endmacro() set(cfpch_dir ${CMAKE_CURRENT_LIST_DIR}) function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) - set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) set(oneValueArgs INSTALL_DESTINATION ) set(multiValueArgs PATH_VARS ) @@ -291,11 +289,6 @@ endmacro() ") endif() - if(NOT CCF_NO_FIND_DEPENDENCY_MACRO) - file(READ "${cfpch_dir}/CMakeFindDependencyMacro.cmake" find_dependency_macro) - set(PACKAGE_INIT "${PACKAGE_INIT} ${find_dependency_macro}") - endif() - set(PACKAGE_INIT "${PACKAGE_INIT} ####################################################################################") diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index d9e0ba7..30f57c7 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -52,6 +52,7 @@ # # If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly # converted to RTF by the WiX Generator. +# The expected encoding of the .txt file is UTF-8. # # With CPACK_WIX_LICENSE_RTF you can override the license file used by the # WiX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 85e1019..b512a0a 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 20140101) +set(CMake_VERSION_TWEAK 20140106) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index c1749ac..78e7339 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -27,6 +27,9 @@ #include <rpc.h> // for GUID generation +#include <sys/types.h> +#include <sys/stat.h> + int cmCPackWIXGenerator::InitializeInternal() { componentPackageMethod = ONE_PACKAGE; @@ -920,6 +923,14 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( fileDefinitions.AddAttribute("Source", fullPath); fileDefinitions.AddAttribute("KeyPath", "yes"); + mode_t fileMode = 0; + cmSystemTools::GetPermissions(fullPath.c_str(), fileMode); + + if(!(fileMode & S_IWRITE)) + { + fileDefinitions.AddAttribute("ReadOnly", "yes"); + } + ApplyPatchFragment(fileId, fileDefinitions); fileDefinitions.EndElement("File"); diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx index 886b534..ddc1d71 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx @@ -65,7 +65,41 @@ void cmWIXRichTextFormatWriter::AddText(const std::string& text) } else { - File << "[NON-ASCII-" << int(c) << "]"; + if(c <= 0xC0) + { + EmitInvalidCodepoint(c); + } + else if(c < 0xE0 && i+1 < text.size()) + { + EmitUnicodeCodepoint( + (text[i+1] & 0x3F) | + ((c & 0x1F) << 6) + ); + i+= 1; + } + else if(c < 0xF0 && i+2 < text.size()) + { + EmitUnicodeCodepoint( + (text[i+2] & 0x3F) | + ((text[i+1] & 0x3F) << 6) | + ((c & 0xF) << 12) + ); + i += 2; + } + else if(c < 0xF8 && i+3 < text.size()) + { + EmitUnicodeCodepoint( + (text[i+3] & 0x3F) | + ((text[i+2] & 0x3F) << 6) | + ((text[i+1] & 0x3F) << 12) | + ((c & 0x7) << 18) + ); + i += 3; + } + else + { + EmitInvalidCodepoint(c); + } } } break; @@ -82,6 +116,7 @@ void cmWIXRichTextFormatWriter::WriteHeader() ControlWord("deflang1031"); WriteFontTable(); + WriteColorTable(); WriteGenerator(); } @@ -99,6 +134,22 @@ void cmWIXRichTextFormatWriter::WriteFontTable() EndGroup(); } +void cmWIXRichTextFormatWriter::WriteColorTable() +{ + StartGroup(); + ControlWord("colortbl ;"); + ControlWord("red255"); + ControlWord("green0"); + ControlWord("blue0;"); + ControlWord("red0"); + ControlWord("green255"); + ControlWord("blue0;"); + ControlWord("red0"); + ControlWord("green0"); + ControlWord("blue255;"); + EndGroup(); +} + void cmWIXRichTextFormatWriter::WriteGenerator() { StartGroup(); @@ -135,3 +186,43 @@ void cmWIXRichTextFormatWriter::EndGroup() { File.put('}'); } + +void cmWIXRichTextFormatWriter::EmitUnicodeCodepoint(int c) +{ + // Do not emit byte order mark (BOM) + if(c == 0xFEFF) + { + return; + } + else if(c <= 0xFFFF) + { + EmitUnicodeSurrogate(c); + } + else + { + c -= 0x10000; + EmitUnicodeSurrogate(((c >> 10) & 0x3FF) + 0xD800); + EmitUnicodeSurrogate((c & 0x3FF) + 0xDC00); + } +} + +void cmWIXRichTextFormatWriter::EmitUnicodeSurrogate(int c) +{ + ControlWord("u"); + if(c <= 32767) + { + File << c; + } + else + { + File << (c - 65536); + } + File << "?"; +} + +void cmWIXRichTextFormatWriter::EmitInvalidCodepoint(int c) +{ + ControlWord("cf1 "); + File << "[INVALID-BYTE-" << int(c) << "]"; + ControlWord("cf0 "); +} diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h index bb8580a..38e40b0 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h @@ -30,6 +30,7 @@ public: private: void WriteHeader(); void WriteFontTable(); + void WriteColorTable(); void WriteGenerator(); void WriteDocumentPrefix(); @@ -40,6 +41,11 @@ private: void StartGroup(); void EndGroup(); + void EmitUnicodeCodepoint(int c); + void EmitUnicodeSurrogate(int c); + + void EmitInvalidCodepoint(int c); + std::ofstream File; }; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 4c39d10..729f14a 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -139,6 +139,13 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) } else { + + for(TestMap::iterator j = this->Tests.begin(); + j != this->Tests.end(); ++j) + { + j->second.erase(test); + } + this->UnlockResources(test); this->Completed++; this->TestFinishMap[test] = true; @@ -441,6 +448,19 @@ int cmCTestMultiProcessHandler::SearchByName(std::string name) //--------------------------------------------------------- void cmCTestMultiProcessHandler::CreateTestCostList() { + if(this->ParallelLevel > 1) + { + CreateParallelTestCostList(); + } + else + { + CreateSerialTestCostList(); + } +} + +//--------------------------------------------------------- +void cmCTestMultiProcessHandler::CreateParallelTestCostList() +{ TestSet alreadySortedTests; std::list<TestSet> priorityStack; @@ -452,8 +472,7 @@ void cmCTestMultiProcessHandler::CreateTestCostList() for(TestMap::const_iterator i = this->Tests.begin(); i != this->Tests.end(); ++i) { - if(this->ParallelLevel > 1 && - std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), + if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), this->Properties[i->first]->Name) != this->LastTestsFailed.end()) { //If the test failed last time, it should be run first. @@ -466,8 +485,9 @@ void cmCTestMultiProcessHandler::CreateTestCostList() } } - // Repeatedly move dependencies of the tests on the current dependency level - // to the next level until no further dependencies exist. + // In parallel test runs repeatedly move dependencies of the tests on + // the current dependency level to the next level until no + // further dependencies exist. while(priorityStack.back().size()) { TestSet &previousSet = priorityStack.back(); @@ -526,6 +546,65 @@ void cmCTestMultiProcessHandler::CreateTestCostList() } //--------------------------------------------------------- +void cmCTestMultiProcessHandler::GetAllTestDependencies( + int test, TestList& dependencies) +{ + TestSet const& dependencySet = this->Tests[test]; + for(TestSet::const_iterator i = dependencySet.begin(); + i != dependencySet.end(); ++i) + { + GetAllTestDependencies(*i, dependencies); + dependencies.push_back(*i); + } +} + +//--------------------------------------------------------- +void cmCTestMultiProcessHandler::CreateSerialTestCostList() +{ + TestList presortedList; + + for(TestMap::iterator i = this->Tests.begin(); + i != this->Tests.end(); ++i) + { + presortedList.push_back(i->first); + } + + TestComparator comp(this); + std::stable_sort(presortedList.begin(), presortedList.end(), comp); + + TestSet alreadySortedTests; + + for(TestList::const_iterator i = presortedList.begin(); + i != presortedList.end(); ++i) + { + int test = *i; + + if(alreadySortedTests.find(test) != alreadySortedTests.end()) + { + continue; + } + + TestList dependencies; + GetAllTestDependencies(test, dependencies); + + for(TestList::const_iterator j = dependencies.begin(); + j != dependencies.end(); ++j) + { + int testDependency = *j; + + if(alreadySortedTests.find(testDependency) == alreadySortedTests.end()) + { + alreadySortedTests.insert(testDependency); + this->SortedTests.push_back(testDependency); + } + } + + alreadySortedTests.insert(test); + this->SortedTests.push_back(test); + } +} + +//--------------------------------------------------------- void cmCTestMultiProcessHandler::WriteCheckpoint(int index) { std::string fname = this->CTest->GetBinaryDir() diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 439a8f3..1b53ec7 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -72,6 +72,12 @@ protected: int SearchByName(std::string name); void CreateTestCostList(); + + void GetAllTestDependencies(int test, TestList& dependencies); + void CreateSerialTestCostList(); + + void CreateParallelTestCostList(); + // Removes the checkpoint file void MarkFinished(); void EraseTest(int index); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index f3bdddd..6986965 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1752,7 +1752,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath, // @loader_path or full paths. if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { - if(!target->HasMacOSXRpath(this->Config)) + if(!target->HasMacOSXRpathInstallNameDir(this->Config)) { return; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index c10f86f..b669cd1 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -13,11 +13,14 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include "cmExportSet.h" +#include "cmTargetExport.h" //---------------------------------------------------------------------------- cmExportBuildFileGenerator::cmExportBuildFileGenerator() { this->Makefile = 0; + this->ExportSet = 0; } //---------------------------------------------------------------------------- @@ -26,9 +29,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) { std::string expectedTargets; std::string sep; + std::vector<std::string> targets; + this->GetTargets(targets); for(std::vector<std::string>::const_iterator - tei = this->Targets.begin(); - tei != this->Targets.end(); ++tei) + tei = targets.begin(); + tei != targets.end(); ++tei) { cmTarget *te = this->Makefile->FindTargetToUse(tei->c_str()); expectedTargets += sep + this->Namespace + te->GetExportName(); @@ -153,6 +158,12 @@ cmExportBuildFileGenerator } //---------------------------------------------------------------------------- +void cmExportBuildFileGenerator::SetExportSet(cmExportSet *exportSet) +{ + this->ExportSet = exportSet; +} + +//---------------------------------------------------------------------------- void cmExportBuildFileGenerator ::SetImportLocationProperty(const char* config, std::string const& suffix, @@ -232,6 +243,23 @@ cmExportBuildFileGenerator::HandleMissingTarget( } //---------------------------------------------------------------------------- +void cmExportBuildFileGenerator +::GetTargets(std::vector<std::string> &targets) const +{ + if (this->ExportSet) + { + for(std::vector<cmTargetExport*>::const_iterator + tei = this->ExportSet->GetTargetExports()->begin(); + tei != this->ExportSet->GetTargetExports()->end(); ++tei) + { + targets.push_back((*tei)->Target->GetName()); + } + return; + } + targets = this->Targets; +} + +//---------------------------------------------------------------------------- std::vector<std::string> cmExportBuildFileGenerator ::FindNamespaces(cmMakefile* mf, const std::string& name) @@ -246,8 +274,8 @@ cmExportBuildFileGenerator expIt = exportSets.begin(); expIt != exportSets.end(); ++expIt) { const cmExportBuildFileGenerator* exportSet = expIt->second; - std::vector<std::string> const& targets = exportSet->GetTargets(); - + std::vector<std::string> targets; + exportSet->GetTargets(targets); if (std::find(targets.begin(), targets.end(), name) != targets.end()) { namespaces.push_back(exportSet->GetNamespace()); diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index 2fbd98f..cea2099 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -15,6 +15,8 @@ #include "cmExportFileGenerator.h" #include "cmListFileCache.h" +class cmExportSet; + /** \class cmExportBuildFileGenerator * \brief Generate a file exporting targets from a build tree. * @@ -32,11 +34,11 @@ public: /** Set the list of targets to export. */ void SetTargets(std::vector<std::string> const& targets) { this->Targets = targets; } - std::vector<std::string> const& GetTargets() const - { return this->Targets; } + void GetTargets(std::vector<std::string> &targets) const; void AppendTargets(std::vector<std::string> const& targets) { this->Targets.insert(this->Targets.end(), targets.begin(), targets.end()); } + void SetExportSet(cmExportSet*); /** Set whether to append generated code to the output file. */ void SetAppendMode(bool append) { this->AppendMode = append; } @@ -75,6 +77,7 @@ protected: FindNamespaces(cmMakefile* mf, const std::string& name); std::vector<std::string> Targets; + cmExportSet *ExportSet; std::vector<cmTarget*> Exports; cmMakefile* Makefile; cmListFileBacktrace Backtrace; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 0a67ccf..b6bf870 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -30,14 +30,12 @@ cmExportCommand::cmExportCommand() ,ArgumentGroup() ,Targets(&Helper, "TARGETS") ,Append(&Helper, "APPEND", &ArgumentGroup) +,ExportSetName(&Helper, "EXPORT", &ArgumentGroup) ,Namespace(&Helper, "NAMESPACE", &ArgumentGroup) ,Filename(&Helper, "FILE", &ArgumentGroup) ,ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup) { - // at first TARGETS - this->Targets.Follows(0); - // and after that the other options in any order - this->ArgumentGroup.Follows(&this->Targets); + this->ExportSet = 0; } @@ -55,6 +53,16 @@ bool cmExportCommand { return this->HandlePackage(args); } + else if (args[0] == "EXPORT") + { + this->ExportSetName.Follows(0); + this->ArgumentGroup.Follows(&this->ExportSetName); + } + else + { + this->Targets.Follows(0); + this->ArgumentGroup.Follows(&this->Targets); + } std::vector<std::string> unknownArgs; this->Helper.Parse(&args, &unknownArgs); @@ -65,31 +73,32 @@ bool cmExportCommand return false; } - if (this->Targets.WasFound() == false) - { - this->SetError("TARGETS option missing."); - return false; - } - + std::string fname; if(!this->Filename.WasFound()) { - this->SetError("FILE <filename> option missing."); - return false; + if (args[0] != "EXPORT") + { + this->SetError("FILE <filename> option missing."); + return false; + } + fname = this->ExportSetName.GetString() + ".cmake"; } - - // Make sure the file has a .cmake extension. - if(cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString()) - != ".cmake") + else { - cmOStringStream e; - e << "FILE option given filename \"" << this->Filename.GetString() - << "\" which does not have an extension of \".cmake\".\n"; - this->SetError(e.str().c_str()); - return false; + // Make sure the file has a .cmake extension. + if(cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString()) + != ".cmake") + { + cmOStringStream e; + e << "FILE option given filename \"" << this->Filename.GetString() + << "\" which does not have an extension of \".cmake\".\n"; + this->SetError(e.str().c_str()); + return false; + } + fname = this->Filename.GetString(); } // Get the file to write. - std::string fname = this->Filename.GetString(); if(cmSystemTools::FileIsFullPath(fname.c_str())) { if(!this->Makefile->CanIWriteThisFile(fname.c_str())) @@ -104,57 +113,95 @@ bool cmExportCommand else { // Interpret relative paths with respect to the current build dir. - fname = this->Makefile->GetCurrentOutputDirectory(); - fname += "/"; - fname += this->Filename.GetString(); + std::string dir = this->Makefile->GetCurrentOutputDirectory(); + fname = dir + "/" + fname; } - for(std::vector<std::string>::const_iterator - currentTarget = this->Targets.GetVector().begin(); - currentTarget != this->Targets.GetVector().end(); - ++currentTarget) + std::vector<std::string> targets; + + cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator() + ->GetGlobalGenerator(); + + if(args[0] == "EXPORT") { - if (this->Makefile->IsAlias(currentTarget->c_str())) + if (this->Append.IsEnabled()) + { + cmOStringStream e; + e << "EXPORT signature does not recognise the APPEND option."; + this->SetError(e.str().c_str()); + return false; + } + + if (this->ExportOld.IsEnabled()) { cmOStringStream e; - e << "given ALIAS target \"" << *currentTarget - << "\" which may not be exported."; + e << "EXPORT signature does not recognise the " + "EXPORT_LINK_INTERFACE_LIBRARIES option."; this->SetError(e.str().c_str()); return false; } - if(cmTarget* target = - this->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->FindTarget(0, currentTarget->c_str())) + cmExportSetMap &setMap = gg->GetExportSets(); + std::string setName = this->ExportSetName.GetString(); + if (setMap.find(setName) == setMap.end()) { - if(target->GetType() == cmTarget::OBJECT_LIBRARY) + cmOStringStream e; + e << "Export set \"" << setName << "\" not found."; + this->SetError(e.str().c_str()); + return false; + } + this->ExportSet = setMap[setName]; + } + else if (this->Targets.WasFound()) + { + for(std::vector<std::string>::const_iterator + currentTarget = this->Targets.GetVector().begin(); + currentTarget != this->Targets.GetVector().end(); + ++currentTarget) + { + if (this->Makefile->IsAlias(currentTarget->c_str())) { cmOStringStream e; - e << "given OBJECT library \"" << *currentTarget + e << "given ALIAS target \"" << *currentTarget << "\" which may not be exported."; this->SetError(e.str().c_str()); return false; } + + if(cmTarget* target = gg->FindTarget(0, currentTarget->c_str())) + { + if(target->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "given OBJECT library \"" << *currentTarget + << "\" which may not be exported."; + this->SetError(e.str().c_str()); + return false; + } + } + else + { + cmOStringStream e; + e << "given target \"" << *currentTarget + << "\" which is not built by this project."; + this->SetError(e.str().c_str()); + return false; + } + targets.push_back(*currentTarget); } - else + if (this->Append.IsEnabled()) { - cmOStringStream e; - e << "given target \"" << *currentTarget - << "\" which is not built by this project."; - this->SetError(e.str().c_str()); - return false; + if (cmExportBuildFileGenerator *ebfg = gg->GetExportedTargetsFile(fname)) + { + ebfg->AppendTargets(targets); + return true; + } } } - - cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator(); - if (this->Append.IsEnabled()) + else { - if (cmExportBuildFileGenerator *ebfg = gg->GetExportedTargetsFile(fname)) - { - ebfg->AppendTargets(this->Targets.GetVector()); - return true; - } + this->SetError("EXPORT or TARGETS specifier missing."); + return false; } // Setup export file generation. @@ -162,7 +209,14 @@ bool cmExportCommand ebfg->SetExportFile(fname.c_str()); ebfg->SetNamespace(this->Namespace.GetCString()); ebfg->SetAppendMode(this->Append.IsEnabled()); - ebfg->SetTargets(this->Targets.GetVector()); + if (this->ExportSet) + { + ebfg->SetExportSet(this->ExportSet); + } + else + { + ebfg->SetTargets(targets); + } ebfg->SetMakefile(this->Makefile); ebfg->SetExportOld(this->ExportOld.IsEnabled()); diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index ea7c3a3..c0e445f 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -15,6 +15,7 @@ #include "cmCommand.h" class cmExportBuildFileGenerator; +class cmExportSet; /** \class cmExportLibraryDependenciesCommand * \brief Add a test to the lists of tests to run. @@ -52,10 +53,13 @@ private: cmCommandArgumentGroup ArgumentGroup; cmCAStringVector Targets; cmCAEnabler Append; + cmCAString ExportSetName; cmCAString Namespace; cmCAString Filename; cmCAEnabler ExportOld; + cmExportSet *ExportSet; + friend class cmExportBuildFileGenerator; std::string ErrorMessage; diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 177ef8d..0312488 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -86,18 +86,28 @@ void cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, cmGeneratedFileStream& fout) const { + const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + const std::string makeArgs = mf->GetSafeDefinition( + "CMAKE_KATE_MAKE_ARGUMENTS"); + const char* homeOutputDir = mf->GetHomeOutputDirectory(); + fout << "\t\"build\": {\n" "\t\t\"directory\": \"" << mf->GetHomeOutputDirectory() << "\",\n" "\t\t\"default_target\": \"all\",\n" - "\t\t\"prev_target\": \"all\",\n" - "\t\t\"clean_target\": \"clean\",\n" - "\t\t\"targets\":[\n"; + "\t\t\"clean_target\": \"clean\",\n"; - const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); - const std::string makeArgs = mf->GetSafeDefinition( - "CMAKE_KATE_MAKE_ARGUMENTS"); - const char* homeOutputDir = mf->GetHomeOutputDirectory(); + // build, clean and quick are for the build plugin kate <= 4.12: + fout << "\t\t\"build\": \"" << make << " -C " << homeOutputDir + << " " << makeArgs << " " << "all\",\n"; + fout << "\t\t\"clean\": \"" << make << " -C " << homeOutputDir + << " " << makeArgs << " " << "clean\",\n"; + fout << "\t\t\"quick\": \"" << make << " -C " << homeOutputDir + << " " << makeArgs << " " << "install\",\n"; + + // this is for kate >= 4.13: + fout << + "\t\t\"targets\":[\n"; this->AppendTarget(fout, "all", make, makeArgs, homeOutputDir, homeOutputDir); @@ -237,7 +247,8 @@ cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const return; } - fout << "#Generated by cmake, do not edit.\n"; + fout << "#Generated by " << mf->GetRequiredDefinition("CMAKE_COMMAND") + << ", do not edit.\n"; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 227a948..3b858af 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1045,6 +1045,12 @@ cmGlobalGenerator::GetExportedTargetsFile(const std::string &filename) const return it == this->BuildExportSets.end() ? 0 : it->second; } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target) +{ + this->CMP0042WarnTargets.insert(target); +} + bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { // If the property is not enabled then okay. @@ -1072,6 +1078,9 @@ void cmGlobalGenerator::Generate() // Start with an empty vector: this->FilesReplacedDuringGenerate.clear(); + // clear targets to issue warning CMP0042 for + this->CMP0042WarnTargets.clear(); + // Check whether this generator is allowed to run. if(!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) { @@ -1203,6 +1212,25 @@ void cmGlobalGenerator::Generate() this->ExtraGenerator->Generate(); } + if(!this->CMP0042WarnTargets.empty()) + { + cmOStringStream w; + w << + (this->GetCMakeInstance()->GetPolicies()-> + GetPolicyWarning(cmPolicies::CMP0042)) << "\n"; + w << "MACOSX_RPATH is not specified for" + " the following targets:\n"; + for(std::set<std::string>::iterator + iter = this->CMP0042WarnTargets.begin(); + iter != this->CMP0042WarnTargets.end(); + ++iter) + { + w << " " << *iter << "\n"; + } + this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + cmListFileBacktrace()); + } + this->CMakeInstance->UpdateProgress("Generating done", -1); } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index f60d24d..049b0e6 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -315,6 +315,8 @@ public: bool GenerateImportFile(const std::string &file); cmExportBuildFileGenerator* GetExportedTargetsFile(const std::string &filename) const; + void AddCMP0042WarnTarget(const std::string& target); + protected: typedef std::vector<cmLocalGenerator*> GeneratorVector; // for a project collect all its targets by following depend @@ -449,6 +451,9 @@ private: // Set of binary directories on disk. std::set<cmStdString> BinaryDirectories; + + // track targets to issue CMP0042 warning for. + std::set<std::string> CMP0042WarnTargets; }; #endif diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 7c5f69d..a9a27b9 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -12,6 +12,7 @@ #include "cmLocalXCodeGenerator.h" #include "cmGlobalXCodeGenerator.h" #include "cmSourceFile.h" +#include "cmMakefile.h" //---------------------------------------------------------------------------- cmLocalXCodeGenerator::cmLocalXCodeGenerator() @@ -42,3 +43,31 @@ void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags, static_cast<cmGlobalXCodeGenerator*>(this->GlobalGenerator); gg->AppendFlag(flags, rawFlag); } + +//---------------------------------------------------------------------------- +void cmLocalXCodeGenerator::Generate() +{ + cmLocalGenerator::Generate(); + + cmTargets& targets = this->Makefile->GetTargets(); + for(cmTargets::iterator iter = targets.begin(); + iter != targets.end(); ++iter) + { + cmTarget* t = &iter->second; + t->HasMacOSXRpathInstallNameDir(NULL); + } +} + +//---------------------------------------------------------------------------- +void cmLocalXCodeGenerator::GenerateInstallRules() +{ + cmLocalGenerator::GenerateInstallRules(); + + cmTargets& targets = this->Makefile->GetTargets(); + for(cmTargets::iterator iter = targets.begin(); + iter != targets.end(); ++iter) + { + cmTarget* t = &iter->second; + t->HasMacOSXRpathInstallNameDir(NULL); + } +} diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index d97a41c..edd2f5b 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -29,6 +29,8 @@ public: virtual ~cmLocalXCodeGenerator(); virtual std::string GetTargetDirectory(cmTarget const& target) const; virtual void AppendFlagEscape(std::string& flags, const char* rawFlag); + virtual void Generate(); + virtual void GenerateInstallRules(); private: }; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 69fe444..69b8092 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -338,13 +338,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.CMTarget = this->Target; vars.Language = linkLanguage; vars.Objects = buildObjs.c_str(); - std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash(); - objdir += this->Target->GetName(); - objdir += ".dir"; - objdir = this->Convert(objdir.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL); - vars.ObjectDir = objdir.c_str(); + std::string objectDir = this->Target->GetSupportDirectory(); + objectDir = this->Convert(objectDir.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + vars.ObjectDir = objectDir.c_str(); vars.Target = targetOutPathReal.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 399b582..d6a0cd4 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -580,13 +580,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.CMTarget = this->Target; vars.Language = linkLanguage; vars.Objects = buildObjs.c_str(); - std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash(); - objdir += this->Target->GetName(); - objdir += ".dir"; - objdir = this->Convert(objdir.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL); - vars.ObjectDir = objdir.c_str(); + std::string objectDir = this->Target->GetSupportDirectory(); + objectDir = this->Convert(objectDir.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + vars.ObjectDir = objectDir.c_str(); vars.Target = targetOutPathReal.c_str(); vars.LinkLibraries = linkLibs.c_str(); vars.ObjectsQuoted = buildObjs.c_str(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 6e70285..f82b808 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -647,7 +647,7 @@ cmMakefileTargetGenerator cmLocalGenerator::NONE, cmLocalGenerator::SHELL).c_str(); vars.Object = shellObj.c_str(); - std::string objectDir = cmSystemTools::GetFilenamePath(obj); + std::string objectDir = this->Target->GetSupportDirectory(); objectDir = this->Convert(objectDir.c_str(), cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index e3c058f..c8b03e1 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -568,7 +568,7 @@ cmNinjaTargetGenerator } EnsureParentDirectoryExists(objectFileName); - std::string objectDir = cmSystemTools::GetFilenamePath(objectFileName); + std::string objectDir = this->Target->GetSupportDirectory(); vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(objectDir.c_str()).c_str(), cmLocalGenerator::SHELL); diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0b3018e..987c663 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -311,6 +311,11 @@ cmPolicies::cmPolicies() CMP0041, "CMP0041", "Error on relative include with generator expression.", 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0042, "CMP0042", + "MACOSX_RPATH is enabled by default.", + 3,0,0,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 245ec4b..66eaf87 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -95,6 +95,7 @@ public: CMP0040, ///< The target in the TARGET signature of /// add_custom_command() must exist. CMP0041, ///< Error on relative include with generator expression + CMP0042, ///< Enable MACOSX_RPATH by default /** \brief Always the last entry. * diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a0177fb..9faf0d9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3186,13 +3186,17 @@ std::string cmTarget::GetSOName(const char* config) const } //---------------------------------------------------------------------------- -bool cmTarget::HasMacOSXRpath(const char* config) const +bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const { bool install_name_is_rpath = false; - bool macosx_rpath = this->GetPropertyAsBool("MACOSX_RPATH"); + bool macosx_rpath = false; if(!this->IsImportedTarget) { + if(this->GetType() != cmTarget::SHARED_LIBRARY) + { + return false; + } const char* install_name = this->GetProperty("INSTALL_NAME_DIR"); bool use_install_name = this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"); @@ -3205,6 +3209,10 @@ bool cmTarget::HasMacOSXRpath(const char* config) const { return false; } + if(!install_name_is_rpath) + { + macosx_rpath = this->MacOSXRpathInstallNameDirDefault(); + } } else { @@ -3259,6 +3267,37 @@ bool cmTarget::HasMacOSXRpath(const char* config) const } //---------------------------------------------------------------------------- +bool cmTarget::MacOSXRpathInstallNameDirDefault() const +{ + // we can't do rpaths when unsupported + if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG")) + { + return false; + } + + const char* macosx_rpath_str = this->GetProperty("MACOSX_RPATH"); + if(macosx_rpath_str) + { + return this->GetPropertyAsBool("MACOSX_RPATH"); + } + + cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042(); + + if(cmp0042 == cmPolicies::WARN) + { + this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + AddCMP0042WarnTarget(this->GetName()); + } + + if(cmp0042 == cmPolicies::NEW) + { + return true; + } + + return false; +} + +//---------------------------------------------------------------------------- bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const { if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY) @@ -3847,7 +3886,8 @@ std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const !this->GetPropertyAsBool("SKIP_BUILD_RPATH")) { std::string dir; - if(this->GetPropertyAsBool("MACOSX_RPATH")) + bool macosx_rpath = this->MacOSXRpathInstallNameDirDefault(); + if(macosx_rpath) { dir = "@rpath"; } @@ -3881,9 +3921,12 @@ std::string cmTarget::GetInstallNameDirForInstallTree() const dir += "/"; } } - if(!install_name_dir && this->GetPropertyAsBool("MACOSX_RPATH")) + if(!install_name_dir) { - dir = "@rpath/"; + if(this->MacOSXRpathInstallNameDirDefault()) + { + dir = "@rpath/"; + } } return dir; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index bf4a8ef..e026c59 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -26,7 +26,8 @@ F(CMP0020) \ F(CMP0021) \ F(CMP0022) \ - F(CMP0041) + F(CMP0041) \ + F(CMP0042) class cmake; class cmMakefile; @@ -382,7 +383,10 @@ public: std::string GetSOName(const char* config) const; /** Whether this library has \@rpath and platform supports it. */ - bool HasMacOSXRpath(const char* config) const; + bool HasMacOSXRpathInstallNameDir(const char* config) const; + + /** Whether this library defaults to \@rpath. */ + bool MacOSXRpathInstallNameDirDefault() const; /** Test for special case of a third-party shared library that has no soname at all. */ diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 3745f78..24ea518 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -1136,6 +1136,11 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) testEncoding ) ENDIF(KWSYS_STL_HAS_WSTRING) + IF(KWSYS_USE_FStream) + SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} + testFStream + ) + ENDIF(KWSYS_USE_FStream) IF(KWSYS_USE_SystemInformation) SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation) ENDIF(KWSYS_USE_SystemInformation) diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in index c340c55..916a93e 100644 --- a/Source/kwsys/FStream.hxx.in +++ b/Source/kwsys/FStream.hxx.in @@ -25,8 +25,9 @@ namespace @KWSYS_NAMESPACE@ typedef std::basic_filebuf<CharType,Traits> my_base_type; basic_filebuf *open(char const *s,std::ios_base::openmode mode) { - my_base_type::open(Encoding::ToWide(s).c_str(), mode); - return this; + return static_cast<basic_filebuf*>( + my_base_type::open(Encoding::ToWide(s).c_str(), mode) + ); } }; diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx new file mode 100644 index 0000000..8942549 --- /dev/null +++ b/Source/kwsys/testFStream.cxx @@ -0,0 +1,48 @@ +/*============================================================================ + KWSys - Kitware System Library + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "kwsysPrivate.h" + +#if defined(_MSC_VER) +# pragma warning (disable:4786) +#endif + +#include KWSYS_HEADER(FStream.hxx) + +// Work-around CMake dependency scanning limitation. This must +// duplicate the above list of headers. +#if 0 +# include "FStream.hxx.in" +#endif + + +//---------------------------------------------------------------------------- +static int testNoFile() +{ + kwsys::ifstream in_file("NoSuchFile.txt"); + if(in_file) + { + return 1; + } + + return 0; +} + + +//---------------------------------------------------------------------------- +int testFStream(int, char*[]) +{ + int ret = 0; + + ret |= testNoFile(); + + return ret; +} diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5ea604f..063bd2d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2219,6 +2219,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ADD_TEST_MACRO(CTestTestSerialInDepends ${CMAKE_CTEST_COMMAND} -j 4 --output-on-failure -C "\${CTestTest_CONFIG}") + ADD_TEST_MACRO(CTestTestMissingDependsExe ${CMAKE_CTEST_COMMAND} + --output-on-failure -C "\${CTestTest_CONFIG}") + set_tests_properties(CTestTestMissingDependsExe PROPERTIES + PASS_REGULAR_EXPRESSION "\\*\\*\\*Not Run" + ) + + ADD_TEST_MACRO(CTestTestSerialOrder ${CMAKE_CTEST_COMMAND} + --output-on-failure -C "\${CTestTest_CONFIG}") + if(NOT BORLAND) set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process) add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4 diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt index 0b06045..bc3322e 100644 --- a/Tests/CPackWiXGenerator/CMakeLists.txt +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -51,6 +51,8 @@ set(CPACK_PACKAGE_EXECUTABLES set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/patch.xml") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt") + include(CPack) cpack_add_install_type(Full DISPLAY_NAME "Everything") diff --git a/Tests/CPackWiXGenerator/license.txt b/Tests/CPackWiXGenerator/license.txt new file mode 100644 index 0000000..7942783 --- /dev/null +++ b/Tests/CPackWiXGenerator/license.txt @@ -0,0 +1,9 @@ +hello world +merhaba dünya +ハローワールド +привет мир +مرحبا العالم +你好世界 + +4-Byte sequences: + Perch (Fish) 𩶘 Elevator 𨋢! diff --git a/Tests/CTestTestMissingDependsExe/CMakeLists.txt b/Tests/CTestTestMissingDependsExe/CMakeLists.txt new file mode 100644 index 0000000..9826da6 --- /dev/null +++ b/Tests/CTestTestMissingDependsExe/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(CTestTestMissingDependsExe) + +enable_testing() + +add_test(test1 ${CMAKE_COMMAND} -E echo test) +add_test(test2 non-existent-command) + +set_tests_properties(test1 PROPERTIES DEPENDS test2) diff --git a/Tests/CTestTestSerialOrder/CMakeLists.txt b/Tests/CTestTestSerialOrder/CMakeLists.txt new file mode 100644 index 0000000..69c11fc --- /dev/null +++ b/Tests/CTestTestSerialOrder/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(CTestTestSerialOrder) + +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") + +enable_testing() + +function(add_serial_order_test TEST_NAME) + add_test(NAME ${TEST_NAME} + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + "-DTEST_NAME=${TEST_NAME}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test.cmake" + ) + + if(ARGC GREATER 1) + set_tests_properties(${TEST_NAME} PROPERTIES ${ARGN}) + endif() +endfunction() + +add_serial_order_test(initialization COST 1000) +add_serial_order_test(test1) +add_serial_order_test(test2) +add_serial_order_test(test3) +add_serial_order_test(test4 DEPENDS test5) + +add_serial_order_test(test5) +set_tests_properties(test5 PROPERTIES DEPENDS "test6;test7b;test7a") + +add_serial_order_test(test6 COST -2) +add_serial_order_test(test7a COST -1) +add_serial_order_test(test7b COST -1) +add_serial_order_test(test8 COST 10) +add_serial_order_test(test9 COST 20) +add_serial_order_test(test10 COST 0) +add_serial_order_test(test11) +add_serial_order_test(test12 COST 0) + +add_serial_order_test(verification COST -1000) diff --git a/Tests/CTestTestSerialOrder/test.cmake b/Tests/CTestTestSerialOrder/test.cmake new file mode 100644 index 0000000..8479cae --- /dev/null +++ b/Tests/CTestTestSerialOrder/test.cmake @@ -0,0 +1,31 @@ +list(APPEND EXPECTED_OUTPUT + initialization + test9 + test8 + test1 + test2 + test3 + test6 + test7a + test7b + test5 + test4 + test10 + test11 + test12 +) + + +if("${TEST_NAME}" STREQUAL "initialization") + file(WRITE ${TEST_OUTPUT_FILE} "${TEST_NAME}") + +elseif("${TEST_NAME}" STREQUAL "verification") + file(READ ${TEST_OUTPUT_FILE} ACTUAL_OUTPUT) + if(NOT "${ACTUAL_OUTPUT}" STREQUAL "${EXPECTED_OUTPUT}") + message(FATAL_ERROR "Actual test order [${ACTUAL_OUTPUT}] differs from expected test order [${EXPECTED_OUTPUT}]") + endif() + +else() + file(APPEND ${TEST_OUTPUT_FILE} ";${TEST_NAME}") + +endif() diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index b713262..f400f13 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -23,11 +23,6 @@ set_property(TARGET sharedlib PROPERTY INTERFACE_COMPILE_DEFINITIONS "SHAREDLIB_ add_library(sharediface INTERFACE) target_link_libraries(sharediface INTERFACE sharedlib) -export(TARGETS sharediface sharedlib headeronly - NAMESPACE bld:: - FILE ../ExportInterfaceBuildTree.cmake -) - install(TARGETS headeronly sharediface sharedlib EXPORT expInterface RUNTIME DESTINATION bin @@ -47,3 +42,8 @@ install(FILES ) install(EXPORT expInterface NAMESPACE exp:: DESTINATION lib/exp) + +export(EXPORT expInterface + NAMESPACE bld:: + FILE ../ExportInterfaceBuildTree.cmake +) diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt index 5fc54f4..ade0a3c 100644 --- a/Tests/MacRuntimePath/A/CMakeLists.txt +++ b/Tests/MacRuntimePath/A/CMakeLists.txt @@ -10,13 +10,15 @@ add_library(shared2 SHARED shared.cpp shared.h) set_target_properties(shared2 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath") +cmake_policy(SET CMP0042 NEW) + # a framework library add_library(framework SHARED framework.cpp framework.h) -set_target_properties(framework PROPERTIES MACOSX_RPATH 1 FRAMEWORK 1) +set_target_properties(framework PROPERTIES FRAMEWORK 1) # another framework add_library(framework2 SHARED framework2.cpp framework2.h) -set_target_properties(framework2 PROPERTIES MACOSX_RPATH 1 FRAMEWORK 1) +set_target_properties(framework2 PROPERTIES FRAMEWORK 1) # executable to test a shared library dependency with install rpaths add_executable(test1 test1.cpp) diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake index 57c3ed0..2e76ee0 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake @@ -1,5 +1,7 @@ enable_language(CXX) +cmake_policy(SET CMP0042 NEW) + add_library(foo SHARED empty_vs6_1.cpp) add_library(bar SHARED empty_vs6_2.cpp) target_link_libraries(bar foo) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake index fe7e858..e3552b2 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake @@ -1,6 +1,8 @@ project(CMP0022-WARN) +cmake_policy(SET CMP0042 NEW) + add_library(foo SHARED empty_vs6_1.cpp) add_library(bar SHARED empty_vs6_2.cpp) add_library(bat SHARED empty_vs6_3.cpp) diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt b/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake b/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake new file mode 100644 index 0000000..778a444 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0042 NEW) + +add_library(foo SHARED empty.cpp) diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake b/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake new file mode 100644 index 0000000..1aede96 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0042 OLD) + +add_library(foo SHARED empty.cpp) diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt b/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt new file mode 100644 index 0000000..f3574a1 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\): + Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake + --help-policy CMP0042" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + MACOSX_RPATH is not specified for the following targets: + + foo + +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake b/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake new file mode 100644 index 0000000..3fa32b1 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake @@ -0,0 +1,9 @@ + +add_library(foo SHARED empty.cpp) +add_library(foo-static STATIC empty.cpp) +add_library(foo2 SHARED empty.cpp) +set_target_properties(foo2 PROPERTIES MACOSX_RPATH 1) +add_library(foo3 SHARED empty.cpp) +set_target_properties(foo3 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@loader_path") +add_library(foo4 SHARED empty.cpp) +set_target_properties(foo4 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath") diff --git a/Tests/RunCMake/CMP0042/CMakeLists.txt b/Tests/RunCMake/CMP0042/CMakeLists.txt new file mode 100644 index 0000000..11ea636 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0042/RunCMakeTest.cmake b/Tests/RunCMake/CMP0042/RunCMakeTest.cmake new file mode 100644 index 0000000..3b226d7 --- /dev/null +++ b/Tests/RunCMake/CMP0042/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0042-OLD) +run_cmake(CMP0042-NEW) +run_cmake(CMP0042-WARN) diff --git a/Tests/RunCMake/CMP0042/empty.cpp b/Tests/RunCMake/CMP0042/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0042/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 96b0543..96724ce 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -61,6 +61,9 @@ add_RunCMake_test(CMP0038) add_RunCMake_test(CMP0039) add_RunCMake_test(CMP0040) add_RunCMake_test(CMP0041) +if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) + add_RunCMake_test(CMP0042) +endif() add_RunCMake_test(CTest) if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) diff --git a/Tests/RunCMake/export/AppendExport-result.txt b/Tests/RunCMake/export/AppendExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/AppendExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt new file mode 100644 index 0000000..6e385d4 --- /dev/null +++ b/Tests/RunCMake/export/AppendExport-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AppendExport.cmake:8 \(export\): + export EXPORT signature does not recognise the APPEND option. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/AppendExport.cmake b/Tests/RunCMake/export/AppendExport.cmake new file mode 100644 index 0000000..f36010b --- /dev/null +++ b/Tests/RunCMake/export/AppendExport.cmake @@ -0,0 +1,8 @@ +add_library(foo empty.cpp) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +export(EXPORT fooExport APPEND FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") diff --git a/Tests/RunCMake/export/NoExportSet-result.txt b/Tests/RunCMake/export/NoExportSet-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/NoExportSet-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/NoExportSet-stderr.txt b/Tests/RunCMake/export/NoExportSet-stderr.txt new file mode 100644 index 0000000..9d27805 --- /dev/null +++ b/Tests/RunCMake/export/NoExportSet-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoExportSet.cmake:2 \(export\): + export Export set "fooExport" not found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/NoExportSet.cmake b/Tests/RunCMake/export/NoExportSet.cmake new file mode 100644 index 0000000..72390e8 --- /dev/null +++ b/Tests/RunCMake/export/NoExportSet.cmake @@ -0,0 +1,2 @@ + +export(EXPORT fooExport) diff --git a/Tests/RunCMake/export/OldIface-result.txt b/Tests/RunCMake/export/OldIface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/OldIface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt new file mode 100644 index 0000000..afb4ae3 --- /dev/null +++ b/Tests/RunCMake/export/OldIface-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at OldIface.cmake:8 \(export\): + export EXPORT signature does not recognise the + EXPORT_LINK_INTERFACE_LIBRARIES option. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/OldIface.cmake b/Tests/RunCMake/export/OldIface.cmake new file mode 100644 index 0000000..5fb8e25 --- /dev/null +++ b/Tests/RunCMake/export/OldIface.cmake @@ -0,0 +1,10 @@ +add_library(foo empty.cpp) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +export(EXPORT fooExport + EXPORT_LINK_INTERFACE_LIBRARIES +) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index b8d3f27..4b04f18 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -1,3 +1,6 @@ include(RunCMake) run_cmake(TargetNotFound) +run_cmake(AppendExport) +run_cmake(OldIface) +run_cmake(NoExportSet) |