diff options
124 files changed, 1121 insertions, 435 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 9fbad4b..1307a58 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -130,7 +130,8 @@ The options are: Specify the primary input source file to the command. This is treated just like any value given to the ``DEPENDS`` option but also suggests to Visual Studio generators where to hang - the custom command. + the custom command. At most one custom command may specify a + given source file as its main dependency. ``OUTPUT`` Specify the output files the command is expected to produce. diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst index 996d08e..5134a70 100644 --- a/Help/command/add_custom_target.rst +++ b/Help/command/add_custom_target.rst @@ -82,6 +82,9 @@ The options are: (``CMakeLists.txt`` file). They will be brought up to date when the target is built. + Use the :command:`add_dependencies` command to add dependencies + on other targets. + ``SOURCES`` Specify additional source files to be included in the custom target. Specified source files will be added to IDE project files for diff --git a/Help/generator/MSYS Makefiles.rst b/Help/generator/MSYS Makefiles.rst index 0b89126..f7cfa44 100644 --- a/Help/generator/MSYS Makefiles.rst +++ b/Help/generator/MSYS Makefiles.rst @@ -1,7 +1,11 @@ MSYS Makefiles -------------- -Generates MSYS makefiles. +Generates makefiles for use with MSYS ``make`` under the MSYS shell. -The makefiles use /bin/sh as the shell. They require msys to be -installed on the machine. +Use this generator in a MSYS shell prompt and using ``make`` as the build +tool. The generated makefiles use ``/bin/sh`` as the shell to launch build +rules. They are not compatible with a Windows command prompt. + +To build under a Windows command prompt, use the +:generator:`MinGW Makefiles` generator. diff --git a/Help/generator/MinGW Makefiles.rst b/Help/generator/MinGW Makefiles.rst index ed4ccdd..9fe5fe3 100644 --- a/Help/generator/MinGW Makefiles.rst +++ b/Help/generator/MinGW Makefiles.rst @@ -1,7 +1,12 @@ MinGW Makefiles --------------- -Generates a make file for use with mingw32-make. +Generates makefiles for use with ``mingw32-make`` under a Windows command +prompt. -The makefiles generated use cmd.exe as the shell. They do not require -msys or a unix shell. +Use this generator under a Windows command prompt with MinGW in the ``PATH`` +and using ``mingw32-make`` as the build tool. The generated makefiles use +``cmd.exe`` as the shell to launch build rules. They are not compatible with +MSYS or a unix shell. + +To build under the MSYS shell, use the :generator:`MSYS Makefiles` generator. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index cca6d28..68954c5 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -80,6 +80,7 @@ Properties on Targets /prop_tgt/ALIASED_TARGET /prop_tgt/ANDROID_API + /prop_tgt/ANDROID_API_MIN /prop_tgt/ANDROID_GUI /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index 44ffb3b..054438d 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -256,5 +256,6 @@ like this: The :variable:`CMAKE_GENERATOR_TOOLSET` may be set to select the Nsight Tegra "Toolchain Version" value. -See the :prop_tgt:`ANDROID_API` and :prop_tgt:`ANDROID_GUI` -target properties to configure targets within the project. +See the :prop_tgt:`ANDROID_API_MIN`, :prop_tgt:`ANDROID_API` +and :prop_tgt:`ANDROID_GUI` target properties to configure +targets within the project. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 2de4103..4d54075 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -206,6 +206,7 @@ Variables that Control the Build :maxdepth: 1 /variable/CMAKE_ANDROID_API + /variable/CMAKE_ANDROID_API_MIN /variable/CMAKE_ANDROID_GUI /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_AUTOMOC_MOC_OPTIONS diff --git a/Help/prop_tgt/ANDROID_API_MIN.rst b/Help/prop_tgt/ANDROID_API_MIN.rst new file mode 100644 index 0000000..773ab3f --- /dev/null +++ b/Help/prop_tgt/ANDROID_API_MIN.rst @@ -0,0 +1,7 @@ +ANDROID_API_MIN +--------------- + +Set the Android MIN API version (e.g. ``9``). The version number +must be a positive decimal integer. This property is initialized by +the value of the :variable:`CMAKE_ANDROID_API_MIN` variable if it is set +when a target is created. Native code builds using this API version. diff --git a/Help/prop_tgt/TYPE.rst b/Help/prop_tgt/TYPE.rst index 1951d46..5ac63cc 100644 --- a/Help/prop_tgt/TYPE.rst +++ b/Help/prop_tgt/TYPE.rst @@ -5,4 +5,5 @@ The type of the target. This read-only property can be used to test the type of the given target. It will be one of STATIC_LIBRARY, MODULE_LIBRARY, -SHARED_LIBRARY, EXECUTABLE or one of the internal target types. +SHARED_LIBRARY, INTERFACE_LIBRARY, EXECUTABLE or one of the internal +target types. diff --git a/Help/release/dev/curl-darwinssl.rst b/Help/release/dev/curl-darwinssl.rst new file mode 100644 index 0000000..3571bd1 --- /dev/null +++ b/Help/release/dev/curl-darwinssl.rst @@ -0,0 +1,9 @@ +curl-darwinssl +-------------- + +* On OS X, commands supporting network communication, such as + :command:`file(DOWNLOAD)`, :command:`file(UPLOAD)`, and + :command:`ctest_submit`, now support SSL/TLS even when CMake + is not built against OpenSSL. The OS X native SSL/TLS + implementation is used by default. OS-configured certificate + authorities will be trusted automatically. diff --git a/Help/release/dev/install-EXPORT-absolute-prefix.rst b/Help/release/dev/install-EXPORT-absolute-prefix.rst new file mode 100644 index 0000000..1b2a01c --- /dev/null +++ b/Help/release/dev/install-EXPORT-absolute-prefix.rst @@ -0,0 +1,9 @@ +install-EXPORT-absolute-prefix +------------------------------ + +* The :command:`install(EXPORT)` command now works with an absolute + ``DESTINATION`` even if targets in the export set are installed + with a destination or usage requirements specified relative to the + install prefix. The value of the :variable:`CMAKE_INSTALL_PREFIX` + variable is hard-coded into the installed export file as the base + for relative references. diff --git a/Help/release/dev/vs-nsight-tegra-min-api.rst b/Help/release/dev/vs-nsight-tegra-min-api.rst new file mode 100644 index 0000000..f8fa056 --- /dev/null +++ b/Help/release/dev/vs-nsight-tegra-min-api.rst @@ -0,0 +1,5 @@ +vs-nsight-tegra-min-api +----------------------- + +* A :prop_tgt:`ANDROID_API_MIN` target property was introduced to + specify the minimum version to be targeted by the toolchain. diff --git a/Help/variable/CMAKE_ANDROID_API_MIN.rst b/Help/variable/CMAKE_ANDROID_API_MIN.rst new file mode 100644 index 0000000..0246c75 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_API_MIN.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_API_MIN +--------------------- + +Default value for the :prop_tgt:`ANDROID_API_MIN` target property. +See that target property for additional information. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a4c982f..97f57a3 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -39,6 +39,10 @@ else() set(CMAKE_USE_ELF_PARSER) endif() +if(APPLE) + set(CMAKE_USE_MACH_PARSER 1) +endif() + set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) # ensure Unicode friendly APIs are used on Windows @@ -140,6 +144,11 @@ if(CMAKE_USE_ELF_PARSER) set(ELF_SRCS cmELF.h cmELF.cxx) endif() +# Check if we can build the Mach-O parser. +if(CMAKE_USE_MACH_PARSER) + set(MACH_SRCS cmMachO.h cmMachO.cxx) +endif() + # # Sources for CMakeLib # @@ -267,6 +276,7 @@ set(SRCS cmLocalGenerator.cxx cmLocalGenerator.h cmLocalUnixMakefileGenerator3.cxx + ${MACH_SRCS} cmMakeDepend.cxx cmMakeDepend.h cmMakefile.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4f5fc38..4c4c90d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 1) -set(CMake_VERSION_PATCH 20141217) +set(CMake_VERSION_PATCH 20141223) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 089e84b..09cf760 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -1202,6 +1202,10 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, return; } std::string ofile = files[0]; + if ( ofile.empty() ) + { + return; + } // put a scope around this to close ifs so the file can be removed { cmsys::ifstream ifs(ofile.c_str()); diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index fc90bc1..85d066b 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.cxx +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -81,7 +81,6 @@ public: this->Coverage.TotalCoverage[filename]; CoverageVector = localCoverageVector; localCoverageVector.clear(); - foundFile=false; } foundFile= true; inSource = false; @@ -122,7 +121,6 @@ public: FileLinesType& CoverageVector = this->Coverage.TotalCoverage[filename]; CoverageVector = localCoverageVector; - foundFile=false; localCoverageVector.clear(); return true; } diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index ad71c85..8e331b1 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -136,8 +136,6 @@ public: break; } pos = lastoffset+1; - endnamepos = 0; - lastoffset =0; } /* * Glob through the source directory for the diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 2b0280d..79776f4 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -16,5 +16,6 @@ #cmakedefine HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE #cmakedefine HAVE_UNSETENV #cmakedefine CMAKE_USE_ELF_PARSER +#cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 23180f1..3f5866a 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -69,13 +69,24 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateExpectedTargetsCode(os, expectedTargets); } - // Add code to compute the installation prefix relative to the - // import file location. + // Set an _IMPORT_PREFIX variable for import location properties + // to reference if they are relative to the install prefix. + std::string installPrefix = + this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); const char* installDest = this->IEGen->GetDestination(); - if(!cmSystemTools::FileIsFullPath(installDest)) + if(cmSystemTools::FileIsFullPath(installDest)) { - std::string installPrefix = - this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); + // The export file is being installed to an absolute path so the + // package is not relocatable. Use the configured install prefix. + os << + "# The installation prefix configured by this project.\n" + "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n" + "\n"; + } + else + { + // Add code to compute the installation prefix relative to the + // import file location. std::string absDest = installPrefix + "/" + installDest; std::string absDestS = absDest + "/"; os << "# Compute the installation prefix relative to this file.\n" @@ -106,9 +117,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) dest = cmSystemTools::GetFilenamePath(dest); } os << "\n"; - - // Import location properties may reference this variable. - this->ImportPrefix = "${_IMPORT_PREFIX}/"; } std::vector<std::string> missingTargets; @@ -209,12 +217,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) << "\n"; // Cleanup the import prefix variable. - if(!this->ImportPrefix.empty()) - { - os << "# Cleanup temporary variables.\n" - << "set(_IMPORT_PREFIX)\n" - << "\n"; - } + os << "# Cleanup temporary variables.\n" + << "set(_IMPORT_PREFIX)\n" + << "\n"; this->GenerateImportedFileCheckLoop(os); bool result = true; @@ -394,11 +399,7 @@ cmExportInstallFileGenerator if(!cmSystemTools::FileIsFullPath(dest.c_str())) { // The target is installed relative to the installation prefix. - if(this->ImportPrefix.empty()) - { - this->ComplainAboutImportPrefix(itgen); - } - value = this->ImportPrefix; + value = "${_IMPORT_PREFIX}/"; } value += dest; value += "/"; @@ -508,24 +509,6 @@ cmExportInstallFileGenerator return namespaces; } - -//---------------------------------------------------------------------------- -void -cmExportInstallFileGenerator -::ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen) -{ - const char* installDest = this->IEGen->GetDestination(); - cmOStringStream e; - e << "install(EXPORT \"" - << this->IEGen->GetExportSet()->GetName() - << "\") given absolute " - << "DESTINATION \"" << installDest << "\" but the export " - << "references an installation of target \"" - << itgen->GetTarget()->GetName() << "\" which has relative " - << "DESTINATION \"" << itgen->GetDestination() << "\"."; - cmSystemTools::Error(e.str().c_str()); -} - //---------------------------------------------------------------------------- void cmExportInstallFileGenerator diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index b851ad5..6f86ac9 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -83,14 +83,10 @@ protected: std::set<std::string>& importedLocations ); - void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen); - std::string InstallNameDir(cmTarget* target, const std::string& config); cmInstallExportGenerator* IEGen; - std::string ImportPrefix; - // The import file generated for each configuration. std::map<std::string, std::string> ConfigImportFiles; }; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index de6e915..6a480a9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1925,7 +1925,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("BUNDLE")); - if (target.GetPropertyAsBool("BUNDLE")) + if (target.IsCFBundleOnApple()) { // It turns out that a BUNDLE is basically the same // in many ways as an application bundle, as far as diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx new file mode 100644 index 0000000..1607845 --- /dev/null +++ b/Source/cmMachO.cxx @@ -0,0 +1,419 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + 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 "cmStandardIncludes.h" // to get CMAKE_USE_MACH_PARSER first +#include "cmMachO.h" + +#include <cmsys/FStream.hxx> + +// Include the Mach-O format information system header. +#include <mach-o/loader.h> +#include <mach-o/fat.h> + +/** + + https://developer.apple.com/library/mac/documentation/ + DeveloperTools/Conceptual/MachORuntime/index.html + + A Mach-O file has 3 major regions: header, load commands and segments. + Data Structures are provided from <mach-o/loader.h> which + correspond to the file structure. + + The header can be either a struct mach_header or struct mach_header_64. + One can peek at the first 4 bytes to identify the type of header. + + Following is the load command region which starts with + struct load_command, and is followed by n number of load commands. + + In the case of a universal binary (an archive of multiple Mach-O files), + the file begins with a struct fat_header and is followed by multiple + struct fat_arch instances. The struct fat_arch indicates the offset + for each Mach-O file. + + */ + +namespace { + + // peek in the file + template <typename T> + bool peek(cmsys::ifstream& fin, T &v) + { + std::streampos p = fin.tellg(); + if(!fin.read(reinterpret_cast<char*>(&v), sizeof(T))) + { + return false; + } + fin.seekg(p); + return fin.good(); + } + + // read from the file and fill a data structure + template <typename T> + bool read(cmsys::ifstream& fin, T& v) + { + if(!fin.read(reinterpret_cast<char*>(&v), sizeof(T))) + { + return false; + } + return true; + } + + // read from the file and fill multiple data structures where + // the vector has been resized + template <typename T> + bool read(cmsys::ifstream& fin, std::vector<T>& v) + { + // nothing to read + if(v.empty()) + { + return true; + } + if(!fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size())) + { + return false; + } + return true; + } +} + + +// Contains header and load commands for a single Mach-O file +class cmMachOHeaderAndLoadCommands +{ +public: + // A load_command and its associated data + struct RawLoadCommand + { + uint32_t type(const cmMachOHeaderAndLoadCommands* m) const + { + if(this->LoadCommand.size() < sizeof(load_command)) + { + return 0; + } + const load_command* cmd = + reinterpret_cast<const load_command*>(&this->LoadCommand[0]); + return m->swap(cmd->cmd); + } + std::vector<char> LoadCommand; + }; + + cmMachOHeaderAndLoadCommands(bool _swap) + : Swap(_swap) + { + } + virtual ~cmMachOHeaderAndLoadCommands() + { + } + + virtual bool read_mach_o(cmsys::ifstream& fin) = 0; + + const std::vector<RawLoadCommand>& load_commands() const + { + return this->LoadCommands; + } + + uint32_t swap(uint32_t v) const + { + if(this->Swap) + { + char* c = reinterpret_cast<char*>(&v); + std::swap(c[0], c[3]); + std::swap(c[1], c[2]); + } + return v; + } + +protected: + bool read_load_commands(uint32_t ncmds, uint32_t sizeofcmds, + cmsys::ifstream& fin); + + bool Swap; + std::vector<RawLoadCommand> LoadCommands; +}; + +// Implementation for reading Mach-O header and load commands. +// This is 32 or 64 bit arch specific. +template <class T> +class cmMachOHeaderAndLoadCommandsImpl : public cmMachOHeaderAndLoadCommands +{ +public: + cmMachOHeaderAndLoadCommandsImpl(bool _swap) + : cmMachOHeaderAndLoadCommands(_swap) + { + } + bool read_mach_o(cmsys::ifstream& fin) + { + if(!read(fin, this->Header)) + { + return false; + } + this->Header.cputype = swap(this->Header.cputype); + this->Header.cpusubtype = swap(this->Header.cpusubtype); + this->Header.filetype = swap(this->Header.filetype); + this->Header.ncmds = swap(this->Header.ncmds); + this->Header.sizeofcmds = swap(this->Header.sizeofcmds); + this->Header.flags = swap(this->Header.flags); + + return read_load_commands(this->Header.ncmds, + this->Header.sizeofcmds, + fin); + } +protected: + T Header; +}; + + +bool cmMachOHeaderAndLoadCommands::read_load_commands(uint32_t ncmds, + uint32_t sizeofcmds, + cmsys::ifstream& fin) +{ + uint32_t size_read = 0; + this->LoadCommands.resize(ncmds); + for(uint32_t i = 0; i<ncmds; i++) + { + load_command lc; + if(!peek(fin, lc)) + { + return false; + } + lc.cmd = swap(lc.cmd); + lc.cmdsize = swap(lc.cmdsize); + size_read += lc.cmdsize; + + RawLoadCommand& c = this->LoadCommands[i]; + c.LoadCommand.resize(lc.cmdsize); + if(!read(fin, c.LoadCommand)) + { + return false; + } + } + + if(size_read != sizeofcmds) + { + this->LoadCommands.clear(); + return false; + } + + return true; +} + +//---------------------------------------------------------------------------- +class cmMachOInternal +{ +public: + cmMachOInternal(const char* fname); + ~cmMachOInternal(); + + // read a Mach-O file + bool read_mach_o(uint32_t file_offset); + + // the file we are reading + cmsys::ifstream Fin; + + // The archs in the universal binary + // If the binary is not a universal binary, this will be empty. + std::vector<fat_arch> FatArchs; + + // the error message while parsing + std::string ErrorMessage; + + // the list of Mach-O's + std::vector<cmMachOHeaderAndLoadCommands*> MachOList; +}; + +cmMachOInternal::cmMachOInternal(const char* fname) + : Fin(fname) +{ + // Quit now if the file could not be opened. + if(!this->Fin || !this->Fin.get() ) + { + this->ErrorMessage = "Error opening input file."; + return; + } + + if(!this->Fin.seekg(0)) + { + this->ErrorMessage = "Error seeking to beginning of file."; + return; + } + + // Read the binary identification block. + uint32_t magic = 0; + if(!peek(this->Fin, magic)) + { + this->ErrorMessage = "Error reading Mach-O identification."; + return; + } + + // Verify the binary identification. + if(!(magic == MH_CIGAM || + magic == MH_MAGIC || + magic == MH_CIGAM_64 || + magic == MH_MAGIC_64 || + magic == FAT_CIGAM || + magic == FAT_MAGIC)) + { + this->ErrorMessage = "File does not have a valid Mach-O identification."; + return; + } + + if(magic == FAT_MAGIC || magic == FAT_CIGAM) + { + // this is a universal binary + fat_header header; + if(!read(this->Fin, header)) + { + this->ErrorMessage = "Error reading fat header."; + return; + } + + // read fat_archs + this->FatArchs.resize(OSSwapBigToHostInt32(header.nfat_arch)); + if(!read(this->Fin, this->FatArchs)) + { + this->ErrorMessage = "Error reading fat header archs."; + return; + } + + // parse each Mach-O file + for(size_t i=0; i<this->FatArchs.size(); i++) + { + const fat_arch& arch = this->FatArchs[i]; + if(!this->read_mach_o(OSSwapBigToHostInt32(arch.offset))) + { + return; + } + } + } + else + { + // parse Mach-O file at the beginning of the file + this->read_mach_o(0); + } +} + +cmMachOInternal::~cmMachOInternal() +{ + for(size_t i=0; i<this->MachOList.size(); i++) + { + delete this->MachOList[i]; + } +} + +bool cmMachOInternal::read_mach_o(uint32_t file_offset) +{ + if(!this->Fin.seekg(file_offset)) + { + this->ErrorMessage = "Failed to locate Mach-O content."; + return false; + } + + uint32_t magic; + if(!peek(this->Fin, magic)) + { + this->ErrorMessage = "Error reading Mach-O identification."; + return false; + } + + cmMachOHeaderAndLoadCommands* f = NULL; + if(magic == MH_CIGAM || magic == MH_MAGIC) + { + bool swap = false; + if(magic == MH_CIGAM) + { + swap = true; + } + f = new cmMachOHeaderAndLoadCommandsImpl<mach_header>(swap); + } + else if(magic == MH_CIGAM_64 || magic == MH_MAGIC_64) + { + bool swap = false; + if(magic == MH_CIGAM_64) + { + swap = true; + } + f = new cmMachOHeaderAndLoadCommandsImpl<mach_header_64>(swap); + } + + if(f && f->read_mach_o(this->Fin)) + { + this->MachOList.push_back(f); + } + else + { + delete f; + this->ErrorMessage = "Failed to read Mach-O header."; + return false; + } + + return true; +} + +//============================================================================ +// External class implementation. + +//---------------------------------------------------------------------------- +cmMachO::cmMachO(const char* fname): Internal(0) +{ + this->Internal = new cmMachOInternal(fname); + +} + +//---------------------------------------------------------------------------- +cmMachO::~cmMachO() +{ + delete this->Internal; +} + +std::string const& cmMachO::GetErrorMessage() const +{ + return this->Internal->ErrorMessage; +} + +//---------------------------------------------------------------------------- +bool cmMachO::Valid() const +{ + return !this->Internal->MachOList.empty(); +} + +bool cmMachO::GetInstallName(std::string& install_name) +{ + if(this->Internal->MachOList.empty()) + { + return false; + } + + // grab the first Mach-O and get the install name from that one + cmMachOHeaderAndLoadCommands* macho = this->Internal->MachOList[0]; + for(size_t i=0; i<macho->load_commands().size(); i++) + { + const cmMachOHeaderAndLoadCommands::RawLoadCommand &cmd = + macho->load_commands()[i]; + uint32_t lc_cmd = cmd.type(macho); + if(lc_cmd == LC_ID_DYLIB || + lc_cmd == LC_LOAD_WEAK_DYLIB || + lc_cmd == LC_LOAD_DYLIB) + { + if(sizeof(dylib_command) < cmd.LoadCommand.size()) + { + uint32_t namelen = cmd.LoadCommand.size() - sizeof(dylib_command); + install_name.assign(&cmd.LoadCommand[sizeof(dylib_command)], namelen); + return true; + } + } + } + + return false; +} + +void cmMachO::PrintInfo(std::ostream& /*os*/) const +{ +} diff --git a/Source/cmMachO.h b/Source/cmMachO.h new file mode 100644 index 0000000..f06f8de --- /dev/null +++ b/Source/cmMachO.h @@ -0,0 +1,51 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + 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. +============================================================================*/ +#ifndef cmMachO_h +#define cmMachO_h + +#if !defined(CMAKE_USE_MACH_PARSER) +# error "This file may be included only if CMAKE_USE_MACH_PARSER is enabled." +#endif + +class cmMachOInternal; + +/** \class cmMachO + * \brief Executable and Link Format (Mach-O) parser. + */ +class cmMachO +{ +public: + /** Construct with the name of the Mach-O input file to parse. */ + cmMachO(const char* fname); + + /** Destruct. */ + ~cmMachO(); + + /** Get the error message if any. */ + std::string const& GetErrorMessage() const; + + /** Boolean conversion. True if the Mach-O file is valid. */ + operator bool() const { return this->Valid(); } + + /** Get Install name from binary **/ + bool GetInstallName(std::string& install_name); + + /** Print human-readable information about the Mach-O file. */ + void PrintInfo(std::ostream& os) const; + +private: + friend class cmMachOInternal; + bool Valid() const; + cmMachOInternal* Internal; +}; + +#endif diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c83dc2a..1c8c387 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -63,6 +63,10 @@ # include "cmELF.h" #endif +#if defined(CMAKE_USE_MACH_PARSER) +# include "cmMachO.h" +#endif + class cmSystemToolsFileTime { public: @@ -2357,31 +2361,17 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath, std::string& soname) { - std::vector<std::string> cmds; - cmds.push_back("otool"); - cmds.push_back("-D"); - cmds.push_back(fullPath); - - std::string output; - if(!RunSingleCommand(cmds, &output, 0, 0, OUTPUT_NONE)) +#if defined(CMAKE_USE_MACH_PARSER) + cmMachO macho(fullPath.c_str()); + if(macho) { - cmds.insert(cmds.begin(), "-r"); - cmds.insert(cmds.begin(), "xcrun"); - if(!RunSingleCommand(cmds, &output, 0, 0, OUTPUT_NONE)) - { - return false; - } + return macho.GetInstallName(soname); } +#else + (void)fullPath; + (void)soname; +#endif - std::vector<std::string> strs = cmSystemTools::tokenize(output, "\n"); - // otool returns extra lines reporting multiple install names - // in case the binary is multi-arch and none of the architectures - // is native (e.g. i386;ppc on x86_64) - if(strs.size() >= 2) - { - soname = strs[1]; - return true; - } return false; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 37aa26e..94a6de3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -325,6 +325,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { this->SetPropertyDefault("ANDROID_API", 0); + this->SetPropertyDefault("ANDROID_API_MIN", 0); this->SetPropertyDefault("INSTALL_NAME_DIR", 0); this->SetPropertyDefault("INSTALL_RPATH", ""); this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF"); @@ -4056,15 +4057,8 @@ void cmTarget::GetFullNameInternal(const std::string& config, if(this->IsCFBundleOnApple()) { - fw_prefix = this->GetOutputName(config, false); - fw_prefix += "."; - const char *ext = this->GetProperty("BUNDLE_EXTENSION"); - if (!ext) - { - ext = "bundle"; - } - fw_prefix += ext; - fw_prefix += "/Contents/MacOS/"; + fw_prefix = this->GetCFBundleDirectory(config, false); + fw_prefix += "/"; targetPrefix = fw_prefix.c_str(); targetSuffix = 0; } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f903bdb..b265c0e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -748,6 +748,12 @@ void cmVisualStudio10TargetGenerator ntv += toolset? toolset : "Default"; ntv += "</NdkToolchainVersion>\n"; this->WriteString(ntv.c_str(), 2); + if(const char* minApi = this->Target->GetProperty("ANDROID_API_MIN")) + { + this->WriteString("<AndroidMinAPI>", 2); + (*this->BuildFileStream ) << + "android-" << cmVS10EscapeXML(minApi) << "</AndroidMinAPI>\n"; + } if(const char* api = this->Target->GetProperty("ANDROID_API")) { this->WriteString("<AndroidTargetAPI>", 2); diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c index 4738920..b90e060 100644 --- a/Source/cm_sha2.c +++ b/Source/cm_sha2.c @@ -663,7 +663,7 @@ void SHA1_Update(SHA_CTX* context, const sha_byte *data, size_t len) { context->s1.bitcount += freespace << 3; len -= freespace; data += freespace; - SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer); + SHA1_Internal_Transform(context, (const sha_word32*)context->s1.buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->s1.buffer[usedspace], data, len); @@ -675,7 +675,7 @@ void SHA1_Update(SHA_CTX* context, const sha_byte *data, size_t len) { } while (len >= 64) { /* Process as many complete blocks as we can */ - SHA1_Internal_Transform(context, (sha_word32*)data); + SHA1_Internal_Transform(context, (const sha_word32*)data); context->s1.bitcount += 512; len -= 64; data += 64; @@ -724,7 +724,7 @@ void SHA1_Final(sha_byte digest[], SHA_CTX* context) { MEMSET_BZERO(&context->s1.buffer[usedspace], 64 - usedspace); } /* Do second-to-last transform: */ - SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer); + SHA1_Internal_Transform(context, (const sha_word32*)context->s1.buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->s1.buffer, 56); @@ -741,7 +741,7 @@ void SHA1_Final(sha_byte digest[], SHA_CTX* context) { sizeof(sha_word64)); /* Final transform: */ - SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer); + SHA1_Internal_Transform(context, (const sha_word32*)context->s1.buffer); /* Save the hash data for output: */ #if BYTE_ORDER == LITTLE_ENDIAN @@ -1004,7 +1004,7 @@ void SHA256_Update(SHA_CTX* context, const sha_byte *data, size_t len) { context->s256.bitcount += freespace << 3; len -= freespace; data += freespace; - SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer); + SHA256_Internal_Transform(context, (const sha_word32*)context->s256.buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->s256.buffer[usedspace], data, len); @@ -1016,7 +1016,7 @@ void SHA256_Update(SHA_CTX* context, const sha_byte *data, size_t len) { } while (len >= 64) { /* Process as many complete blocks as we can */ - SHA256_Internal_Transform(context, (sha_word32*)data); + SHA256_Internal_Transform(context, (const sha_word32*)data); context->s256.bitcount += 512; len -= 64; data += 64; @@ -1050,7 +1050,7 @@ void SHA256_Internal_Last(SHA_CTX* context) { MEMSET_BZERO(&context->s256.buffer[usedspace], 64 - usedspace); } /* Do second-to-last transform: */ - SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer); + SHA256_Internal_Transform(context, (const sha_word32*)context->s256.buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->s256.buffer, 56); @@ -1069,7 +1069,7 @@ void SHA256_Internal_Last(SHA_CTX* context) { sizeof(sha_word64)); /* Final transform: */ - SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer); + SHA256_Internal_Transform(context, (const sha_word32*)context->s256.buffer); } void SHA256_Final(sha_byte digest[], SHA_CTX* context) { @@ -1412,7 +1412,7 @@ void SHA512_Update(SHA_CTX* context, const sha_byte *data, size_t len) { ADDINC128(context->s512.bitcount, freespace << 3); len -= freespace; data += freespace; - SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer); + SHA512_Internal_Transform(context, (const sha_word64*)context->s512.buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->s512.buffer[usedspace], data, len); @@ -1424,7 +1424,7 @@ void SHA512_Update(SHA_CTX* context, const sha_byte *data, size_t len) { } while (len >= 128) { /* Process as many complete blocks as we can */ - SHA512_Internal_Transform(context, (sha_word64*)data); + SHA512_Internal_Transform(context, (const sha_word64*)data); ADDINC128(context->s512.bitcount, 1024); len -= 128; data += 128; @@ -1459,7 +1459,7 @@ void SHA512_Internal_Last(SHA_CTX* context) { MEMSET_BZERO(&context->s512.buffer[usedspace], 128 - usedspace); } /* Do second-to-last transform: */ - SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer); + SHA512_Internal_Transform(context, (const sha_word64*)context->s512.buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->s512.buffer, 112); @@ -1480,7 +1480,7 @@ void SHA512_Internal_Last(SHA_CTX* context) { sizeof(sha_word64)); /* Final transform: */ - SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer); + SHA512_Internal_Transform(context, (const sha_word64*)context->s512.buffer); } void SHA512_Final(sha_byte digest[], SHA_CTX* context) { diff --git a/Source/kwsys/CONTRIBUTING.rst b/Source/kwsys/CONTRIBUTING.rst new file mode 100644 index 0000000..e097b76 --- /dev/null +++ b/Source/kwsys/CONTRIBUTING.rst @@ -0,0 +1,35 @@ +Contributing to KWSys +********************* + +Overview +======== + +KWSys is kept in its own Git repository and shared by several projects +via copies in their source trees. Changes to KWSys should not be made +directly in a host project, except perhaps in maintenance branches. + +Please visit + + http://public.kitware.com/Wiki/KWSys/Git + +to contribute changes directly to KWSys upstream. Once changes are +reviewed, tested, and integrated there then the copies of KWSys within +dependent projects can be updated to get the changes. + +Issues +====== + +KWSys has no independent issue tracker. After encountering an issue +(bug) please try to submit a patch using the above instructions. +Otherwise please report the issue to the tracker for the project that +hosts the copy of KWSys in which the problem was found. + +License +======= + +We do not require any formal copyright assignment or contributor license +agreement. Any contributions intentionally sent upstream are presumed +to be offerred under terms of the OSI-approved BSD 3-clause License. +See `Copyright.txt`_ for details. + +.. _`Copyright.txt`: Copyright.txt diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx index 741bcba..04b2866 100644 --- a/Source/kwsys/Directory.cxx +++ b/Source/kwsys/Directory.cxx @@ -203,13 +203,18 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na #include <sys/types.h> #include <dirent.h> -/* There is a problem with the Portland compiler, large file -support and glibc/Linux system headers: -http://www.pgroup.com/userforum/viewtopic.php? -p=1992&sid=f16167f51964f1a68fe5041b8eb213b6 -*/ -#if defined(__PGI) && defined(__USE_FILE_OFFSET64) -# define dirent dirent64 +// PGI with glibc has trouble with dirent and large file support: +// http://www.pgroup.com/userforum/viewtopic.php? +// p=1992&sid=f16167f51964f1a68fe5041b8eb213b6 +// Work around the problem by mapping dirent the same way as readdir. +#if defined(__PGI) && defined(__GLIBC__) +# define kwsys_dirent_readdir dirent +# define kwsys_dirent_readdir64 dirent64 +# define kwsys_dirent kwsys_dirent_lookup(readdir) +# define kwsys_dirent_lookup(x) kwsys_dirent_lookup_delay(x) +# define kwsys_dirent_lookup_delay(x) kwsys_dirent_##x +#else +# define kwsys_dirent dirent #endif namespace KWSYS_NAMESPACE @@ -226,7 +231,7 @@ bool Directory::Load(const kwsys_stl::string& name) return 0; } - for (dirent* d = readdir(dir); d; d = readdir(dir) ) + for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) ) { this->Internal->Files.push_back(d->d_name); } @@ -240,7 +245,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na DIR* dir = opendir(name.c_str()); unsigned long count = 0; - for (dirent* d = readdir(dir); d; d = readdir(dir) ) + for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) ) { count++; } diff --git a/Source/kwsys/README.txt b/Source/kwsys/README.txt index ba03f8d..b8191f7 100644 --- a/Source/kwsys/README.txt +++ b/Source/kwsys/README.txt @@ -8,3 +8,5 @@ details. You are probably reading this file in the source tree of a surrounding project. In that case, see "../README.kwsys" for details of using KWSys in your project. + +See CONTRIBUTING.rst for instructions to contribute KWSys changes. diff --git a/Source/kwsys/SharedForward.h.in b/Source/kwsys/SharedForward.h.in index c6f345f..f22fa58 100644 --- a/Source/kwsys/SharedForward.h.in +++ b/Source/kwsys/SharedForward.h.in @@ -65,6 +65,15 @@ See the comments below for specific explanations of each macro. */ +/* Disable -Wcast-qual warnings since they are too hard to fix in a + cross-platform way. */ +#if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wcast-qual") +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wcast-qual" +# endif +#endif + /*--------------------------------------------------------------------------*/ /* Full path to the directory in which this executable is built. Do @@ -917,6 +926,13 @@ static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv_in) return 1; } +/* Restore warning stack. */ +#if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wcast-qual") +# pragma clang diagnostic pop +# endif +#endif + #else # error "@KWSYS_NAMESPACE@/SharedForward.h should be included only once." #endif diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 3e1a1ab..3d5e728 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -443,7 +443,7 @@ public: }; protected: - // Functions. + // For windows bool RetrieveCPUFeatures(); bool RetrieveCPUIdentity(); bool RetrieveCPUCacheDetails(); @@ -457,6 +457,7 @@ protected: bool RetrieveClassicalCPUIdentity(); bool RetrieveExtendedCPUIdentity(); + // Processor information Manufacturer ChipManufacturer; CPUFeatures Features; ID ChipID; @@ -464,11 +465,11 @@ protected: unsigned int NumberOfLogicalCPU; unsigned int NumberOfPhysicalCPU; - int CPUCount(); + int CPUCount(); // For windows unsigned char LogicalCPUPerPhysicalCPU(); - unsigned char GetAPICId(); + unsigned char GetAPICId(); // For windows bool IsHyperThreadingSupported(); - static LongLong GetCyclesDifference(DELAY_FUNC, unsigned int); + static LongLong GetCyclesDifference(DELAY_FUNC, unsigned int); // For windows // For Linux and Cygwin, /proc/cpuinfo formats are slightly different bool RetreiveInformationFromCpuInfoFile(); @@ -3753,9 +3754,9 @@ bool SystemInformationImplementation::QueryWindowsMemory() } # define MEM_VAL(value) ull##value # endif - tv = ms.MEM_VAL(TotalVirtual); + tv = ms.MEM_VAL(TotalPageFile); tp = ms.MEM_VAL(TotalPhys); - av = ms.MEM_VAL(AvailVirtual); + av = ms.MEM_VAL(AvailPageFile); ap = ms.MEM_VAL(AvailPhys); this->TotalVirtualMemory = tv>>10>>10; this->TotalPhysicalMemory = tp>>10>>10; diff --git a/Tests/CFBundleTest/VerifyResult.cmake b/Tests/CFBundleTest/VerifyResult.cmake index e622900..e637bb1 100644 --- a/Tests/CFBundleTest/VerifyResult.cmake +++ b/Tests/CFBundleTest/VerifyResult.cmake @@ -14,13 +14,10 @@ message(STATUS "CTEST_CONFIGURATION_TYPE='${CTEST_CONFIGURATION_TYPE}'") message(STATUS "dir='${dir}'") message(STATUS "gen='${gen}'") -if(gen MATCHES "Make" OR - "${CTEST_CONFIGURATION_TYPE}" STREQUAL "" OR - "${CTEST_CONFIGURATION_TYPE}" STREQUAL "." OR - "${CTEST_CONFIGURATION_TYPE}" STREQUAL "NoConfig") - set(expected_filename "${dir}/CFBundleTest.plugin/Contents/MacOS/CFBundleTest") -else() +if(gen STREQUAL "Xcode") set(expected_filename "${dir}/${CTEST_CONFIGURATION_TYPE}/CFBundleTest.plugin/Contents/MacOS/CFBundleTest") +else() + set(expected_filename "${dir}/CFBundleTest.plugin/Contents/MacOS/CFBundleTest") endif() if(NOT EXISTS "${expected_filename}") diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 8c99f64..7ef3c03 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -48,3 +48,5 @@ if(TEST_CompileCommandOutput) add_executable(runcompilecommands run_compile_commands.cxx) target_link_libraries(runcompilecommands CMakeLib) endif() + +add_subdirectory(PseudoMemcheck) diff --git a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt new file mode 100644 index 0000000..c53befc --- /dev/null +++ b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt @@ -0,0 +1,41 @@ +foreach (_retval 0 1) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY) +endforeach () + +include_directories(${CMake_SOURCE_DIR}/Source ${CMake_BINARY_DIR}/Source) + +# create binaries that we will use as a pseudo memory checker +add_executable(pseudo_valgrind "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") +set_target_properties(pseudo_valgrind PROPERTIES OUTPUT_NAME valgrind) +target_link_libraries(pseudo_valgrind CMakeLib) + +add_executable(pseudo_purify "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") +set_target_properties(pseudo_purify PROPERTIES OUTPUT_NAME purify) +target_link_libraries(pseudo_purify CMakeLib) +add_executable(pseudo_BC "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") +set_target_properties(pseudo_BC PROPERTIES OUTPUT_NAME BC) +target_link_libraries(pseudo_BC CMakeLib) + +# binary to be used as pre- and post-memcheck command that fails +add_executable(memcheck_fail "${CMAKE_CURRENT_BINARY_DIR}/ret1.cxx") +target_link_libraries(memcheck_fail CMakeLib) + +# Binaries that are used as memchecker that do not write the expected +# output file. Need to be in their own subdirectory as they have the +# same filenames. +add_subdirectory(NoLog) + +# Xcode 2.x forgets to create the output directory before linking +# the individual architectures. +if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + foreach(t + memcheck_fail + pseudo_BC + pseudo_purify + pseudo_valgrind + ) + add_custom_command(TARGET ${t} + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" + ) + endforeach() +endif() diff --git a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt index 3a45bfe..3a45bfe 100644 --- a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt +++ b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in index 43c0ba7..43c0ba7 100644 --- a/Tests/CTestTestMemcheck/memtester.cxx.in +++ b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 123e5fd..8df27f4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -110,10 +110,6 @@ if(BUILD_TESTING) add_subdirectory(FindPackageModeMakefileTest) - if(NOT CMake_TEST_EXTERNAL_CMAKE) - add_subdirectory(CTestTestMemcheck) - endif() - # Collect a list of all test build directories. set(TEST_BUILD_DIRS) @@ -1939,16 +1935,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleTest") - add_test(CFBundleTest ${CMAKE_CTEST_COMMAND} + add_test(NAME CFBundleTest COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CFBundleTest" "${CMake_BINARY_DIR}/Tests/CFBundleTest" --build-two-config ${build_generator_args} --build-project CFBundleTest + --build-config $<CONFIGURATION> --build-options ${build_options} --test-command - ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=\${CTEST_CONFIGURATION_TYPE} + ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=$<CONFIGURATION> -Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest -Dgen=${CMAKE_GENERATOR} -P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake) diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in index 59b2890..33fe5f3 100644 --- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in +++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in @@ -268,12 +268,12 @@ if(NOT ov STREQUAL "") if(consider) if(is_git_checkout) - if(line MATCHES "^#[ \t]*modified:") + if(line MATCHES "^#?[ \t]*modified:") message(" locally modified file detected...") set(modifications 1) endif() - if(line MATCHES "^# Untracked") + if(line MATCHES "^(# )?Untracked") message(" locally non-added file/directory detected...") set(nonadditions 1) endif() diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt deleted file mode 100644 index 2023e74..0000000 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ /dev/null @@ -1,290 +0,0 @@ -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") - -get_filename_component(CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR - "${CMAKE_CURRENT_BINARY_DIR}" REALPATH -) - -REGEX_ESCAPE_STRING(CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR - "${CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR}" -) - -foreach (_retval 0 1) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY) -endforeach () - -include_directories(${CMake_SOURCE_DIR}/Source ${CMake_BINARY_DIR}/Source) - -# create binaries that we will use as a pseudo memory checker -add_executable(pseudo_valgrind "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") -set_target_properties(pseudo_valgrind PROPERTIES OUTPUT_NAME valgrind) -target_link_libraries(pseudo_valgrind CMakeLib) - -add_executable(pseudo_purify "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") -set_target_properties(pseudo_purify PROPERTIES OUTPUT_NAME purify) -target_link_libraries(pseudo_purify CMakeLib) -add_executable(pseudo_BC "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") -set_target_properties(pseudo_BC PROPERTIES OUTPUT_NAME BC) -target_link_libraries(pseudo_BC CMakeLib) - -# binary to be used as pre- and post-memcheck command that fails -add_executable(memcheck_fail "${CMAKE_CURRENT_BINARY_DIR}/ret1.cxx") -target_link_libraries(memcheck_fail CMakeLib) - -# Binaries that are used as memchecker that do not write the expected -# output file. Need to be in their own subdirectory as they have the -# same filenames. -add_subdirectory(NoLogDummyChecker) - -if(APPLE) - # filter out additional messages by Guard Malloc integrated in Xcode - set(guard_malloc_msg "ctest\\([0-9]+\\) malloc: ") - set(guard_malloc_lines "(${guard_malloc_msg}[^\n]*\n)*") - set(guard_malloc_output "${guard_malloc_msg}|") -else() - set(guard_malloc_msg "") - set(guard_malloc_lines "") - set(guard_malloc_output "") -endif() - -# When this entire test runs under coverage or memcheck tools -# they may add output to the end, so match known cases: -# - Bullseye adds a "BullseyeCoverage..." line. -# - Valgrind memcheck may add extra "==..." lines. -set(other_tool_output "((${guard_malloc_output}BullseyeCoverage|==)[^\n]*\n)*") - -string(REPLACE "\r\n" "\n" ctest_and_tool_outputs " -1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec -${guard_malloc_lines} -100% tests passed, 0 tests failed out of 1 -.* --- Processing memory checking output:( ) -${guard_malloc_lines}Memory checking results: -${other_tool_output}") - -function(gen_mc_test_internal NAME CHECKER) - set(SUBTEST_NAME "${NAME}") - set(CHECKER_COMMAND "${CHECKER}") - foreach(_file IN ITEMS CMakeLists.txt CTestConfig.cmake test.cmake) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${_file}.in" - "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${_file}" @ONLY) - endforeach() - add_test(NAME CTestTestMemcheck${NAME} - COMMAND ${CMAKE_CTEST_COMMAND} - -C $<CONFIGURATION> - -S "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake" -V - --output-log "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/testOutput.log" - ${ARGN} - ) -endfunction(gen_mc_test_internal) - -function(gen_mc_test NAME CHECKER) - gen_mc_test_internal(${NAME} "${CHECKER}" - -D PSEUDO_BC=$<TARGET_FILE:pseudo_BC> - -D PSEUDO_PURIFY=$<TARGET_FILE:pseudo_purify> - -D PSEUDO_VALGRIND=$<TARGET_FILE:pseudo_valgrind> - -D ERROR_COMMAND=$<TARGET_FILE:memcheck_fail> - ${ARGN} - ) -endfunction(gen_mc_test) - -function(gen_mcnl_test NAME CHECKER) - gen_mc_test_internal(${NAME} ${CHECKER} - -D PSEUDO_BC=$<TARGET_FILE:pseudonl_BC> - -D PSEUDO_PURIFY=$<TARGET_FILE:pseudonl_purify> - -D PSEUDO_VALGRIND=$<TARGET_FILE:pseudonl_valgrind> - ${ARGN} - ) - set_tests_properties(CTestTestMemcheck${NAME} - PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${NAME}/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake\n") -endfunction(gen_mcnl_test) - -unset(CTEST_EXTRA_CONFIG) -unset(CTEST_EXTRA_CODE) -unset(CMAKELISTS_EXTRA_CODE) - -#----------------------------------------------------------------------------- -# add ThreadSanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") -") -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testThreadSanitizer.cmake\") -") -gen_mc_test_internal(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) -set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) - -#----------------------------------------------------------------------------- -# add LeakSanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") -") -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testLeakSanitizer.cmake\") -") -gen_mc_test_internal(DummyLeakSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) -set_tests_properties(CTestTestMemcheckDummyLeakSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*Direct leak - 2.*Indirect leak - 1.*") - -#----------------------------------------------------------------------------- -# add AddressSanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") -") -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testAddressSanitizer.cmake\") -") -gen_mc_test_internal(DummyAddressSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) -set_tests_properties(CTestTestMemcheckDummyAddressSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*heap-buffer-overflow - 1.*") - -#----------------------------------------------------------------------------- -# add MemorySanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") -") - -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testMemorySanitizer.cmake\") -") -gen_mc_test_internal(DummyMemorySanitizer "" -DMEMCHECK_TYPE=MemorySanitizer) -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) -set_tests_properties(CTestTestMemcheckDummyMemorySanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*use-of-uninitialized-value - 1.*") - -#----------------------------------------------------------------------------- -# add UndefinedBehaviorSanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1\") -") - -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testUndefinedBehaviorSanitizer.cmake\") -") -gen_mc_test_internal(DummyUndefinedBehaviorSanitizer "" -DMEMCHECK_TYPE=UndefinedBehaviorSanitizer) -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) -set_tests_properties(CTestTestMemcheckDummyUndefinedBehaviorSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*left shift of negative value -256 - 1.*") - -#----------------------------------------------------------------------------- - -gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") -gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") -gen_mc_test(DummyBC "\${PSEUDO_BC}") -gen_mcnl_test(DummyPurifyNoLogfile "\${PSEUDO_PURIFY}") -gen_mcnl_test(DummyValgrindNoLogfile "\${PSEUDO_VALGRIND}") -gen_mcnl_test(DummyBCNoLogfile "\${PSEUDO_BC}") - -set(CTEST_EXTRA_CODE "string(REPLACE \" \" \"\\\\ \" PRE_POST_COMMAND \"\${CTEST_MEMORYCHECK_COMMAND}\") - -set(CTEST_CUSTOM_PRE_MEMCHECK \"\${PRE_POST_COMMAND} pre command\") -set(CTEST_CUSTOM_POST_MEMCHECK \"\${PRE_POST_COMMAND} post command \") -") -gen_mc_test(DummyValgrindPrePost "\${PSEUDO_VALGRIND}") - -set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_POST_MEMCHECK \"\${ERROR_COMMAND}\")") -gen_mc_test(DummyValgrindFailPost "\${PSEUDO_VALGRIND}") - -set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_PRE_MEMCHECK \"\${ERROR_COMMAND}\")") -gen_mc_test(DummyValgrindFailPre "\${PSEUDO_VALGRIND}") - -unset(CTEST_EXTRA_CODE) -set(CTEST_EXTRA_CONFIG "set(CTEST_CUSTOM_MEMCHECK_IGNORE RunCMakeAgain)\n") -set(CMAKELISTS_EXTRA_CODE "add_test(NAME RunCMakeAgain COMMAND \"\${CMAKE_COMMAND}\" --version)") -gen_mc_test(DummyValgrindIgnoreMemcheck "\${PSEUDO_VALGRIND}") - -unset(CTEST_EXTRA_CONFIG) -gen_mc_test(DummyValgrindTwoTargets "\${PSEUDO_VALGRIND}" "-VV") - -set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE \"\${CMAKE_CURRENT_BINARY_DIR}/does-not-exist\")") -unset(CMAKELISTS_EXTRA_CODE) -gen_mc_test(DummyValgrindInvalidSupFile "\${PSEUDO_VALGRIND}") - -# CTest will add the logfile option before any custom options. Set the logfile -# again, this time to an empty string. This will cause the logfile to be -# missing, which will be the prove for us that the custom option is indeed used. -set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"--log-file=\")") -gen_mc_test(DummyValgrindCustomOptions "\${PSEUDO_VALGRIND}") - -unset(CTEST_EXTRA_CONFIG) -gen_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") - -gen_mc_test(Unknown "${CMAKE_COMMAND}") - -string(REPLACE "\\" "\\\\" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND}") -string(REPLACE "(" "\\(" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") -string(REPLACE ")" "\\)" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") -string(REPLACE "+" "\\+" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") - -set_tests_properties(CTestTestMemcheckUnknown PROPERTIES - PASS_REGULAR_EXPRESSION "Do not understand memory checker: ${CMAKE_COMMAND_ESCAPED}\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/Unknown/test.cmake\n") - -set_tests_properties(CTestTestMemcheckNotExist PROPERTIES - PASS_REGULAR_EXPRESSION "Memory checker \\(MemoryCheckCommand\\) not set, or cannot find the specified program.") - -# It is a valid result if valgrind does not output any files (can e.g. happen -# if you have not compiled in debug mode), so these tests will not fail. -set_tests_properties(CTestTestMemcheckDummyValgrind - CTestTestMemcheckDummyValgrindPrePost - CTestTestMemcheckDummyPurify - PROPERTIES - PASS_REGULAR_EXPRESSION "${ctest_and_tool_outputs}$") - -foreach (_pp Pre Post) - string(TOLOWER ${_pp} _pp_lower) - set_tests_properties(CTestTestMemcheckDummyValgrindFail${_pp} - PROPERTIES - PASS_REGULAR_EXPRESSION "\nProblem running command: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}[^\n]*fail[^\n]*\n(.*\n)?Problem executing ${_pp_lower}-memcheck command\\(s\\\).\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindFail${_pp}/test.cmake\n") -endforeach () - -set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck - PROPERTIES - PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$") - -set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES - PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n${guard_malloc_lines}\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") - -set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") - -set_tests_properties(CTestTestMemcheckDummyValgrindCustomOptions PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/test.cmake\n") - -set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES - PASS_REGULAR_EXPRESSION - "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") - - -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - foreach(t - memcheck_fail - pseudo_BC - pseudo_purify - pseudo_valgrind - ) - add_custom_command(TARGET ${t} - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - endforeach() -endif() diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index febdfe6..e130eca 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -508,3 +508,18 @@ export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib ) add_subdirectory(Interface) + +#----------------------------------------------------------------------------- +# Install export with absolute destination but relative pieces. +add_library(testLibAbs1 STATIC testLibAbs1.c) +target_include_directories(testLibAbs1 INTERFACE + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/abs/1a;include/abs/1b>" + ) +install( + TARGETS testLibAbs1 + EXPORT expAbs + ARCHIVE DESTINATION lib + INCLUDES DESTINATION include/abs + ) +install(DIRECTORY include/abs DESTINATION include) +install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs) diff --git a/Tests/ExportImport/Export/include/abs/1a/testLibAbs1a.h b/Tests/ExportImport/Export/include/abs/1a/testLibAbs1a.h new file mode 100644 index 0000000..4421227 --- /dev/null +++ b/Tests/ExportImport/Export/include/abs/1a/testLibAbs1a.h @@ -0,0 +1 @@ +#define testLibAbs1a diff --git a/Tests/ExportImport/Export/include/abs/1b/testLibAbs1b.h b/Tests/ExportImport/Export/include/abs/1b/testLibAbs1b.h new file mode 100644 index 0000000..00a2a29 --- /dev/null +++ b/Tests/ExportImport/Export/include/abs/1b/testLibAbs1b.h @@ -0,0 +1 @@ +#define testLibAbs1b diff --git a/Tests/ExportImport/Export/include/abs/testLibAbs1.h b/Tests/ExportImport/Export/include/abs/testLibAbs1.h new file mode 100644 index 0000000..19d80a5 --- /dev/null +++ b/Tests/ExportImport/Export/include/abs/testLibAbs1.h @@ -0,0 +1 @@ +extern int testLibAbs1(void); diff --git a/Tests/ExportImport/Export/testLibAbs1.c b/Tests/ExportImport/Export/testLibAbs1.c new file mode 100644 index 0000000..34aec75 --- /dev/null +++ b/Tests/ExportImport/Export/testLibAbs1.c @@ -0,0 +1 @@ +int testLibAbs1(void) { return 0; } diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index eb0bbf8..9450c82 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -96,6 +96,16 @@ foreach(c DEBUG RELWITHDEBINFO) endforeach() #----------------------------------------------------------------------------- +include(${CMAKE_INSTALL_PREFIX}/lib/expAbs/expAbs.cmake) + +add_executable(imp_testExeAbs1 + imp_testExeAbs1.c + ) +target_link_libraries(imp_testExeAbs1 + expAbs_testLibAbs1 + ) + +#----------------------------------------------------------------------------- # Create a custom target to generate a header for the libraries below. # Drive the header generation through an indirect chain of imported # target dependencies. diff --git a/Tests/ExportImport/Import/A/imp_testExeAbs1.c b/Tests/ExportImport/Import/A/imp_testExeAbs1.c new file mode 100644 index 0000000..069c3f0 --- /dev/null +++ b/Tests/ExportImport/Import/A/imp_testExeAbs1.c @@ -0,0 +1,15 @@ +#include "testLibAbs1.h" +#include "testLibAbs1a.h" +#include "testLibAbs1b.h" +#ifndef testLibAbs1a +# error "testLibAbs1a not defined" +#endif +#ifndef testLibAbs1b +# error "testLibAbs1b not defined" +#endif +int main() +{ + return 0 + + testLibAbs1() + ; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 2bfd4d6..b5e41d9 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -1,7 +1,7 @@ # See adjacent README.rst for documentation of this test infrastructure. macro(add_RunCMake_test test) - add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} + add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} @@ -9,6 +9,7 @@ macro(add_RunCMake_test test) -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} ${${test}_ARGS} + ${ARGN} -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" ) endmacro() @@ -51,6 +52,19 @@ add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) add_RunCMake_test(CTest) + +if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_RunCMake_test(CTestMemcheck + -DPSEUDO_BC=$<TARGET_FILE:pseudo_BC> + -DPSEUDO_PURIFY=$<TARGET_FILE:pseudo_purify> + -DPSEUDO_VALGRIND=$<TARGET_FILE:pseudo_valgrind> + -DPSEUDO_BC_NOLOG=$<TARGET_FILE:pseudonl_BC> + -DPSEUDO_PURIFY_NOLOG=$<TARGET_FILE:pseudonl_purify> + -DPSEUDO_VALGRIND_NOLOG=$<TARGET_FILE:pseudonl_valgrind> + -DMEMCHECK_FAIL=$<TARGET_FILE:memcheck_fail> + ) +endif() + if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() @@ -131,8 +145,7 @@ if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0) add_RunCMake_test(IncompatibleQt) endif() if (QT4_FOUND) - set(ObsoleteQtMacros_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}) - add_RunCMake_test(ObsoleteQtMacros) + add_RunCMake_test(ObsoleteQtMacros -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}) endif() find_package(PkgConfig QUIET) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt.in b/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in index d15d148..d15d148 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt.in +++ b/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in diff --git a/Tests/CTestTestMemcheck/CTestConfig.cmake.in b/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in index 19c76c2..19c76c2 100644 --- a/Tests/CTestTestMemcheck/CTestConfig.cmake.in +++ b/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt new file mode 100644 index 0000000..725270c --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt new file mode 100644 index 0000000..1d255d0 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +heap-buffer-overflow - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-result.txt b/Tests/RunCMake/CTestMemcheck/DummyBC-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBC-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt new file mode 100644 index 0000000..24f536a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt @@ -0,0 +1 @@ +Error parsing XML in stream at line 1: no element found diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt @@ -0,0 +1,3 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt new file mode 100644 index 0000000..634e331 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt @@ -0,0 +1,3 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +.*Error parsing XML in stream at line 1: no element found +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt @@ -0,0 +1,3 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt new file mode 100644 index 0000000..520222f --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt new file mode 100644 index 0000000..97a8a9b --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt @@ -0,0 +1,3 @@ +Memory checking results: +Direct leak - 2 +Indirect leak - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt new file mode 100644 index 0000000..29c6ec7 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt new file mode 100644 index 0000000..64390c7 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +use-of-uninitialized-value - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt b/Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt new file mode 100644 index 0000000..2506f35 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt @@ -0,0 +1,3 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt new file mode 100644 index 0000000..ca23692 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt new file mode 100644 index 0000000..c3af1f9 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt @@ -0,0 +1,13 @@ +Memory checking results: +data race - 1 +data race on vptr \(ctor/dtor vs virtual call\) - 1 +heap-use-after-free - 1 +thread leak - 1 +destroy of a locked mutex - 1 +double lock of a mutex - 1 +unlock of an unlocked mutex \(or by a wrong thread\) - 1 +read lock of a write locked mutex - 1 +read unlock of a write locked mutex - 1 +signal-unsafe call inside of a signal - 1 +signal handler spoils errno - 1 +lock-order-inversion \(potential deadlock\) - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt new file mode 100644 index 0000000..fd684da --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt new file mode 100644 index 0000000..b3473bf --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +left shift of negative value -256 - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt new file mode 100644 index 0000000..1a2ee5c --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt new file mode 100644 index 0000000..2d078ef --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt @@ -0,0 +1,3 @@ +Problem running command: .*memcheck_fail.* +Problem executing post-memcheck command\(s\). +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt new file mode 100644 index 0000000..43ccb2e --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt @@ -0,0 +1,3 @@ +Problem running command: .*memcheck_fail.* +Problem executing pre-memcheck command\(s\). +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt new file mode 100644 index 0000000..9a6a1d6 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-build diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt new file mode 100644 index 0000000..5a5675c --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt @@ -0,0 +1,7 @@ +2/2 Test #2: RunCMakeAgain .* +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt new file mode 100644 index 0000000..d8d1ff0 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory checker suppression file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-build/does-not-exist +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt new file mode 100644 index 0000000..d46912e --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-build$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt new file mode 100644 index 0000000..321a2a5 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt @@ -0,0 +1,3 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt new file mode 100644 index 0000000..3e0fdb2 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt @@ -0,0 +1,8 @@ +Memory check project .*/DummyValgrindTwoTargets-build +.* + *Start 1: RunCMake +(.* +)?Memory check command: .* \"--log-file=.*/DummyValgrindTwoTargets-build/Testing/Temporary/MemoryChecker.1.log\" \"-q\".* + *Start 2: RunCMakeAgain +(.* +)?Memory check command: .* \"--log-file=.*/DummyValgrindTwoTargets-build/Testing/Temporary/MemoryChecker.2.log\" \"-q\".* diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-result.txt b/Tests/RunCMake/CTestMemcheck/NotExist-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/NotExist-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt b/Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt new file mode 100644 index 0000000..0af5b7a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt @@ -0,0 +1 @@ +Memory checker \(MemoryCheckCommand\) not set, or cannot find the specified program\. diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt b/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt new file mode 100644 index 0000000..9e92266 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/CTestMemcheck/NotExist-build$ diff --git a/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake b/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake new file mode 100644 index 0000000..6485de8 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake @@ -0,0 +1,144 @@ +include(RunCMake) + +set(SITE test-site) +set(BUILDNAME test-build) +set(COVERAGE_COMMAND "") + +function(run_mc_test SUBTEST_NAME CHECKER_COMMAND) + configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in + ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/test.cmake @ONLY) + configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in + ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/CTestConfig.cmake @ONLY) + configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in + ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/CMakeLists.txt @ONLY) + run_cmake_command(${SUBTEST_NAME} ${CMAKE_CTEST_COMMAND} + -C Debug + -S ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/test.cmake + -V + --output-log ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}-build/testOutput.log + ${ARGN} + ) +endfunction() + +unset(CTEST_EXTRA_CONFIG) +unset(CTEST_EXTRA_CODE) +unset(CMAKELISTS_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add ThreadSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testThreadSanitizer.cmake\") +") +run_mc_test(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add LeakSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testLeakSanitizer.cmake\") +") +run_mc_test(DummyLeakSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add AddressSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testAddressSanitizer.cmake\") +") +run_mc_test(DummyAddressSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add MemorySanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testMemorySanitizer.cmake\") +") +run_mc_test(DummyMemorySanitizer "" -DMEMCHECK_TYPE=MemorySanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add UndefinedBehaviorSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testUndefinedBehaviorSanitizer.cmake\") +") +run_mc_test(DummyUndefinedBehaviorSanitizer "" -DMEMCHECK_TYPE=UndefinedBehaviorSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CODE "string(REPLACE \" \" \"\\\\ \" PRE_POST_COMMAND \"\${CTEST_MEMORYCHECK_COMMAND}\") + +set(CTEST_CUSTOM_PRE_MEMCHECK \"\${PRE_POST_COMMAND} pre command\") +set(CTEST_CUSTOM_POST_MEMCHECK \"\${PRE_POST_COMMAND} post command \") +") +run_mc_test(DummyValgrindPrePost "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_POST_MEMCHECK \"${MEMCHECK_FAIL}\")") +run_mc_test(DummyValgrindFailPost "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_PRE_MEMCHECK \"${MEMCHECK_FAIL}\")") +run_mc_test(DummyValgrindFailPre "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CONFIG "set(CTEST_CUSTOM_MEMCHECK_IGNORE RunCMakeAgain)\n") +set(CMAKELISTS_EXTRA_CODE "add_test(NAME RunCMakeAgain COMMAND \"\${CMAKE_COMMAND}\" --version)") +run_mc_test(DummyValgrindIgnoreMemcheck "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CONFIG) +unset(CMAKELISTS_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CMAKELISTS_EXTRA_CODE "add_test(NAME RunCMakeAgain COMMAND \"\${CMAKE_COMMAND}\" --version)") +run_mc_test(DummyValgrindTwoTargets "${PSEUDO_VALGRIND}" "-VV") +unset(CMAKELISTS_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE \"\${CMAKE_CURRENT_BINARY_DIR}/does-not-exist\")") +run_mc_test(DummyValgrindInvalidSupFile "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CONFIG) + +#----------------------------------------------------------------------------- +# CTest will add the logfile option before any custom options. Set the logfile +# again, this time to an empty string. This will cause the logfile to be +# missing, which will be the prove for us that the custom option is indeed used. +set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"--log-file=\")") +run_mc_test(DummyValgrindCustomOptions "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CONFIG) + +#----------------------------------------------------------------------------- +run_mc_test(DummyPurify "${PSEUDO_PURIFY}") +run_mc_test(DummyValgrind "${PSEUDO_VALGRIND}") +run_mc_test(DummyBC "${PSEUDO_BC}") +run_mc_test(DummyPurifyNoLogFile "${PSEUDO_PURIFY_NOLOG}") +run_mc_test(DummyValgrindNoLogFile "${PSEUDO_VALGRIND_NOLOG}") +run_mc_test(DummyBCNoLogFile "${PSEUDO_BC_NOLOG}") +run_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") +run_mc_test(Unknown "\${CMAKE_COMMAND}") diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-result.txt b/Tests/RunCMake/CTestMemcheck/Unknown-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/Unknown-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt b/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt new file mode 100644 index 0000000..2beea2d --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt @@ -0,0 +1,2 @@ +Do not understand memory checker: .*/cmake.* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/Unknown/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt b/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt new file mode 100644 index 0000000..7ea1af0 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/CTestMemcheck/Unknown-build$ diff --git a/Tests/CTestTestMemcheck/test.cmake.in b/Tests/RunCMake/CTestMemcheck/test.cmake.in index f2ffd06..622d709 100644 --- a/Tests/CTestTestMemcheck/test.cmake.in +++ b/Tests/RunCMake/CTestMemcheck/test.cmake.in @@ -1,16 +1,14 @@ cmake_minimum_required(VERSION 2.8.9) # Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") set(CTEST_SITE "@SITE@") set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Memcheck@SUBTEST_NAME@") -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@SUBTEST_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@SUBTEST_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testAddressSanitizer.cmake index 3082e4b..3082e4b 100644 --- a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake +++ b/Tests/RunCMake/CTestMemcheck/testAddressSanitizer.cmake diff --git a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testLeakSanitizer.cmake index 02030be..02030be 100644 --- a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake +++ b/Tests/RunCMake/CTestMemcheck/testLeakSanitizer.cmake diff --git a/Tests/CTestTestMemcheck/testMemorySanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testMemorySanitizer.cmake index c87af9a..c87af9a 100644 --- a/Tests/CTestTestMemcheck/testMemorySanitizer.cmake +++ b/Tests/RunCMake/CTestMemcheck/testMemorySanitizer.cmake diff --git a/Tests/CTestTestMemcheck/testThreadSanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testThreadSanitizer.cmake index d591931..d591931 100644 --- a/Tests/CTestTestMemcheck/testThreadSanitizer.cmake +++ b/Tests/RunCMake/CTestMemcheck/testThreadSanitizer.cmake diff --git a/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testUndefinedBehaviorSanitizer.cmake index 8ef3c0a..8ef3c0a 100644 --- a/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake +++ b/Tests/RunCMake/CTestMemcheck/testUndefinedBehaviorSanitizer.cmake diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 56d69c8..7b1a5b2 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -65,7 +65,7 @@ function(run_cmake test) ) endif() set(msg "") - if(NOT "${actual_result}" STREQUAL "${expect_result}") + if(NOT "${actual_result}" MATCHES "${expect_result}") set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n") endif() foreach(o out err) diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt index 570733b..10f55d9 100644 --- a/Tests/VSNsightTegra/CMakeLists.txt +++ b/Tests/VSNsightTegra/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.0) project(VSNsightTegra C CXX) +set(CMAKE_ANDROID_API_MIN 9) set(CMAKE_ANDROID_API 15) set(CMAKE_ANDROID_GUI 1) diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake index 848e2f4..345870b 100644 --- a/Utilities/Release/dash2win64_release.cmake +++ b/Utilities/Release/dash2win64_release.cmake @@ -7,8 +7,13 @@ set(CPACK_BINARY_GENERATORS "NSIS ZIP") set(CPACK_SOURCE_GENERATORS "ZIP") set(MAKE_PROGRAM "make") set(MAKE "${MAKE_PROGRAM} -j8") +if(CMAKE_CREATE_VERSION STREQUAL "nightly") + set(CMAKE_USE_OPENSSL OFF) +else() + set(CMAKE_USE_OPENSSL ON) +endif() set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release -CMAKE_USE_OPENSSL:BOOL=ON +CMAKE_USE_OPENSSL:BOOL=${CMAKE_USE_OPENSSL} CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE CMAKE_GENERATOR:INTERNAL=Unix Makefiles diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake index 6c9b8f4..910fcbd 100644 --- a/Utilities/Release/dashmacmini5_release.cmake +++ b/Utilities/Release/dashmacmini5_release.cmake @@ -8,16 +8,21 @@ set(MAKE "${MAKE_PROGRAM} -j5") set(CPACK_BINARY_GENERATORS "DragNDrop TGZ TZ") set(CPACK_SOURCE_GENERATORS "TGZ TZ") set(CPACK_DMG_FORMAT "UDBZ") #build using bzip2 for smaller package size +if(CMAKE_CREATE_VERSION STREQUAL "nightly") + set(CMAKE_USE_OPENSSL OFF) +else() + set(CMAKE_USE_OPENSSL ON) +endif() set(INITIAL_CACHE " -CMAKE_USE_OPENSSL:BOOL=ON +CMAKE_USE_OPENSSL:BOOL=${CMAKE_USE_OPENSSL} OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1g-install/lib/libcrypto.a OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1g-install/include OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1g-install/lib/libssl.a CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=x86_64 -CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5 +CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.6 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE -CPACK_SYSTEM_NAME:STRING=Darwin64-universal +CPACK_SYSTEM_NAME:STRING=Darwin-x86_64 BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.0/install/bin/qmake diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 1092e48..0db741e 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -464,6 +464,25 @@ elseif(WIN32) # Use Windows SSL/TLS native implementation. add_definitions(-DUSE_SCHANNEL) set(USE_WINDOWS_SSPI 1) +elseif(APPLE) + # Use OS X SSL/TLS native implementation if available on target version. + if(CMAKE_OSX_DEPLOYMENT_TARGET) + set(OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET}) + else() + execute_process( + COMMAND sw_vers -productVersion + OUTPUT_VARIABLE OSX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() + if(NOT OSX_VERSION VERSION_LESS 10.6 AND + CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang") + add_definitions(-DUSE_DARWINSSL) + list(APPEND CURL_LIBS + "-framework CoreFoundation" + "-framework Security" + ) + endif() endif() #libSSH2 @@ -145,7 +145,7 @@ if ${cmake_system_linux}; then cmake_machine_parisc=true fi elif ${cmake_system_hpux}; then - if !(uname -m | grep ia64 >/dev/null 2>&1); then + if uname -m | grep ia64 >/dev/null 2>&1; then : ; else cmake_machine_parisc=true fi fi |