diff options
43 files changed, 645 insertions, 339 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5e2df26f..c811092 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -495,6 +495,27 @@ t:intel2021.2.0-makefiles: CMAKE_CI_BUILD_NAME: intel2021.2.0_makefiles CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2021.2.0-el8 +t:intel2021.3.0-makefiles: + extends: + - .cmake_test_linux_intelclassic_makefiles + variables: + CMAKE_CI_BUILD_NAME: intel2021.3.0_makefiles + CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2021.3.0-el8 + +t:intel2021.4.0-makefiles: + extends: + - .cmake_test_linux_intelclassic_makefiles + variables: + CMAKE_CI_BUILD_NAME: intel2021.4.0_makefiles + CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2021.4.0-el8 + +t:intel2021.5.0-makefiles: + extends: + - .cmake_test_linux_intelclassic_makefiles + variables: + CMAKE_CI_BUILD_NAME: intel2021.5.0_makefiles + CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2022.0.2-el8 + t:oneapi2021.1.1-makefiles: extends: - .cmake_test_linux_inteloneapi_makefiles @@ -516,6 +537,27 @@ t:oneapi2021.2.0-makefiles: CMAKE_CI_BUILD_NAME: oneapi2021.2.0_makefiles CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2021.2.0-el8 +t:oneapi2021.3.0-makefiles: + extends: + - .cmake_test_linux_inteloneapi_makefiles + variables: + CMAKE_CI_BUILD_NAME: oneapi2021.3.0_makefiles + CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2021.3.0-el8 + +t:oneapi2021.4.0-makefiles: + extends: + - .cmake_test_linux_inteloneapi_makefiles + variables: + CMAKE_CI_BUILD_NAME: oneapi2021.4.0_makefiles + CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2021.4.0-el8 + +t:oneapi2022.0.2-makefiles: + extends: + - .cmake_test_linux_inteloneapi_makefiles + variables: + CMAKE_CI_BUILD_NAME: oneapi2022.0.2_makefiles + CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2022.0.2-el8 + b:linux-x86_64-package: extends: - .linux_package @@ -879,6 +921,21 @@ t:windows-clang13.0-gnu-ninja: CMAKE_CI_BUILD_NAME: windows_clang13.0_gnu_ninja CMAKE_CI_JOB_NIGHTLY: "true" +t:windows-clang13.0-gnu-nmake: + extends: + - .windows_clang_nmake + - .cmake_test_windows_clang + - .windows_tags_concurrent + - .cmake_junit_artifacts + - .run_dependent + dependencies: + - t:windows-vs2022-x64-ninja + needs: + - t:windows-vs2022-x64-ninja + variables: + CMAKE_CI_BUILD_NAME: windows_clang13.0_gnu_nmake + CMAKE_CI_JOB_NIGHTLY: "true" + t:windows-msvc-v71-nmake: extends: - .windows_msvc_v71_nmake diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index d5361bd..381d97c 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -381,6 +381,7 @@ syn keyword cmakeProperty contained \ VS_JUST_MY_CODE_DEBUGGING \ VS_KEYWORD \ VS_MOBILE_EXTENSIONS_VERSION + \ VS_NO_COMPILE_BATCHING \ VS_NO_SOLUTION_DEPLOY \ VS_PACKAGE_REFERENCES \ VS_PLATFORM_TOOLSET diff --git a/Help/envvar/DESTDIR.rst b/Help/envvar/DESTDIR.rst index d2144ae..94cae4a 100644 --- a/Help/envvar/DESTDIR.rst +++ b/Help/envvar/DESTDIR.rst @@ -5,17 +5,26 @@ DESTDIR On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the whole installation. ``DESTDIR`` means DESTination DIRectory. It is -commonly used by makefile users in order to install software at -non-default location. It is usually invoked like this: +commonly used by packagers to install software in a staging directory. -:: +For example, running - make DESTDIR=/home/john install +.. code-block:: shell -which will install the concerned software using the installation -prefix, e.g. ``/usr/local`` prepended with the ``DESTDIR`` value which -finally gives ``/home/john/usr/local``. + make DESTDIR=/package/stage install -WARNING: ``DESTDIR`` may not be used on Windows because installation -prefix usually contains a drive letter like in ``C:/Program Files`` -which cannot be prepended with some other prefix. +will install the software using the installation prefix, e.g. ``/usr/local``, +prepended with the ``DESTDIR`` value which gives ``/package/stage/usr/local``. +The packaging tool may then construct the package from the content of the +``/package/stage`` directory. + +See the :variable:`CMAKE_INSTALL_PREFIX` variable to control the +installation prefix when configuring a build tree. Or, when using +the :manual:`cmake(1)` command-line tool's ``--install`` mode, +one may specify a different prefix using the ``--prefix`` option. + +.. note:: + + ``DESTDIR`` may not be used on Windows because installation + prefix usually contains a drive letter like in ``C:/Program Files`` + which cannot be prepended with some other prefix. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index f4efd3c..566eeae 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -402,6 +402,7 @@ Properties on Targets /prop_tgt/VS_JUST_MY_CODE_DEBUGGING /prop_tgt/VS_KEYWORD /prop_tgt/VS_MOBILE_EXTENSIONS_VERSION + /prop_tgt/VS_NO_COMPILE_BATCHING /prop_tgt/VS_NO_SOLUTION_DEPLOY /prop_tgt/VS_PACKAGE_REFERENCES /prop_tgt/VS_PLATFORM_TOOLSET diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 2102b36..54eb244 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -653,11 +653,17 @@ Available commands are: ``true`` if cmake supports server-mode and ``false`` otherwise. Always false since CMake 3.20. -``cat <files>...`` +``cat [--] <files>...`` .. versionadded:: 3.18 Concatenate files and print on the standard output. + .. versionadded:: 3.24 + Added support for the double dash argument ``--``. This basic implementation + of ``cat`` does not support any options, so using a option starting with + ``-`` will result in an error. Use ``--`` to indicate the end of options, in + case a file starts with ``-``. + ``chdir <dir> <cmd> [<arg>...]`` Change the current working directory and run a command. @@ -726,11 +732,16 @@ Available commands are: ``echo_append [<string>...]`` Displays arguments as text but no new line. -``env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...`` +``env [--unset=NAME ...] [NAME=VALUE ...] [--] <command> [<arg>...]`` .. versionadded:: 3.1 Run command in a modified environment. + .. versionadded:: 3.24 + Added support for the double dash argument ``--``. Use ``--`` to stop + interpreting options/environment variables and treat the next argument as + the command, even if it start with ``-`` or contains a ``=``. + ``environment`` Display the current environment variables. @@ -823,16 +834,16 @@ Available commands are: Rename a file or directory (on one volume). If file with the ``<newname>`` name already exists, then it will be silently replaced. -``rm [-rRf] <file> <dir>...`` +``rm [-rRf] [--] <file|dir>...`` .. versionadded:: 3.17 Remove the files ``<file>`` or directories ``<dir>``. - Use ``-r`` or ``-R`` to remove directories and their contents recursively. If any of the listed files/directories do not exist, the command returns a non-zero exit code, but no message is logged. The ``-f`` option changes the behavior to return a zero exit code (i.e. success) in such - situations instead. + situations instead. Use ``--`` to stop interpreting options and treat all + remaining arguments as paths, even if they start with ``-``. ``server`` Launch :manual:`cmake-server(7)` mode. diff --git a/Help/prop_tgt/VS_NO_COMPILE_BATCHING.rst b/Help/prop_tgt/VS_NO_COMPILE_BATCHING.rst new file mode 100644 index 0000000..f8a9fa6 --- /dev/null +++ b/Help/prop_tgt/VS_NO_COMPILE_BATCHING.rst @@ -0,0 +1,21 @@ +VS_NO_COMPILE_BATCHING +---------------------- + +.. versionadded:: 3.24 + +Turn off compile batching for the target. Usually MSBuild calls the compiler +with multiple c/cpp files and compiler starts subprocesses for each file to +make the build parallel. If you want compiler to be invoked with one file at +a time set VS_NO_COMPILE_BATCHING to ON. If this flag is set MSBuild will call +compiler with one c/cpp file at a time. Useful when you want to use tool that +replaces the compiler, for example some build caching tool. + +Example +^^^^^^^ + +This shows setting the variable for the target foo. + +.. code-block:: cmake + + add_library(foo SHARED foo.cpp) + set_property(TARGET foo PROPERTY VS_NO_COMPILE_BATCHING ON) diff --git a/Help/release/dev/cmcmd-end-of-options-delimiter.rst b/Help/release/dev/cmcmd-end-of-options-delimiter.rst new file mode 100644 index 0000000..bc9cc21 --- /dev/null +++ b/Help/release/dev/cmcmd-end-of-options-delimiter.rst @@ -0,0 +1,7 @@ +cmcmd-end-of-options-delimiter +------------------------------ + +* The :manual:`cmake(1)` ``-E`` commands ``cat`` and ``env`` learned to respect + a double dash (``--``) argument that acts as a delimiter indicating the end of + options. Any following arguments are treated as operands/positional arguments, + even if they begin with a dash ``-`` character. diff --git a/Help/release/dev/vs_buildcache_support.rst b/Help/release/dev/vs_buildcache_support.rst new file mode 100644 index 0000000..bdda675 --- /dev/null +++ b/Help/release/dev/vs_buildcache_support.rst @@ -0,0 +1,6 @@ +vs_buildcache_support +--------------------- + +* The :prop_tgt:`VS_NO_COMPILE_BATCHING` target property was added to + tell :ref:`Visual Studio Generators` whether to disable compiler parallelism + and call the compiler with one c/cpp file at a time. diff --git a/Help/variable/CMAKE_INSTALL_PREFIX.rst b/Help/variable/CMAKE_INSTALL_PREFIX.rst index 02ba645..b92d3ef 100644 --- a/Help/variable/CMAKE_INSTALL_PREFIX.rst +++ b/Help/variable/CMAKE_INSTALL_PREFIX.rst @@ -10,7 +10,8 @@ See :variable:`CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT` for how a project might choose its own default. On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the -whole installation. See :envvar:`DESTDIR` for more information. +whole installation to a staging area. See the :envvar:`DESTDIR` environment +variable for more information. The installation prefix is also added to :variable:`CMAKE_SYSTEM_PREFIX_PATH` so that :command:`find_package`, :command:`find_program`, @@ -21,3 +22,12 @@ will search the prefix for other software. Use the :module:`GNUInstallDirs` module to provide GNU-style options for the layout of directories within the installation. + +The ``CMAKE_INSTALL_PREFIX`` may be defined when configuring a build tree +to set its installation prefix. Or, when using the :manual:`cmake(1)` +command-line tool's ``--install`` mode, one may specify a different prefix +using the ``--prefix`` option: + +.. code-block:: shell + + cmake --install . --prefix /my/install/prefix diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index a10b5d0..cef2e8a 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -135,10 +135,17 @@ function(gtest_discover_tests_impl) if(NOT line MATCHES "^ ") # Module; remove trailing '.' to get just the name... string(REGEX REPLACE "\\.( *#.*)?$" "" suite "${line}") - if(line MATCHES "#" AND NOT _NO_PRETTY_TYPES) - string(REGEX REPLACE "/[0-9]\\.+ +#.*= +" "/" pretty_suite "${line}") + if(line MATCHES "#") + string(REGEX REPLACE "/.*" "" pretty_suite "${line}") + if(NOT _NO_PRETTY_TYPES) + string(REGEX REPLACE ".*/[0-9]+[ .#]+TypeParam = (.*)" "\\1" type_parameter "${line}") + else() + string(REGEX REPLACE ".*/([0-9]+)[ .#]+TypeParam = .*" "\\1" type_parameter "${line}") + endif() + set(test_name_template "@prefix@@pretty_suite@.@pretty_test@<@type_parameter@>@suffix@") else() set(pretty_suite "${suite}") + set(test_name_template "@prefix@@pretty_suite@.@pretty_test@@suffix@") endif() string(REGEX REPLACE "^DISABLED_" "" pretty_suite "${pretty_suite}") else() @@ -156,7 +163,7 @@ function(gtest_discover_tests_impl) unset(TEST_XML_OUTPUT_PARAM) endif() - set(testname "${prefix}${pretty_suite}.${pretty_test}${suffix}") + string(CONFIGURE "${test_name_template}" testname) # sanitize test name for further processing downstream # unescape [] if(open_sb) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 939a69f..4c6e831 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 23) -set(CMake_VERSION_PATCH 20220204) +set(CMake_VERSION_PATCH 20220209) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 9f1029e..602065a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2047,7 +2047,11 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, } else if (ext == "appxmanifest") { kind = SourceKindAppManifest; } else if (ext == "manifest") { - kind = SourceKindManifest; + if (sf->GetPropertyAsBool("VS_DEPLOYMENT_CONTENT")) { + kind = SourceKindExtra; + } else { + kind = SourceKindManifest; + } } else if (ext == "pfx") { kind = SourceKindCertificate; } else if (ext == "xaml") { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a52c831..a96f6f0 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1134,7 +1134,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( slnFile += ".sln"; cmVisualStudioSlnParser parser; if (parser.ParseFile(slnFile, slnData, - cmVisualStudioSlnParser::DataGroupProjects)) { + cmVisualStudioSlnParser::DataGroupAll)) { std::vector<cmSlnProjectEntry> slnProjects = slnData.GetProjects(); for (cmSlnProjectEntry const& project : slnProjects) { if (useDevEnv) { @@ -1170,15 +1170,17 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( GeneratedMakeCommand makeCommand; makeCommand.RequiresOutputForward = requiresOutputForward; makeCommand.Add(makeProgramSelected); + cm::optional<cmSlnProjectEntry> proj = cm::nullopt; if (tname == "clean") { - makeCommand.Add(std::string(projectName) + ".sln"); + makeCommand.Add(cmStrCat(projectName, ".sln")); makeCommand.Add("/t:Clean"); } else { std::string targetProject = cmStrCat(tname, ".vcxproj"); + proj = slnData.GetProjectByName(tname); if (targetProject.find('/') == std::string::npos) { // it might be in a subdir - if (cmSlnProjectEntry const* proj = slnData.GetProjectByName(tname)) { + if (proj) { targetProject = proj->GetRelativePath(); cmSystemTools::ConvertToUnixSlashes(targetProject); } @@ -1243,22 +1245,33 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( } } - std::string configArg = "/p:Configuration="; - if (!config.empty()) { - configArg += config; - } else { - configArg += "Debug"; + std::string plainConfig = config; + if (config.empty()) { + plainConfig = "Debug"; } - makeCommand.Add(configArg); - makeCommand.Add(std::string("/p:Platform=") + this->GetPlatformName()); - makeCommand.Add(std::string("/p:VisualStudioVersion=") + - this->GetIDEVersion()); + + std::string platform = GetPlatformName(); + if (proj) { + std::string extension = + cmSystemTools::GetFilenameLastExtension(proj->GetRelativePath()); + extension = cmSystemTools::LowerCase(extension); + if (extension.compare(".csproj") == 0) { + // Use correct platform name + platform = + slnData.GetConfigurationTarget(tname, plainConfig, platform); + } + } + + makeCommand.Add(cmStrCat("/p:Configuration=", plainConfig)); + makeCommand.Add(cmStrCat("/p:Platform=", platform)); + makeCommand.Add( + cmStrCat("/p:VisualStudioVersion=", this->GetIDEVersion())); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { makeCommand.Add("/m"); } else { - makeCommand.Add(std::string("/m:") + std::to_string(jobs)); + makeCommand.Add(cmStrCat("/m:", std::to_string(jobs))); } // Having msbuild.exe and cl.exe using multiple jobs is discouraged makeCommand.Add("/p:CL_MPCount=1"); @@ -1266,7 +1279,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( // Respect the verbosity: 'n' normal will show build commands // 'm' minimal only the build step's title - makeCommand.Add(std::string("/v:") + ((verbose) ? "n" : "m")); + makeCommand.Add(cmStrCat("/v:", ((verbose) ? "n" : "m"))); makeCommand.Add(makeOptions.begin(), makeOptions.end()); makeCommands.emplace_back(std::move(makeCommand)); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7b197fa..86ca640 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -926,6 +926,17 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile( e1.Element("OutputType", outputType); } + for (const std::string& config : this->Configurations) { + Elem e1(e0, "PropertyGroup"); + e1.Attribute("Condition", "'$(Configuration)' == '" + config + "'"); + e1.SetHasElements(); + this->WriteEvents(e1, config); + + std::string outDir = this->GeneratorTarget->GetDirectory(config) + "/"; + ConvertToWindowsSlash(outDir); + e1.Element("OutputPath", outDir); + } + this->WriteDotNetDocumentationFile(e0); this->WriteAllSources(e0); this->WriteDotNetReferences(e0); @@ -3298,7 +3309,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( } else if (this->MSTools) { cmsys::RegularExpression clangToolset("v[0-9]+_clang_.*"); const char* toolset = this->GlobalGenerator->GetPlatformToolset(); - if (toolset && clangToolset.find(toolset)) { + cmValue noCompileBatching = + this->GeneratorTarget->GetProperty("VS_NO_COMPILE_BATCHING"); + if (noCompileBatching.IsOn() || (toolset && clangToolset.find(toolset))) { e2.Element("ObjectFileName", "$(IntDir)%(filename).obj"); } else { e2.Element("ObjectFileName", "$(IntDir)"); diff --git a/Source/cmVisualStudioSlnData.cxx b/Source/cmVisualStudioSlnData.cxx index 8d4b658..2a6dfc4 100644 --- a/Source/cmVisualStudioSlnData.cxx +++ b/Source/cmVisualStudioSlnData.cxx @@ -5,24 +5,39 @@ #include <cstddef> #include <utility> -const cmSlnProjectEntry* cmSlnData::GetProjectByGUID( +#include "cmSystemTools.h" + +void cmSlnProjectEntry::AddProjectConfiguration( + const std::string& solutionConfiguration, + const std::string& projectConfiguration) +{ + projectConfigurationMap[solutionConfiguration] = projectConfiguration; +} + +std::string cmSlnProjectEntry::GetProjectConfiguration( + const std::string& solutionConfiguration) +{ + return projectConfigurationMap[solutionConfiguration]; +} + +const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByGUID( const std::string& projectGUID) const { ProjectStorage::const_iterator it(ProjectsByGUID.find(projectGUID)); if (it != ProjectsByGUID.end()) - return &it->second; + return it->second; else - return NULL; + return cm::nullopt; } -const cmSlnProjectEntry* cmSlnData::GetProjectByName( +const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByName( const std::string& projectName) const { ProjectStringIndex::const_iterator it(ProjectNameIndex.find(projectName)); if (it != ProjectNameIndex.end()) - return &it->second->second; + return it->second->second; else - return NULL; + return cm::nullopt; } std::vector<cmSlnProjectEntry> cmSlnData::GetProjects() const @@ -50,3 +65,24 @@ cmSlnProjectEntry* cmSlnData::AddProject( ProjectNameIndex[projectName] = it; return &it->second; } + +std::string cmSlnData::GetConfigurationTarget( + const std::string& projectName, const std::string& solutionConfiguration, + const std::string& platformName) +{ + std::string solutionTarget = solutionConfiguration + "|" + platformName; + cm::optional<cmSlnProjectEntry> project = GetProjectByName(projectName); + if (!project) + return platformName; + + std::string projectTarget = project->GetProjectConfiguration(solutionTarget); + if (projectTarget.empty()) + return platformName; + + std::vector<std::string> targetElements = + cmSystemTools::SplitString(projectTarget, '|'); + if (targetElements.size() != 2) + return platformName; + + return targetElements[1]; +} diff --git a/Source/cmVisualStudioSlnData.h b/Source/cmVisualStudioSlnData.h index b217bd8..100dd9b 100644 --- a/Source/cmVisualStudioSlnData.h +++ b/Source/cmVisualStudioSlnData.h @@ -8,6 +8,8 @@ #include <string> #include <vector> +#include <cm/optional> + class cmSlnProjectEntry { public: @@ -24,17 +26,40 @@ public: std::string GetName() const { return Name; } std::string GetRelativePath() const { return RelativePath; } + void AddProjectConfiguration(const std::string& solutionConfiguration, + const std::string& projectConfiguration); + + std::string GetProjectConfiguration( + const std::string& solutionConfiguration); + private: std::string Guid, Name, RelativePath; + std::map<std::string, std::string> projectConfigurationMap; }; class cmSlnData { public: - const cmSlnProjectEntry* GetProjectByGUID( + std::string GetVisualStudioVersion() const { return visualStudioVersion; } + void SetVisualStudioVersion(const std::string& version) + { + visualStudioVersion = version; + } + + std::string GetMinimumVisualStudioVersion() const + { + return minimumVisualStudioVersion; + } + + void SetMinimumVisualStudioVersion(const std::string& version) + { + minimumVisualStudioVersion = version; + } + + const cm::optional<cmSlnProjectEntry> GetProjectByGUID( const std::string& projectGUID) const; - const cmSlnProjectEntry* GetProjectByName( + const cm::optional<cmSlnProjectEntry> GetProjectByName( const std::string& projectName) const; std::vector<cmSlnProjectEntry> GetProjects() const; @@ -43,9 +68,20 @@ public: const std::string& projectName, const std::string& projectRelativePath); + void AddConfiguration(const std::string& configuration) + { + solutionConfigurations.push_back(configuration); + } + + std::string GetConfigurationTarget(const std::string& projectName, + const std::string& solutionConfiguration, + const std::string& platformName); + private: + std::string visualStudioVersion, minimumVisualStudioVersion; using ProjectStorage = std::map<std::string, cmSlnProjectEntry>; ProjectStorage ProjectsByGUID; using ProjectStringIndex = std::map<std::string, ProjectStorage::iterator>; ProjectStringIndex ProjectNameIndex; + std::vector<std::string> solutionConfigurations; }; diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx index d900a95..feab895 100644 --- a/Source/cmVisualStudioSlnParser.cxx +++ b/Source/cmVisualStudioSlnParser.cxx @@ -11,6 +11,7 @@ #include "cmsys/FStream.hxx" #include "cmStringAlgorithms.h" +#include "cmSystemTools.h" #include "cmVisualStudioSlnData.h" namespace { @@ -219,9 +220,14 @@ bool cmVisualStudioSlnParser::State::Process( this->Stack.push(FileStateProject); } else this->IgnoreUntilTag("EndProject"); - } else if (line.GetTag().compare("Global") == 0) + } else if (line.GetTag().compare("Global") == 0) { + this->Stack.push(FileStateGlobal); - else { + } else if (line.GetTag().compare("VisualStudioVersion") == 0) { + output.SetVisualStudioVersion(line.GetValue(0)); + } else if (line.GetTag().compare("MinimumVisualStudioVersion") == 0) { + output.SetMinimumVisualStudioVersion(line.GetValue(0)); + } else { result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); return false; } @@ -289,10 +295,9 @@ bool cmVisualStudioSlnParser::State::Process( case FileStateSolutionConfigurations: if (line.GetTag().compare("EndGlobalSection") == 0) this->Stack.pop(); - else if (line.IsKeyValuePair()) - // implement configuration storing here, once needed - ; - else { + else if (line.IsKeyValuePair()) { + output.AddConfiguration(line.GetValue(0)); + } else { result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); return false; } @@ -300,10 +305,30 @@ bool cmVisualStudioSlnParser::State::Process( case FileStateProjectConfigurations: if (line.GetTag().compare("EndGlobalSection") == 0) this->Stack.pop(); - else if (line.IsKeyValuePair()) - // implement configuration storing here, once needed - ; - else { + else if (line.IsKeyValuePair()) { + std::vector<std::string> tagElements = + cmSystemTools::SplitString(line.GetTag(), '.'); + if (tagElements.size() != 3 && tagElements.size() != 4) { + result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); + return false; + } + + std::string guid = tagElements[0]; + std::string solutionConfiguration = tagElements[1]; + std::string activeBuild = tagElements[2]; + cm::optional<cmSlnProjectEntry> projectEntry = + output.GetProjectByGUID(guid); + + if (!projectEntry) { + result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); + return false; + } + + if (activeBuild.compare("ActiveCfg") == 0) { + projectEntry->AddProjectConfiguration(solutionConfiguration, + line.GetValue(0)); + } + } else { result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); return false; } @@ -454,8 +479,7 @@ bool cmVisualStudioSlnParser::GetParseHadBOM() const bool cmVisualStudioSlnParser::IsDataGroupSetSupported( DataGroupSet dataGroups) const { - return (dataGroups & DataGroupProjects) == dataGroups; - // only supporting DataGroupProjects for now + return (dataGroups & DataGroupProjects) != 0; } bool cmVisualStudioSlnParser::ParseImpl(std::istream& input, cmSlnData& output, diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 32c01e5..ba61a83 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -97,7 +97,8 @@ void CMakeCommandUsage(std::string const& program) << "Available commands: \n" << " capabilities - Report capabilities built into cmake " "in JSON format\n" - << " cat <files>... - concat the files and print them to the standard output\n" + << " cat [--] <files>... - concat the files and print them to the " + "standard output\n" << " chdir dir cmd [args...] - run command in a given directory\n" << " compare_files [--ignore-eol] file1 file2\n" << " - check if file1 is same as file2\n" @@ -110,7 +111,7 @@ void CMakeCommandUsage(std::string const& program) << " echo [<string>...] - displays arguments as text\n" << " echo_append [<string>...] - displays arguments as text but no new " "line\n" - << " env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...\n" + << " env [--unset=NAME ...] [NAME=VALUE ...] [--] <command> [<arg>...]\n" << " - run command in a modified environment\n" << " environment - display the current environment\n" << " make_directory <dir>... - create parent and <dir> directories\n" @@ -125,8 +126,9 @@ void CMakeCommandUsage(std::string const& program) << " remove_directory <dir>... - remove directories and their contents (deprecated: use rm instead)\n" << " rename oldname newname - rename a file or directory " "(on one volume)\n" - << " rm [-rRf] <file/dir>... - remove files or directories, use -f to " - "force it, r or R to remove directories and their contents recursively\n" + << " rm [-rRf] [--] <file/dir>... - remove files or directories, use -f " + "to force it, r or R to remove directories and their contents " + "recursively\n" << " sleep <number>... - sleep for given number of seconds\n" << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n" << " - create or extract a tar or zip archive\n" @@ -793,6 +795,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, auto ae = args.cend(); for (; ai != ae; ++ai) { std::string const& a = *ai; + if (a == "--") { + // Stop parsing options/environment variables; the next argument + // should be the command. + ++ai; + break; + } if (cmHasLiteralPrefix(a, "--unset=")) { // Unset environment variable. cmSystemTools::UnPutEnv(a.substr(8)); @@ -1051,9 +1059,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, // Command to concat files into one if (args[1] == "cat" && args.size() >= 3) { int return_value = 0; + bool doing_options = true; for (auto const& arg : cmMakeRange(args).advance(2)) { - if (cmHasLiteralPrefix(arg, "-")) { - if (arg != "--") { + if (doing_options && cmHasLiteralPrefix(arg, "-")) { + if (arg == "--") { + doing_options = false; + } else { cmSystemTools::Error(arg + ": option not handled"); return_value = 1; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6946ffb..8ebe5ed 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -294,26 +294,6 @@ if(BUILD_TESTING) mark_as_advanced(CTEST_TEST_CTEST) endif () - # Should tests that use CVS be run? - # - set(do_cvs_tests 0) - - if(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) - find_package(CVS QUIET) - else() - find_program(CVS_EXECUTABLE NAMES cvs) - endif() - - if(CVS_EXECUTABLE) - set(do_cvs_tests 1) - endif() - - if(do_cvs_tests AND NOT UNIX) - if("${CVS_EXECUTABLE}" MATCHES "cygwin") - set(do_cvs_tests 0) - endif() - endif() - # Should CPack tests be run? By default, yes, but... # # Disable packaging test on Apple 10.3 and below. PackageMaker starts @@ -1574,6 +1554,12 @@ if(BUILD_TESTING) ADD_TEST_MACRO(FindMatlab.targets_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) endif() + set(ExternalProject_BUILD_OPTIONS "") + foreach(vcs CVS SVN GIT HG) + if(DEFINED CMake_TEST_ExternalProject_${vcs}) + list(APPEND ExternalProject_BUILD_OPTIONS -DEP_TEST_${vcs}=${CMake_TEST_ExternalProject_${vcs}}) + endif() + endforeach() add_test(ExternalProject ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProject" @@ -1582,6 +1568,7 @@ if(BUILD_TESTING) --build-project ExternalProjectTest --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject" --force-new-ctest-process + --build-options ${ExternalProject_BUILD_OPTIONS} --test-command ${CMAKE_CTEST_COMMAND} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject") @@ -2562,27 +2549,8 @@ if(BUILD_TESTING) # -S "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake" # ) - # A test for ctest_build() with targets in subdirectories - set(ctest_configure_options) - if(CMAKE_GENERATOR_PLATFORM) - list(APPEND ctest_configure_options -A ${CMAKE_GENERATOR_PLATFORM}) - endif() - if(CMAKE_GENERATOR_TOOLSET) - list(APPEND ctest_configure_options -T ${CMAKE_GENERATOR_TOOLSET}) - endif() - if(CMake_TEST_EXPLICIT_MAKE_PROGRAM) - list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) - endif() - configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY) - unset(ctest_configure_options) - add_test(CTest.BuildCommand.ProjectInSubdir - ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake") - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/Nested") - - set(CTEST_TEST_UPDATE 1) - if(CTEST_TEST_UPDATE) - # Test CTest Update with Subversion + # Test CTest Update with Subversion + if(NOT DEFINED CMake_TEST_CTestUpdate_SVN OR CMake_TEST_CTestUpdate_SVN) find_package(Subversion QUIET) if(Subversion_FOUND) get_filename_component(_Subversion_BIN_DIR @@ -2595,129 +2563,134 @@ if(BUILD_TESTING) set(Subversion_FOUND FALSE) endif() endif() - if(Subversion_FOUND) - set(CTestUpdateSVN_DIR "CTest UpdateSVN") - configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateSVN.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" @ONLY) - add_test(CTest.UpdateSVN ${CMAKE_CMAKE_COMMAND} - -P "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateSVN_DIR}") + endif() + if(NOT DEFINED CMake_TEST_CTestUpdate_SVN AND Subversion_FOUND) + set(CMake_TEST_CTestUpdate_SVN 1) + endif() + if(CMake_TEST_CTestUpdate_SVN) + if(NOT Subversion_FOUND) + message(FATAL_ERROR "CMake_TEST_CTestUpdate_SVN enabled but Subversion is not found.") endif() + set(CTestUpdateSVN_DIR "CTest UpdateSVN") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateSVN.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" @ONLY) + add_test(CTest.UpdateSVN ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateSVN_DIR}") + endif() - # Test CTest Update with CVS - if(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) - find_package(CVS QUIET) - else() - find_program(CVS_EXECUTABLE NAMES cvs) - set(CVS_FOUND ${CVS_EXECUTABLE}) - endif() - set(CTEST_TEST_UPDATE_CVS ${CVS_FOUND}) - if(CTEST_TEST_UPDATE_CVS AND NOT UNIX) - if("${CVS_EXECUTABLE}" MATCHES "cygwin") - message(STATUS "No CTest.UpdateCVS test with cygwin cvs.exe outside cygwin!") - set(CTEST_TEST_UPDATE_CVS 0) - endif() - endif() - if(CTEST_TEST_UPDATE_CVS) - set(CTestUpdateCVS_DIR "CTest UpdateCVS") - configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" @ONLY) - add_test(CTest.UpdateCVS ${CMAKE_CMAKE_COMMAND} - -P "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateCVS_DIR}") + # Test CTest Update with CVS + if(NOT DEFINED CMake_TEST_CTestUpdate_CVS OR CMake_TEST_CTestUpdate_CVS) + find_program(CVS_EXECUTABLE NAMES cvs) + mark_as_advanced(CVS_EXECUTABLE) + endif() + if(NOT DEFINED CMake_TEST_CTestUpdate_CVS AND CVS_EXECUTABLE + AND (UNIX OR NOT "${CVS_EXECUTABLE}" MATCHES "cygwin")) + set(CMake_TEST_CTestUpdate_CVS 1) + endif() + if(CMake_TEST_CTestUpdate_CVS) + if(NOT CVS_EXECUTABLE) + message(FATAL_ERROR "CMake_TEST_CTestUpdate_CVS enabled but CVS_EXECUTABLE is not found.") endif() + set(CTestUpdateCVS_DIR "CTest UpdateCVS") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" @ONLY) + add_test(CTest.UpdateCVS ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateCVS_DIR}") + endif() - # Test CTest Update with BZR + # Test CTest Update with BZR + if(CMake_TEST_CTestUpdate_BZR) find_program(BZR_EXECUTABLE NAMES bzr) mark_as_advanced(BZR_EXECUTABLE) - set(CTEST_TEST_UPDATE_BZR 0) - if(BZR_EXECUTABLE) - if(NOT "${BZR_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - set(CTEST_TEST_UPDATE_BZR 1) - endif() - endif() - if(CTEST_TEST_UPDATE_BZR) - # Check if xmloutput plugin is there - execute_process(COMMAND ${BZR_EXECUTABLE} xmlplugins RESULT_VARIABLE xmlplugres - OUTPUT_QUIET ERROR_QUIET) - if( NOT ${xmlplugres} ) - set(CTestUpdateBZR_DIR "CTest UpdateBZR") - configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake" @ONLY) - add_test(CTest.UpdateBZR ${CMAKE_CMAKE_COMMAND} - -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake" - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}") - set(CTestUpdateBZR_DIR "CTest UpdateBZR_CLocale") - configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake" @ONLY) - add_test(CTest.UpdateBZR.CLocale ${CMAKE_CMAKE_COMMAND} - -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake" - ) - set_tests_properties(CTest.UpdateBZR.CLocale PROPERTIES ENVIRONMENT LC_ALL=C) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}") - endif() - endif() + if(NOT BZR_EXECUTABLE) + message(FATAL_ERROR "CMake_TEST_CTestUpdate_BZR enabled but BZR_EXECUTABLE is not found.") + endif() + set(CTestUpdateBZR_DIR "CTest UpdateBZR") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake" @ONLY) + add_test(CTest.UpdateBZR ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}") + set(CTestUpdateBZR_DIR "CTest UpdateBZR_CLocale") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake" @ONLY) + add_test(CTest.UpdateBZR.CLocale ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake" + ) + set_tests_properties(CTest.UpdateBZR.CLocale PROPERTIES ENVIRONMENT LC_ALL=C) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}") + endif() - # Test CTest Update with GIT + # Test CTest Update with GIT + if(NOT DEFINED CMake_TEST_CTestUpdate_GIT OR CMake_TEST_CTestUpdate_GIT) find_program(GIT_EXECUTABLE NAMES git) mark_as_advanced(GIT_EXECUTABLE) - set(CTEST_TEST_UPDATE_GIT 0) - if(GIT_EXECUTABLE) - if(NOT "${GIT_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - set(CTEST_TEST_UPDATE_GIT 1) - endif() - endif() - if(CTEST_TEST_UPDATE_GIT) - set(CTestUpdateGIT_DIR "CTest UpdateGIT") - configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateGIT.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" @ONLY) - add_test(CTest.UpdateGIT ${CMAKE_CMAKE_COMMAND} - -P "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}") + endif() + if(NOT DEFINED CMake_TEST_CTestUpdate_GIT AND GIT_EXECUTABLE + AND (UNIX OR NOT "${GIT_EXECUTABLE}" MATCHES "cygwin")) + set(CMake_TEST_CTestUpdate_GIT 1) + endif() + if(CMake_TEST_CTestUpdate_GIT) + if(NOT GIT_EXECUTABLE) + message(FATAL_ERROR "CMake_TEST_CTestUpdate_GIT enabled but GIT_EXECUTABLE is not found.") endif() + set(CTestUpdateGIT_DIR "CTest UpdateGIT") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateGIT.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" @ONLY) + add_test(CTest.UpdateGIT ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}") + endif() - # Test CTest Update with HG + # Test CTest Update with HG + if(NOT DEFINED CMake_TEST_CTestUpdate_HG OR CMake_TEST_CTestUpdate_HG) find_program(HG_EXECUTABLE NAMES hg) mark_as_advanced(HG_EXECUTABLE) - set(CTEST_TEST_UPDATE_HG 0) - if(HG_EXECUTABLE) - if(NOT "${HG_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - set(CTEST_TEST_UPDATE_HG 1) - endif() - endif() - if(CTEST_TEST_UPDATE_HG) - set(CTestUpdateHG_DIR "CTest UpdateHG") - configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateHG.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake" @ONLY) - add_test(CTest.UpdateHG ${CMAKE_CMAKE_COMMAND} - -P "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake" - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateHG_DIR}") + endif() + if(NOT DEFINED CMake_TEST_CTestUpdate_HG AND HG_EXECUTABLE + AND (UNIX OR NOT "${HG_EXECUTABLE}" MATCHES "cygwin")) + set(CMake_TEST_CTestUpdate_HG 1) + endif() + if(CMake_TEST_CTestUpdate_HG) + if(NOT HG_EXECUTABLE) + message(FATAL_ERROR "CMake_TEST_CTestUpdate_HG enabled but HG_EXECUTABLE is not found.") endif() + set(CTestUpdateHG_DIR "CTest UpdateHG") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateHG.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake" @ONLY) + add_test(CTest.UpdateHG ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateHG_DIR}") + endif() - # Test CTest Update with P4 + # Test CTest Update with P4 + if(NOT DEFINED CMake_TEST_CTestUpdate_P4 OR CMake_TEST_CTestUpdate_P4) find_program(P4_EXECUTABLE NAMES p4) find_program(P4D_EXECUTABLE NAMES p4d) mark_as_advanced(P4_EXECUTABLE P4D_EXECUTABLE) - set(CTEST_TEST_UPDATE_P4 0) - if(P4_EXECUTABLE AND P4D_EXECUTABLE) - if(NOT "${P4_EXECUTABLE};${P4D_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - set(CTEST_TEST_UPDATE_P4 1) - endif() - endif() - if(CTEST_TEST_UPDATE_P4) - set(CTestUpdateP4_DIR "CTest UpdateP4") - configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateP4.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestUpdateP4.cmake" @ONLY) - add_test(CTest.UpdateP4 ${CMAKE_CMAKE_COMMAND} - -P "${CMake_BINARY_DIR}/Tests/CTestUpdateP4.cmake" - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateP4_DIR}") + endif() + if(NOT DEFINED CMake_TEST_CTestUpdate_P4 AND P4_EXECUTABLE AND P4D_EXECUTABLE + AND (UNIX OR NOT "${P4_EXECUTABLE};${P4D_EXECUTABLE}" MATCHES "cygwin")) + set(CMake_TEST_CTestUpdate_P4 1) + endif() + if(CMake_TEST_CTestUpdate_P4) + if(NOT P4_EXECUTABLE OR NOT P4D_EXECUTABLE) + message(FATAL_ERROR "CMake_TEST_CTestUpdate_HG enabled but P4_EXECUTABLE and P4D_EXECUTABLE are not both not found.") endif() + set(CTestUpdateP4_DIR "CTest UpdateP4") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateP4.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateP4.cmake" @ONLY) + add_test(CTest.UpdateP4 ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateP4.cmake" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateP4_DIR}") endif() configure_file( diff --git a/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in b/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in deleted file mode 100644 index 0f56781..0000000 --- a/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 2.8.10) - -set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/VSProjectInSubdir") -set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestBuildCommandProjectInSubdir/Nested") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_BUILD_CONFIGURATION "@CTestTest_CONFIG@") - -ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) -ctest_start(Experimental) -ctest_configure(OPTIONS "@ctest_configure_options@") -ctest_build(TARGET test) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 8a85045..e4c6c66 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -8,10 +8,50 @@ include(ExternalProject) # Test ExternalProject, especially with checkouts from VCS -find_package(CVS) -find_package(Subversion) -find_package(Git) -find_package(Hg) +if(NOT DEFINED EP_TEST_CVS OR EP_TEST_CVS) + find_package(CVS) +endif() +if(NOT DEFINED EP_TEST_CVS AND CVS_FOUND AND (UNIX OR NOT "${CVS_EXECUTABLE}" MATCHES "cygwin")) + set(EP_TEST_CVS 1) +endif() + +if(NOT DEFINED EP_TEST_SVN OR EP_TEST_SVN) + find_package(Subversion) + if(Subversion_FOUND AND Subversion_VERSION_SVN VERSION_LESS 1.2) + message(STATUS "No ExternalProject svn tests with svn client less than version 1.2") + set(Subversion_FOUND 0) + endif() + # Only do svn tests in cygwin/cygwin or not-cygwin/not-cygwin arrangements: + if(Subversion_FOUND AND CMAKE_CURRENT_BINARY_DIR MATCHES "cygdrive/" AND NOT "${Subversion_SVN_EXECUTABLE}" MATCHES "cygwin") + message(STATUS "No ExternalProject svn tests with non-cygwin svn client in a /cygdrive based build") + set(Subversion_FOUND 0) + endif() +endif() +if(NOT DEFINED EP_TEST_SVN AND Subversion_FOUND) + set(EP_TEST_SVN 1) +endif() + +if(NOT DEFINED EP_TEST_GIT OR EP_TEST_GIT) + find_package(Git) +endif() +if(NOT DEFINED EP_TEST_GIT AND Git_FOUND) + message(STATUS "GIT_VERSION_STRING='${GIT_VERSION_STRING}'") + if(NOT "${GIT_VERSION_STRING}" VERSION_LESS 1.6.5) + set(EP_TEST_GIT 1) + endif() +endif() + +if(NOT DEFINED EP_TEST_HG OR EP_TEST_HG) + find_package(Hg) +endif() +if(NOT DEFINED EP_TEST_HG AND Hg_FOUND) + set(EP_TEST_HG 1) +endif() + +message(STATUS "EP_TEST_CVS='${EP_TEST_CVS}' CVS_EXECUTABLE='${CVS_EXECUTABLE}'") +message(STATUS "EP_TEST_SVN='${EP_TEST_SVN}' Subversion_SVN_EXECUTABLE='${Subversion_SVN_EXECUTABLE}'") +message(STATUS "EP_TEST_GIT='${EP_TEST_GIT}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'") +message(STATUS "EP_TEST_HG='${EP_TEST_HG}' HG_EXECUTABLE='${HG_EXECUTABLE}'") option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) if(ExternalProjectTest_USE_FOLDERS) @@ -115,20 +155,7 @@ ExternalProject_Add(${proj} # CVS-based tests: # -set(do_cvs_tests 0) - -if(CVS_EXECUTABLE) - set(do_cvs_tests 1) -endif() - -if(do_cvs_tests AND NOT UNIX) - if("${CVS_EXECUTABLE}" MATCHES "cygwin") - message(STATUS "No ExternalProject cvs tests with cygwin cvs.exe outside cygwin!") - set(do_cvs_tests 0) - endif() -endif() - -if(do_cvs_tests) +if(EP_TEST_CVS) # Unzip/untar the CVS repository in our source folder so that other # projects below may use it to test CVS args of ExternalProject_Add # @@ -207,32 +234,7 @@ endif() # SVN-based tests: # -set(do_svn_tests 0) - -if(Subversion_SVN_EXECUTABLE) - set(do_svn_tests 1) -endif() - -# Only do svn tests with svn >= version 1.2 -# -if(do_svn_tests) - if(Subversion_VERSION_SVN VERSION_LESS 1.2) - message(STATUS "No ExternalProject svn tests with svn client less than version 1.2") - set(do_svn_tests 0) - endif() -endif() - -# Only do svn tests in cygwin/cygwin or not-cygwin/not-cygwin arrangements: -# -if(do_svn_tests) - if(CMAKE_CURRENT_BINARY_DIR MATCHES "cygdrive/" AND - NOT "${Subversion_SVN_EXECUTABLE}" MATCHES "cygwin") - message(STATUS "No ExternalProject svn tests with non-cygwin svn client in a /cygdrive based build") - set(do_svn_tests 0) - endif() -endif() - -if(do_svn_tests) +if(EP_TEST_SVN) # Unzip/untar the SVN repository in our source folder so that other # projects below may use it to test SVN args of ExternalProject_Add # @@ -292,22 +294,7 @@ if(do_svn_tests) set_property(TARGET ${proj} PROPERTY FOLDER "SVN") endif() - -set(do_git_tests 0) - -if(GIT_EXECUTABLE) - set(do_git_tests 1) - - message(STATUS "GIT_VERSION_STRING='${GIT_VERSION_STRING}'") - - if("${GIT_VERSION_STRING}" VERSION_LESS 1.6.5) - message(STATUS "No ExternalProject git tests with git client less than version 1.6.5") - set(do_git_tests 0) - endif() -endif() - - -if(do_git_tests) +if(EP_TEST_GIT) set(local_git_repo "../../LocalRepositories/GIT") # Unzip/untar the git repository in our source folder so that other @@ -554,20 +541,7 @@ if(do_git_tests) endif() -set(do_hg_tests 0) - -if(HG_EXECUTABLE) - set(do_hg_tests 1) -endif() - -if(do_hg_tests AND NOT UNIX) - if("${HG_EXECUTABLE}" MATCHES "cygwin") - message(STATUS "No ExternalProject hg tests with cygwin hg outside cygwin!") - set(do_hg_tests 0) - endif() -endif() - -if(do_hg_tests) +if(EP_TEST_HG) set(local_hg_repo "../../LocalRepositories/HG") # Unzip/untar the hg repository in our source folder so that other @@ -642,7 +616,7 @@ enable_testing() # # BuildTree tests: # -if(do_cvs_tests) +if(EP_TEST_CVS) add_test(TutorialStep1-CVS-20090626-BuildTreeTest "${binary_base}/TutorialStep1-CVS-20090626/Tutorial" 4) @@ -653,7 +627,7 @@ if(do_cvs_tests) "${binary_base}/TutorialStep1-CVS-HEAD/Tutorial" 81) endif() -if(do_svn_tests) +if(EP_TEST_SVN) add_test(TutorialStep1-SVN-20090626-BuildTreeTest "${binary_base}/TutorialStep1-SVN-20090626/Tutorial" 100) @@ -664,7 +638,7 @@ if(do_svn_tests) "${binary_base}/TutorialStep1-SVN-trunk/Tutorial" 98) endif() -if(do_git_tests) +if(EP_TEST_GIT) add_test(TutorialStep1-GIT-byhash ${CMAKE_COMMAND} -P "${binary_base}/TutorialStep1-GIT-byhash/example.cmake") @@ -686,13 +660,6 @@ if(do_git_tests) endif() endif() - -message(STATUS "do_cvs_tests='${do_cvs_tests}'") -message(STATUS "do_svn_tests='${do_svn_tests}'") -message(STATUS "do_git_tests='${do_git_tests}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'") -message(STATUS "do_hg_tests='${do_hg_tests}' HG_EXECUTABLE='${HG_EXECUTABLE}'") - - # Test if log works when the first arguments of *_COMMAND is "COMMAND". set(proj ExternalProject-no-log) set(download_cmd "") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 1d7e632..d6dd909 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -703,7 +703,8 @@ endif() add_executable(pseudo_llvm-rc pseudo_llvm-rc.c) add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} - -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) + -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} + -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>) add_RunCMake_test(CommandLineTar) if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) @@ -733,6 +734,9 @@ add_RunCMake_test(CPackInstallProperties) if(XCODE_VERSION) set(ExternalProject_ARGS -DXCODE_VERSION=${XCODE_VERSION}) endif() +if(CMake_TEST_RunCMake_ExternalProject_DOWNLOAD_SERVER_TIMEOUT) + list(APPEND ExternalProject_ARGS -DDOWNLOAD_SERVER_TIMEOUT=${CMake_TEST_RunCMake_ExternalProject_DOWNLOAD_SERVER_TIMEOUT}) +endif() add_RunCMake_test(ExternalProject) add_RunCMake_test(FetchContent) set(CTestCommandLine_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) diff --git a/Tests/RunCMake/CommandLine/E_cat-with-double-dash-stdout.txt b/Tests/RunCMake/CommandLine/E_cat-with-double-dash-stdout.txt new file mode 100644 index 0000000..e5939d0 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat-with-double-dash-stdout.txt @@ -0,0 +1 @@ +file starting with dash, not an option diff --git a/Tests/RunCMake/CommandLine/E_cat-without-double-dash-result.txt b/Tests/RunCMake/CommandLine/E_cat-without-double-dash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat-without-double-dash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_cat-without-double-dash-stderr.txt b/Tests/RunCMake/CommandLine/E_cat-without-double-dash-stderr.txt new file mode 100644 index 0000000..051f678 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat-without-double-dash-stderr.txt @@ -0,0 +1 @@ +^CMake Error: -file-starting-with-dash.txt: option not handled$ diff --git a/Tests/RunCMake/CommandLine/E_env-with-double-dash-result.txt b/Tests/RunCMake/CommandLine/E_env-with-double-dash-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-with-double-dash-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_env-without-double-dash-result.txt b/Tests/RunCMake/CommandLine/E_env-without-double-dash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-without-double-dash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-without-double-dash-stderr.txt b/Tests/RunCMake/CommandLine/E_env-without-double-dash-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-without-double-dash-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 033fbe6..50815a8 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -676,17 +676,33 @@ file(WRITE "${out}/empty_file.txt" "") file(WRITE "${out}/unicode_file.txt" "àéùç - 한국어") # Korean in Korean run_cmake_command(E_cat_good_cat ${CMAKE_COMMAND} -E cat "${out}/first_file.txt" "${out}/second_file.txt" "${out}/empty_file.txt" "${out}/unicode_file.txt") -unset(out) run_cmake_command(E_cat_good_binary_cat ${CMAKE_COMMAND} -E cat "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj" "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj") +# To test whether the double dash (--) works, we need to control the working directory +# in order to be able to pass a relative path that starts with a dash. +file(WRITE "${out}/-file-starting-with-dash.txt" "file starting with dash, not an option\n") +set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${out}") +run_cmake_command(E_cat-with-double-dash ${CMAKE_COMMAND} -E cat -- "-file-starting-with-dash.txt") +run_cmake_command(E_cat-without-double-dash ${CMAKE_COMMAND} -E cat "-file-starting-with-dash.txt") +unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY) +unset(out) + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) run_cmake_command(E_env-set ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) run_cmake_command(E_env-unset ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -E env --unset=TEST_ENV ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) +# To test whether the double dash (--) works for the env command, we need a command that e.g. contains an equals sign (=) +# and would normally be interpreted as an NAME=VALUE environment variable. +# Ensuring such a command is done by simply copying the trivial exit_code executable with a different name. +cmake_path(GET EXIT_CODE_EXE FILENAME exit_code) +file(COPY_FILE "${EXIT_CODE_EXE}" "${RunCMake_BINARY_DIR}/env=${exit_code}") +run_cmake_command(E_env-with-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 -- "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) +run_cmake_command(E_env-without-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) + run_cmake_command(E_md5sum-dir ${CMAKE_COMMAND} -E md5sum .) run_cmake_command(E_sha1sum-dir ${CMAKE_COMMAND} -E sha1sum .) run_cmake_command(E_sha224sum-dir ${CMAKE_COMMAND} -E sha224sum .) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index fde384f..08adee2 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -105,12 +105,15 @@ function(__ep_test_with_build_with_server testName) if(EXISTS "${URL_FILE}") file(REMOVE "${URL_FILE}") endif() + if(NOT DOWNLOAD_SERVER_TIMEOUT) + set(DOWNLOAD_SERVER_TIMEOUT 30) + endif() execute_process( COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/DownloadServer.py --file "${URL_FILE}" ${ARGN} OUTPUT_FILE ${RunCMake_BINARY_DIR}/${testName}-python.txt ERROR_FILE ${RunCMake_BINARY_DIR}/${testName}-python.txt RESULT_VARIABLE result - TIMEOUT 30 + TIMEOUT "${DOWNLOAD_SERVER_TIMEOUT}" ) if(NOT result EQUAL 0) message(FATAL_ERROR "Failed to start download server:\n ${result}") diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change-typed-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change-typed-stdout.txt index fe8f273..c4545ca 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change-typed-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change-typed-stdout.txt @@ -1,7 +1,9 @@ Test project .*/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change - Test #1: typed/short\.case - Test #2: typed/float\.case - Test #3: ns\.typed/short\.case - Test #4: ns\.typed/float\.case + Test #[0-9]+: typed\.case<short> + Test #[0-9]+: typed\.case<float> + Test #[0-9]+: typed\.case<char> + Test #[0-9]+: ns\.typed\.case<short> + Test #[0-9]+: ns\.typed\.case<float> + Test #[0-9]+: ns\.typed\.case<char> -Total Tests: 4 +Total Tests: [0-9]+ diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index 01b39c3..c462042 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -19,14 +19,18 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec *Start +[0-9]+: TEST:DISABLEDnotreally\.case!1 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:DISABLEDnotreally\.case!1 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:typed/short\.case!1 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:typed/float\.case!1 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:ns\.typed/short\.case!1 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/short\.case!1 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:ns\.typed/float\.case!1 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/float\.case!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<short>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<short>!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<float>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<float>!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<char>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<char>!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<short>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<short>!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<float>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<float>!1 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<char>!1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<char>!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:value/test\.case/1!1 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:value/test\.case/"foo"!1 diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt index 796e20c..8cdd1a0 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -19,14 +19,18 @@ Test project .* *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec *Start +[0-9]+: TEST:DISABLEDnotreally\.case!2 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:DISABLEDnotreally\.case!2 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:typed/short\.case!2 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:typed/float\.case!2 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:ns\.typed/short\.case!2 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/short\.case!2 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:ns\.typed/float\.case!2 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<short>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<short>!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<float>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<float>!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<char>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<char>!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<short>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<short>!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<float>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<float>!2 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<char>!2 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<char>!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:value/test\.case/1!2 *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec *Start +[0-9]+: TEST:value/test\.case/"foo"!2 diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test4-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test4-stdout.txt index 0f7dde7..b0f70e7 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test4-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test4-stdout.txt @@ -1,12 +1,16 @@ Test project .* - *Start +[0-9]+: TEST:typed/short\.case!4 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/short\.case!4 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:typed/float\.case!4 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/float\.case!4 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:ns\.typed/short\.case!4 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/short\.case!4 \.+ +Passed +[0-9.]+ sec - *Start +[0-9]+: TEST:ns\.typed/float\.case!4 - *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/float\.case!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<short>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<short>!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<float>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<float>!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:typed\.case<char>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed\.case<char>!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<short>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<short>!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<float>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<float>!4 \.+ +Passed +[0-9.]+ sec + *Start +[0-9]+: TEST:ns\.typed\.case<char>!4 + *[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed\.case<char>!4 \.+ +Passed +[0-9.]+ sec 100% tests passed, 0 tests failed out of [0-9]+ diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp index 183e106..e6f74aa 100644 --- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -36,11 +36,11 @@ int main(int argc, char** argv) if (!is_basic_only) { const char* typed_suite_names[] = { "typed", "ns.typed" }; for (size_t i = 0; i < ARRAY_SIZE(typed_suite_names); i++) { - std::cout << typed_suite_names[i] << "/0. # TypeParam = short" - << std::endl; + std::cout << typed_suite_names[i] << "/0. # TypeParam = short\n"; std::cout << " case" << std::endl; - std::cout << typed_suite_names[i] << "/1. # TypeParam = float" - << std::endl; + std::cout << typed_suite_names[i] << "/1. # TypeParam = float\n"; + std::cout << " case" << std::endl; + std::cout << typed_suite_names[i] << "/42. # TypeParam = char\n"; std::cout << " case" << std::endl; } } diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 139dcc7..b19c1a8 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -84,3 +84,4 @@ endif() run_cmake(VsDotnetTargetFramework) run_cmake(VsDotnetTargetFrameworkVersion) +run_cmake(VsNoCompileBatching) diff --git a/Tests/RunCMake/VS10Project/VsNoCompileBatching-check.cmake b/Tests/RunCMake/VS10Project/VsNoCompileBatching-check.cmake new file mode 100644 index 0000000..4002c3f --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsNoCompileBatching-check.cmake @@ -0,0 +1,31 @@ +macro(VsNoCompileBatching_check tgt ofn_expect) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.") + return() + endif() + + set(HAVE_OFN 0) + + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<ObjectFileName>([^<>]+)</ObjectFileName>") + set(ofn_actual "${CMAKE_MATCH_1}") + if(NOT "${ofn_actual}" STREQUAL "${ofn_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has <ObjectFileName> '${ofn_actual}', not '${ofn_expect}'.") + return() + endif() + set(HAVE_OFN 1) + break() + endif() + endforeach() + + if(NOT HAVE_OFN) + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <ObjectFileName> property.") + return() + endif() +endmacro() + +VsNoCompileBatching_check(foo "$(IntDir)") +VsNoCompileBatching_check(foo_NB "$(IntDir)%(filename).obj") +VsNoCompileBatching_check(foo_NB_OFF "$(IntDir)") diff --git a/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake b/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake new file mode 100644 index 0000000..c96edce --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +add_library(foo foo.cpp) + +add_library(foo_NB foo.cpp) +set_property(TARGET foo_NB PROPERTY VS_NO_COMPILE_BATCHING ON) + +add_library(foo_NB_OFF foo.cpp) +set_property(TARGET foo_NB_OFF PROPERTY VS_NO_COMPILE_BATCHING OFF) diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index 511cd71..e94a55d 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -49,6 +49,18 @@ function(run_BuildChangeId) endfunction() run_BuildChangeId() +function(run_SubdirTarget) + set(CASE_CMAKELISTS_SUFFIX_CODE [=[ +file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/subdir/CMakeLists.txt [[ +add_custom_target(target_in_subdir COMMAND ${CMAKE_COMMAND} -E touch target_in_subdir.out VERBATIM) +]]) +add_subdirectory(subdir) +]=]) + set(CASE_CTEST_BUILD_ARGS TARGET target_in_subdir) + run_ctest(SubdirTarget) +endfunction() +run_SubdirTarget() + set(RunCMake_USE_CUSTOM_BUILD_COMMAND TRUE) set(RunCMake_BUILD_COMMAND "${FAKE_BUILD_COMMAND_EXE}") run_ctest(BuildCommandFailure) diff --git a/Tests/RunCMake/ctest_build/SubdirTarget-check.cmake b/Tests/RunCMake/ctest_build/SubdirTarget-check.cmake new file mode 100644 index 0000000..81d21ec --- /dev/null +++ b/Tests/RunCMake/ctest_build/SubdirTarget-check.cmake @@ -0,0 +1,4 @@ +set(expected_file "${RunCMake_TEST_BINARY_DIR}/subdir/target_in_subdir.out") +if(NOT EXISTS "${expected_file}") + set(RunCMake_TEST_FAILED "Expected build output file not found:\n ${expected_file}") +endif() diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index edd4330..2cb80fa 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -63,7 +63,8 @@ set(VERTEXSHADER_FILES Direct3DApp1/SimpleVertexShader.hlsl ) -set(CONTENT_FILES ${PIXELSHADER_FILES} ${VERTEXSHADER_FILES}) + set(COPY_TO_OUTPUT_FILES Direct3DApp1/Simple.manifest) + set(CONTENT_FILES ${PIXELSHADER_FILES} ${VERTEXSHADER_FILES} ${COPY_TO_OUTPUT_FILES}) if (WINDOWS_PHONE8) set(CONTENT_FILES ${CONTENT_FILES} @@ -108,6 +109,7 @@ set(RESOURCE_FILES ${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} ${ASSET_FILES} ${STRING_FILES} Direct3DApp1/Direct3DApp1_TemporaryKey.pfx) +set_property(SOURCE ${COPY_TO_OUTPUT_FILES} PROPERTY VS_COPY_TO_OUT_DIR "PreserveNewest") set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "Assets") diff --git a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp index 595f553..d287857 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp +++ b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp @@ -17,6 +17,13 @@ CubeRenderer::CubeRenderer() // Create a new WinRT object to validate that we can link properly Batman ^ hero = ref new Batman(); hero->savePeople(); + + // Test that .manifest files can be bundled with app + DX::ReadDataAsync("Direct3DApp1\\Simple.manifest") + .then([this](Platform::Array<byte> ^ fileData) { + std::string manifestContent(fileData->begin(), fileData->end()); + assert(manifestContent.find("hello") == 0); + }); } void CubeRenderer::CreateDeviceResources() diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Simple.manifest b/Tests/VSWinStorePhone/Direct3DApp1/Simple.manifest new file mode 100644 index 0000000..ce01362 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Simple.manifest @@ -0,0 +1 @@ +hello |