diff options
47 files changed, 517 insertions, 81 deletions
diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index 1347b42..4a95cdd 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -23,7 +23,7 @@ The APPEND option marks results for append to those previously submitted to a dashboard server since the last ctest_start. Append semantics are defined by the dashboard server in use. -If set the contents of the variable CTEST_BUILD_FLAGS are passed as +If set, the contents of the variable CTEST_BUILD_FLAGS are passed as additional arguments to the underlying build command. This can e.g. be used to trigger a parallel build using the -j option of make. See :module:`ProcessorCount` for an example. diff --git a/Help/command/file.rst b/Help/command/file.rst index 14ca20c..869350a 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -271,6 +271,8 @@ from the input content to produce the output content. The options are: Exactly one ``CONTENT`` or ``INPUT`` option must be given. A specific ``OUTPUT`` file may be named by at most one invocation of ``file(GENERATE)``. +Generated files are modified on subsequent cmake runs only if their content +is changed. ------------------------------------------------------------------------------ diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst index cf35467..bdeabdb 100644 --- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst @@ -185,7 +185,7 @@ The features known to this version of CMake are: .. _N3050: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html ``cxx_nonstatic_member_init`` - Non-static data member initialization, as defined in N2756. + Non-static data member initialization, as defined in N2756_. .. _N2756: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2756.htm diff --git a/Help/release/dev/OpenWatcom.rst b/Help/release/dev/OpenWatcom.rst new file mode 100644 index 0000000..63f6e8c --- /dev/null +++ b/Help/release/dev/OpenWatcom.rst @@ -0,0 +1,9 @@ +OpenWatcom +---------- + +* Support for the Open Watcom compiler has been overhauled. + The :variable:`CMAKE_<LANG>_COMPILER_ID` is now ``OpenWatcom``, + and the :variable:`CMAKE_<LANG>_COMPILER_VERSION` now uses + the Open Watcom external version numbering. The external + version numbers are lower than the internal version number + by 11. diff --git a/Help/release/dev/delay-generator-toolset.rst b/Help/release/dev/delay-generator-toolset.rst new file mode 100644 index 0000000..0512834 --- /dev/null +++ b/Help/release/dev/delay-generator-toolset.rst @@ -0,0 +1,8 @@ +delay-generator-toolset +----------------------- + +* The :variable:`CMAKE_GENERATOR_TOOLSET` variable may now be + initialized in a toolchain file specified by the + :variable:`CMAKE_TOOLCHAIN_FILE` variable. This is useful + when cross-compiling with the Xcode or Visual Studio + generators. diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst index 4540eaa..9ccc8b3 100644 --- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst +++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst @@ -7,3 +7,9 @@ Some CMake generators support a toolset name to be given to the native build system to choose a compiler. If the user specifies a toolset name (e.g. via the cmake -T option) the value will be available in this variable. + +The value of this variable should never be modified by project code. +A toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE` +variable may initialize ``CMAKE_GENERATOR_TOOLSET``. Once a given +build tree has been initialized with a particular value for this +variable, changing the value has undefined behavior. diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index cf9c386..f554f4e 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -20,13 +20,13 @@ include: Intel = Intel Compiler (intel.com) MIPSpro = SGI MIPSpro (sgi.com) MSVC = Microsoft Visual Studio (microsoft.com) + OpenWatcom = Open Watcom (openwatcom.org) PGI = The Portland Group (pgroup.com) PathScale = PathScale (pathscale.com) SDCC = Small Device C Compiler (sdcc.sourceforge.net) SunPro = Oracle Solaris Studio (oracle.com) TI = Texas Instruments (ti.com) TinyCC = Tiny C Compiler (tinycc.org) - Watcom = Open Watcom (openwatcom.org) XL, VisualAge, zOS = IBM XL (ibm.com) This variable is not guaranteed to be defined for all compilers or diff --git a/Help/variable/CTEST_COVERAGE_COMMAND.rst b/Help/variable/CTEST_COVERAGE_COMMAND.rst index 1a8e499..a669dd7 100644 --- a/Help/variable/CTEST_COVERAGE_COMMAND.rst +++ b/Help/variable/CTEST_COVERAGE_COMMAND.rst @@ -3,3 +3,58 @@ CTEST_COVERAGE_COMMAND Specify the CTest ``CoverageCommand`` setting in a :manual:`ctest(1)` dashboard client script. + +Cobertura +''''''''' + +Using `Cobertura`_ as the coverage generation within your multi-module +Java project can generate a series of XML files. + +The Cobertura Coverage parser expects to read the coverage data from a +single XML file which contains the coverage data for all modules. +Cobertura has a program with the ability to merge given cobertura.ser files +and then another program to generate a combined XML file from the previous +merged file. For command line testing, this can be done by hand prior to +CTest looking for the coverage files. For script builds, +set the ``CTEST_COVERAGE_COMMAND`` variable to point to a file which will +perform these same steps, such as a .sh or .bat file. + +.. code-block:: cmake + + set(CTEST_COVERAGE_COMMAND .../run-coverage-and-consolidate.sh) + +where the ``run-coverage-and-consolidate.sh`` script is perhaps created by +the :command:`configure_file` command and might contain the following code: + +.. code-block:: bash + + #!/usr/bin/env bash + CoberturaFiles="$(find "/path/to/source" -name "cobertura.ser")" + SourceDirs="$(find "/path/to/source" -name "java" -type d)" + cobertura-merge --datafile coberturamerge.ser $CoberturaFiles + cobertura-report --datafile coberturamerge.ser --destination . \ + --format xml $SourceDirs + +The script uses ``find`` to capture the paths to all of the cobertura.ser files +found below the project's source directory. It keeps the list of files and +supplies it as an argument to the ``cobertura-merge`` program. The ``--datafile`` +argument signifies where the result of the merge will be kept. + +The combined ``coberturamerge.ser`` file is then used to generate the XML report +using the ``cobertura-report`` program. The call to the cobertura-report program +requires some named arguments. + +``--datafila`` + path to the merged .ser file + +``--destination`` + path to put the output files(s) + +``--format`` + file format to write output in: xml or html + +The rest of the supplied arguments consist of the full paths to the +/src/main/java directories of each module within the souce tree. These +directories are needed and should not be forgotten. + +.. _`Cobertura`: http://cobertura.github.io/cobertura/ diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8ecf83c..fe6cc1b 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -519,7 +519,7 @@ set(CTEST_SRCS cmCTest.cxx CTest/cmParseCacheCoverage.cxx CTest/cmParseGTMCoverage.cxx CTest/cmParsePHPCoverage.cxx - CTest/cmParsePythonCoverage.cxx + CTest/cmParseCoberturaCoverage.cxx CTest/cmCTestEmptyBinaryDirectoryCommand.cxx CTest/cmCTestGenericHandler.cxx CTest/cmCTestHandlerCommand.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b5c0055..59ccf51 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 0) -set(CMake_VERSION_PATCH 20140604) +set(CMake_VERSION_PATCH 20140606) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2aa5991..ad37c42 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -26,6 +26,7 @@ #include <cmsys/CommandLineArguments.hxx> #include <cmsys/SystemTools.hxx> #include <cmsys/Encoding.hxx> +#include <locale.h> //---------------------------------------------------------------------------- static const char * cmDocumentationName[][2] = @@ -100,6 +101,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, // this is CPack. int main (int argc, char const* const* argv) { + setlocale(LC_ALL, ""); cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = args.argc(); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index cb6e56e..da27c8c 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmCTestCoverageHandler.h" #include "cmParsePHPCoverage.h" -#include "cmParsePythonCoverage.h" +#include "cmParseCoberturaCoverage.h" #include "cmParseGTMCoverage.h" #include "cmParseCacheCoverage.h" #include "cmCTest.h" @@ -401,7 +401,7 @@ int cmCTestCoverageHandler::ProcessHandler() { return error; } - file_count += this->HandlePythonCoverage(&cont); + file_count += this->HandleCoberturaCoverage(&cont); error = cont.Error; if ( file_count < 0 ) { @@ -779,10 +779,10 @@ int cmCTestCoverageHandler::HandlePHPCoverage( } //---------------------------------------------------------------------- -int cmCTestCoverageHandler::HandlePythonCoverage( +int cmCTestCoverageHandler::HandleCoberturaCoverage( cmCTestCoverageHandlerContainer* cont) { - cmParsePythonCoverage cov(*cont, this->CTest); + cmParseCoberturaCoverage cov(*cont, this->CTest); // Assume the coverage.xml is in the source directory std::string coverageXMLFile = this->CTest->GetBinaryDir() + "/coverage.xml"; @@ -790,14 +790,14 @@ int cmCTestCoverageHandler::HandlePythonCoverage( if(cmSystemTools::FileExists(coverageXMLFile.c_str())) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Parsing coverage.py XML file: " << coverageXMLFile + "Parsing Cobertura XML file: " << coverageXMLFile << std::endl); cov.ReadCoverageXML(coverageXMLFile.c_str()); } else { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Cannot find coverage.py XML file: " << coverageXMLFile + "Cannot find Cobertura XML file: " << coverageXMLFile << std::endl); } return static_cast<int>(cont->TotalCoverage.size()); diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 0a0fe81..38a3353 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -76,7 +76,7 @@ private: int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont); //! Handle coverage for Python with coverage.py - int HandlePythonCoverage(cmCTestCoverageHandlerContainer* cont); + int HandleCoberturaCoverage(cmCTestCoverageHandlerContainer* cont); //! Handle coverage for mumps int HandleMumpsCoverage(cmCTestCoverageHandlerContainer* cont); diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 817b8dc..6b98056 100644 --- a/Source/CTest/cmParsePythonCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -1,17 +1,21 @@ #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmXMLParser.h" -#include "cmParsePythonCoverage.h" +#include "cmParseCoberturaCoverage.h" #include <cmsys/Directory.hxx> #include <cmsys/FStream.hxx> //---------------------------------------------------------------------------- -class cmParsePythonCoverage::XMLParser: public cmXMLParser +class cmParseCoberturaCoverage::XMLParser: public cmXMLParser { public: XMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont) : CTest(ctest), Coverage(cont) { + this->InSources = false; + this->InSource = false; + this->FilePaths.push_back(this->Coverage.SourceDir); + this->CurFileName = ""; } virtual ~XMLParser() @@ -20,9 +24,44 @@ public: protected: + + virtual void EndElement(const std::string& name) + { + if(name == "source") + { + this->InSource=false; + } + else if (name == "sources") + { + this->InSources=false; + } + } + + virtual void CharacterDataHandler(const char* data, int length) + { + std::string tmp; + tmp.insert(0,data,length); + if (this->InSources && this->InSource) + { + this->FilePaths.push_back(tmp); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Adding Source: " + << tmp << std::endl); + } + } + virtual void StartElement(const std::string& name, const char** atts) { - if(name == "class") + std::string FoundSource; + std::string finalpath = ""; + if(name == "source") + { + this->InSource = true; + } + else if(name == "sources") + { + this->InSources = true; + } + else if(name == "class") { int tagCount = 0; while(true) @@ -30,11 +69,19 @@ protected: if(strcmp(atts[tagCount], "filename") == 0) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: " - << atts[tagCount+1] << std::endl); - this->CurFileName = this->Coverage.SourceDir + "/" + - atts[tagCount+1]; + << atts[tagCount+1]<< std::endl); + std::string filename = atts[tagCount+1]; + for(size_t i=0;i < FilePaths.size();i++) + { + finalpath = FilePaths[i] + "/" + filename; + if(cmSystemTools::FileExists(finalpath.c_str())) + { + this->CurFileName = finalpath; + break; + } + } cmsys::ifstream fin(this->CurFileName.c_str()); - if(!fin) + if(this->CurFileName == "" || !fin ) { this->CurFileName = this->Coverage.BinaryDir + "/" + atts[tagCount+1]; @@ -48,7 +95,6 @@ protected: break; } } - std::string line; FileLinesType& curFileLines = this->Coverage.TotalCoverage[this->CurFileName]; @@ -83,7 +129,9 @@ protected: { FileLinesType& curFileLines = this->Coverage.TotalCoverage[this->CurFileName]; - curFileLines[curNumber-1] = curHits; + { + curFileLines[curNumber-1] = curHits; + } break; } ++tagCount; @@ -91,10 +139,11 @@ protected: } } - virtual void EndElement(const std::string&) {} - private: + bool InSources; + bool InSource; + std::vector<std::string> FilePaths; typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector FileLinesType; cmCTest* CTest; @@ -104,16 +153,16 @@ private: }; -cmParsePythonCoverage::cmParsePythonCoverage( +cmParseCoberturaCoverage::cmParseCoberturaCoverage( cmCTestCoverageHandlerContainer& cont, cmCTest* ctest) :Coverage(cont), CTest(ctest) { } -bool cmParsePythonCoverage::ReadCoverageXML(const char* xmlFile) +bool cmParseCoberturaCoverage::ReadCoverageXML(const char* xmlFile) { - cmParsePythonCoverage::XMLParser parser(this->CTest, this->Coverage); + cmParseCoberturaCoverage::XMLParser parser(this->CTest, this->Coverage); parser.ParseFile(xmlFile); return true; } diff --git a/Source/CTest/cmParsePythonCoverage.h b/Source/CTest/cmParseCoberturaCoverage.h index 668c7f9..ff5954d 100644 --- a/Source/CTest/cmParsePythonCoverage.h +++ b/Source/CTest/cmParseCoberturaCoverage.h @@ -10,8 +10,8 @@ See the License for more information. ============================================================================*/ -#ifndef cmParsePythonCoverage_h -#define cmParsePythonCoverage_h +#ifndef cmParseCoberturaCoverage_h +#define cmParseCoberturaCoverage_h #include "cmStandardIncludes.h" #include "cmCTestCoverageHandler.h" @@ -25,15 +25,18 @@ * Java-based Cobertura coverage application. This helper class parses * that XML file to fill the coverage-handler container. */ -class cmParsePythonCoverage +class cmParseCoberturaCoverage { public: //! Create the coverage parser by passing in the coverage handler //! container and the cmCTest object - cmParsePythonCoverage(cmCTestCoverageHandlerContainer& cont, + cmParseCoberturaCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest); + bool inSources; + bool inSource; + std::vector<std::string> filepaths; //! Read the XML produced by running `coverage xml` bool ReadCoverageXML(const char* xmlFile); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index d70bedb..a9d4d98 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -16,6 +16,7 @@ #include <signal.h> #include <sys/ioctl.h> +#include <locale.h> #include "cmCursesMainForm.h" #include "cmCursesStandardIncludes.h" @@ -82,6 +83,8 @@ void CMakeMessageHandler(const char* message, const char* title, bool&, int main(int argc, char const* const* argv) { + setlocale(LC_ALL, ""); + cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = encoding_args.argc(); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index dba4f46..bb818eb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -76,7 +76,8 @@ cmGlobalGenerator::~cmGlobalGenerator() } } -bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts) +bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) { cmOStringStream e; e << @@ -85,8 +86,7 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts) "does not support toolset specification, but toolset\n" " " << ts << "\n" "was specified."; - this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - cmListFileBacktrace()); + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -448,6 +448,15 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, mf->ReadListFile(0,fpath.c_str()); } + // Tell the generator about the toolset, if any. + std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"); + if(!toolset.empty() && + !this->SetGeneratorToolset(toolset, mf)) + { + cmSystemTools::SetFatalErrorOccured(); + return; + } + // **** Load the system specific initialization if not yet loaded if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED")) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 617e708..67bd378 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -63,7 +63,7 @@ public: /** Set the generator-specific toolset name. Returns true if toolset is supported and false otherwise. */ - virtual bool SetGeneratorToolset(std::string const& ts); + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); /** * Create LocalGenerators and process the CMakeLists files. This does not diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 37a416b..86d0de3 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -116,9 +116,11 @@ cmGlobalVisualStudio10Generator::MatchesGeneratorName( //---------------------------------------------------------------------------- bool -cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts) +cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) { - this->PlatformToolset = ts; + this->GeneratorToolset = ts; + this->AddVSPlatformToolsetDefinition(mf); return true; } @@ -126,10 +128,16 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts) void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) { cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); - if(!this->PlatformToolset.empty()) + this->AddVSPlatformToolsetDefinition(mf); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio10Generator +::AddVSPlatformToolsetDefinition(cmMakefile* mf) const +{ + if(const char* toolset = this->GetPlatformToolset()) { - mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", - this->PlatformToolset.c_str()); + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset); } } @@ -215,11 +223,15 @@ void cmGlobalVisualStudio10Generator } //---------------------------------------------------------------------------- -const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() +const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const { - if(!this->PlatformToolset.empty()) + if(!this->GeneratorToolset.empty()) + { + return this->GeneratorToolset.c_str(); + } + if(!this->DefaultPlatformToolset.empty()) { - return this->PlatformToolset.c_str(); + return this->DefaultPlatformToolset.c_str(); } return 0; } @@ -417,7 +429,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( //---------------------------------------------------------------------------- bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) { - if(!this->PlatformToolset.empty()) + if(this->GetPlatformToolset()) { return true; } @@ -435,7 +447,7 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) cmOStringStream m; m << "Found Windows SDK v7.1: " << winSDK_7_1; mf->DisplayStatus(m.str().c_str(), -1); - this->PlatformToolset = "Windows7.1SDK"; + this->DefaultPlatformToolset = "Windows7.1SDK"; return true; } else diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index ede6b1b..b4dcc7e 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -31,7 +31,7 @@ public: virtual bool MatchesGeneratorName(const std::string& name) const; - virtual bool SetGeneratorToolset(std::string const& ts); + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); virtual void GenerateBuildCommand( std::vector<std::string>& makeCommand, @@ -66,7 +66,7 @@ public: bool IsMasmEnabled() const { return this->MasmEnabled; } /** The toolset name for the target platform. */ - const char* GetPlatformToolset(); + const char* GetPlatformToolset() const; /** * Where does this version of Visual Studio look for macros for the @@ -99,7 +99,8 @@ protected: std::string const& GetMSBuildCommand(); - std::string PlatformToolset; + std::string GeneratorToolset; + std::string DefaultPlatformToolset; bool ExpressEdition; bool MasmEnabled; @@ -122,5 +123,6 @@ private: virtual std::string FindMSBuildCommand(); virtual std::string FindDevEnvCommand(); virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); } + void AddVSPlatformToolsetDefinition(cmMakefile* mf) const; }; #endif diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 4caa7f2..7033f2a 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -117,7 +117,7 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( this->ExpressEdition = cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;" "ProductDir", vc11Express, cmSystemTools::KeyWOW64_32); - this->PlatformToolset = "v110"; + this->DefaultPlatformToolset = "v110"; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 6cd9f12..40f8b05 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -92,7 +92,7 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( this->ExpressEdition = cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;" "ProductDir", vc12Express, cmSystemTools::KeyWOW64_32); - this->PlatformToolset = "v120"; + this->DefaultPlatformToolset = "v120"; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e5fc436..29a5955 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -202,16 +202,19 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory } //---------------------------------------------------------------------------- -bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts) +bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) { if(this->XcodeVersion >= 30) { - this->PlatformToolset = ts; + this->GeneratorToolset = ts; + mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", + this->GeneratorToolset.c_str()); return true; } else { - return cmGlobalGenerator::SetGeneratorToolset(ts); + return cmGlobalGenerator::SetGeneratorToolset(ts, mf); } } @@ -239,11 +242,6 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const& } } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - if(!this->PlatformToolset.empty()) - { - mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", - this->PlatformToolset.c_str()); - } this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); @@ -2442,8 +2440,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) } else { - const char* theConfig = - this->CurrentMakefile->GetDefinition("CMAKE_BUILD_TYPE"); + std::string theConfig = + this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmXCodeObject* buildSettings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->CreateBuildSettings(cmtarget, buildSettings, theConfig); @@ -2821,11 +2819,7 @@ void cmGlobalXCodeGenerator i != this->CurrentConfigurationTypes.end(); ++i) { // Get the current configuration name. - const char* configName = i->c_str(); - if(!*configName) - { - configName = 0; - } + std::string configName = *i; if(this->XcodeVersion >= 50) { @@ -3363,10 +3357,10 @@ void cmGlobalXCodeGenerator buildSettings->AddAttribute("MACOSX_DEPLOYMENT_TARGET", this->CreateString(deploymentTarget)); } - if(!this->PlatformToolset.empty()) + if(!this->GeneratorToolset.empty()) { buildSettings->AddAttribute("GCC_VERSION", - this->CreateString(this->PlatformToolset.c_str())); + this->CreateString(this->GeneratorToolset.c_str())); } // Put this last so it can override existing settings @@ -3512,11 +3506,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( ct = this->CurrentConfigurationTypes.begin(); ct != this->CurrentConfigurationTypes.end(); ++ct) { - const char* configName = 0; - if(!ct->empty()) - { - configName = ct->c_str(); - } + std::string configName = *ct; for(std::vector<cmXCodeObject*>::iterator i = targets.begin(); i != targets.end(); ++i) { @@ -3969,7 +3959,7 @@ bool cmGlobalXCodeGenerator::IsMultiConfig() void cmGlobalXCodeGenerator ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const { - const char* configName = this->GetCMakeCFGIntDir(); + std::string configName = this->GetCMakeCFGIntDir(); std::string dir = this->GetObjectsNormalDirectory( "$(PROJECT_NAME)", configName, gt->Target); if(this->XcodeVersion >= 21) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c9937ed..ae23e3b 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -89,7 +89,7 @@ public: i.e. "Can I build Debug and Release in the same tree?" */ virtual bool IsMultiConfig(); - virtual bool SetGeneratorToolset(std::string const& ts); + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); void AppendFlag(std::string& flags, std::string const& flag); private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, @@ -246,7 +246,7 @@ private: std::map<std::string, cmXCodeObject* > TargetGroup; std::map<std::string, cmXCodeObject* > FileRefs; std::vector<std::string> Architectures; - std::string PlatformToolset; + std::string GeneratorToolset; }; #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 543d58d..c8c8c79 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -875,6 +875,13 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, return replaceValues.ObjectDir; } } + if(replaceValues.ObjectFileDir) + { + if(variable == "OBJECT_FILE_DIR") + { + return replaceValues.ObjectFileDir; + } + } if(replaceValues.Objects) { if(variable == "OBJECTS") diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 32da21b..ad73073 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -269,6 +269,7 @@ public: const char* Output; const char* Object; const char* ObjectDir; + const char* ObjectFileDir; const char* Flags; const char* ObjectsQuoted; const char* SONameFlag; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a08d731..85017ad 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -684,6 +684,11 @@ cmMakefileTargetGenerator cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); + std::string objectFileDir = cmSystemTools::GetFilenamePath(obj); + objectFileDir = this->Convert(objectFileDir, + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + vars.ObjectFileDir = objectFileDir.c_str(); vars.Flags = flags.c_str(); std::string definesString = "$("; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c3b4c75..24689fb 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -385,6 +385,7 @@ cmNinjaTargetGenerator vars.TargetPDB = "$TARGET_PDB"; vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; + vars.ObjectFileDir = "$OBJECT_FILE_DIR"; cmMakefile* mf = this->GetMakefile(); @@ -623,6 +624,10 @@ cmNinjaTargetGenerator vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(objectDir.c_str()), cmLocalGenerator::SHELL); + std::string objectFileDir = cmSystemTools::GetFilenamePath(objectFileName); + vars["OBJECT_FILE_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( + ConvertToNinjaPath(objectFileDir.c_str()), + cmLocalGenerator::SHELL); this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars); @@ -651,6 +656,7 @@ cmNinjaTargetGenerator compileObjectVars.Source = escapedSourceFileName.c_str(); compileObjectVars.Object = objectFileName.c_str(); compileObjectVars.ObjectDir = objectDir.c_str(); + compileObjectVars.ObjectFileDir = objectFileDir.c_str(); compileObjectVars.Flags = vars["FLAGS"].c_str(); compileObjectVars.Defines = vars["DEFINES"].c_str(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9906c4b..16dc724 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1462,11 +1462,6 @@ int cmake::ActualConfigure() "Name of generator toolset.", cmCacheManager::INTERNAL); } - if(!this->GeneratorToolset.empty() && - !this->GlobalGenerator->SetGeneratorToolset(this->GeneratorToolset)) - { - return -2; - } // reset any system configuration information, except for when we are // InTryCompile. With TryCompile the system info is taken from the parent's diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 77f1e4e..9f9f6bb 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -25,6 +25,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include <cmsys/Encoding.hxx> +#include <locale.h> #ifdef CMAKE_BUILD_WITH_CMAKE //---------------------------------------------------------------------------- @@ -162,6 +163,7 @@ static void cmakemainProgressCallback(const char *m, float prog, int main(int ac, char const* const* av) { + setlocale(LC_ALL, ""); cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(ac, av); ac = args.argc(); diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 3eb5551..167e348 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -19,6 +19,7 @@ #include "CTest/cmCTestScriptHandler.h" #include "CTest/cmCTestLaunch.h" #include "cmsys/Encoding.hxx" +#include <locale.h> //---------------------------------------------------------------------------- static const char * cmDocumentationName[][2] = @@ -44,7 +45,8 @@ static const char * cmDocumentationOptions[][2] = {"-V,--verbose", "Enable verbose output from tests."}, {"-VV,--extra-verbose", "Enable more verbose output from tests."}, {"--debug", "Displaying more verbose internals of CTest."}, - {"--output-on-failure"}, + {"--output-on-failure", "Output anything outputted by the test program " + "if the test should fail."}, {"-F", "Enable failover."}, {"-j <jobs>, --parallel <jobs>", "Run the tests in parallel using the" "given number of jobs."}, @@ -114,6 +116,8 @@ static const char * cmDocumentationOptions[][2] = // this is a test driver program for cmCTest. int main (int argc, char const* const* argv) { + setlocale(LC_ALL, ""); + cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = encoding_args.argc(); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8d2b7fc..05442a1 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2184,6 +2184,24 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "Process file.*foo.py.*Total LOC:.*13.*Percentage Coverage: 84.62.*" ENVIRONMENT COVFILE=) + # Adding a test case for non-python Cobertura Coverage + configure_file( + "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/DartConfiguration.tcl.in" + "${CMake_BINARY_DIR}/Testing/CoberturaCoverage/DartConfiguration.tcl") + configure_file( + "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/coverage.xml.in" + "${CMake_BINARY_DIR}/Testing/CoberturaCoverage/coverage.xml") + file(COPY "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/src" + DESTINATION "${CMake_BINARY_DIR}/Testing/CoberturaCoverage") + add_test(NAME CTestCoberturaCoverage + COMMAND cmake -E chdir + ${CMake_BINARY_DIR}/Testing/CoberturaCoverage + $<TARGET_FILE:ctest> -T Coverage --debug) + set_tests_properties(CTestCoberturaCoverage PROPERTIES + PASS_REGULAR_EXPRESSION + "Process file.*CoverageTest.java.*Total LOC:.*18.*Percentage Coverage: 72.22.*" + ENVIRONMENT COVFILE=) + function(add_config_tests cfg) set(base "${CMake_BINARY_DIR}/Tests/CTestConfig") diff --git a/Tests/CoberturaCoverage/DartConfiguration.tcl.in b/Tests/CoberturaCoverage/DartConfiguration.tcl.in new file mode 100644 index 0000000..954f59a --- /dev/null +++ b/Tests/CoberturaCoverage/DartConfiguration.tcl.in @@ -0,0 +1,8 @@ +# This file is configured by CMake automatically as DartConfiguration.tcl +# If you choose not to use CMake, this file may be hand configured, by +# filling in the required variables. + + +# Configuration directories and files +SourceDirectory: ${CMake_SOURCE_DIR}/Testing/CoberturaCoverage +BuildDirectory: ${CMake_BINARY_DIR}/Testing/CoberturaCoverage diff --git a/Tests/CoberturaCoverage/coverage.xml.in b/Tests/CoberturaCoverage/coverage.xml.in new file mode 100644 index 0000000..b3f6691 --- /dev/null +++ b/Tests/CoberturaCoverage/coverage.xml.in @@ -0,0 +1,112 @@ +<?xml version="1.0"?> +<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd"> + +<coverage line-rate="0.7222222222222222" branch-rate="0.875" lines-covered="13" lines-valid="18" branches-covered="7" branches-valid="8" complexity="0.0" version="1.9.4.1" timestamp="1401890139281"> + <sources> + <source>${CMake_BINARY_DIR}/Testing/CoberturaCoverage/src/main/java/</source> + </sources> + <packages> + <package name="org.cmake.Coverage" line-rate="0.7222222222222222" branch-rate="0.875" complexity="0.0"> + <classes> + <class name="org.cmake.Coverage.CoverageTest" filename="org/cmake/CoverageTest.java" line-rate="0.7222222222222222" branch-rate="0.875" complexity="0.0"> + <methods> + <method name="<clinit>" signature="()V" line-rate="1.0" branch-rate="1.0"> + <lines> + <line number="10" hits="2" branch="false"/> + <line number="11" hits="2" branch="false"/> + </lines> + </method> + <method name="<init>" signature="()V" line-rate="0.0" branch-rate="1.0"> + <lines> + <line number="8" hits="0" branch="false"/> + <line number="12" hits="0" branch="false"/> + </lines> + </method> + <method name="equalsVarOne" signature="(Ljava/lang/String;)Ljava/lang/Boolean;" line-rate="0.6666666666666666" branch-rate="0.5"> + <lines> + <line number="16" hits="2" branch="true" condition-coverage="50% (1/2)"> + <conditions> + <condition number="0" type="jump" coverage="50%"/> + </conditions> + </line> + <line number="17" hits="2" branch="false"/> + <line number="20" hits="0" branch="false"/> + </lines> + </method> + <method name="equalsVarTwo" signature="(Ljava/lang/String;)Z" line-rate="1.0" branch-rate="1.0"> + <lines> + <line number="26" hits="4" branch="true" condition-coverage="100% (2/2)"> + <conditions> + <condition number="0" type="jump" coverage="100%"/> + </conditions> + </line> + <line number="27" hits="2" branch="false"/> + <line number="30" hits="2" branch="false"/> + </lines> + </method> + <method name="timesIntOne" signature="(Ljava/lang/Integer;)Ljava/lang/Integer;" line-rate="0.0" branch-rate="1.0"> + <lines> + <line number="35" hits="0" branch="false"/> + <line number="36" hits="0" branch="false"/> + </lines> + </method> + <method name="whileLoop" signature="(Ljava/lang/Integer;)Z" line-rate="1.0" branch-rate="1.0"> + <lines> + <line number="41" hits="2" branch="false"/> + <line number="42" hits="10" branch="true" condition-coverage="100% (2/2)"> + <conditions> + <condition number="0" type="jump" coverage="100%"/> + </conditions> + </line> + <line number="43" hits="8" branch="false"/> + <line number="45" hits="2" branch="true" condition-coverage="100% (2/2)"> + <conditions> + <condition number="0" type="jump" coverage="100%"/> + </conditions> + </line> + <line number="46" hits="1" branch="false"/> + <line number="49" hits="1" branch="false"/> + </lines> + </method> + </methods> + <lines> + <line number="8" hits="0" branch="false"/> + <line number="10" hits="2" branch="false"/> + <line number="11" hits="2" branch="false"/> + <line number="12" hits="0" branch="false"/> + <line number="16" hits="2" branch="true" condition-coverage="50% (1/2)"> + <conditions> + <condition number="0" type="jump" coverage="50%"/> + </conditions> + </line> + <line number="17" hits="2" branch="false"/> + <line number="20" hits="0" branch="false"/> + <line number="26" hits="4" branch="true" condition-coverage="100% (2/2)"> + <conditions> + <condition number="0" type="jump" coverage="100%"/> + </conditions> + </line> + <line number="27" hits="2" branch="false"/> + <line number="30" hits="2" branch="false"/> + <line number="35" hits="0" branch="false"/> + <line number="36" hits="0" branch="false"/> + <line number="41" hits="2" branch="false"/> + <line number="42" hits="10" branch="true" condition-coverage="100% (2/2)"> + <conditions> + <condition number="0" type="jump" coverage="100%"/> + </conditions> + </line> + <line number="43" hits="8" branch="false"/> + <line number="45" hits="2" branch="true" condition-coverage="100% (2/2)"> + <conditions> + <condition number="0" type="jump" coverage="100%"/> + </conditions> + </line> + <line number="46" hits="1" branch="false"/> + <line number="49" hits="1" branch="false"/> + </lines> + </class> + </classes> + </package> + </packages> +</coverage> diff --git a/Tests/CoberturaCoverage/src/main/java/org/cmake/CoverageTest.java b/Tests/CoberturaCoverage/src/main/java/org/cmake/CoverageTest.java new file mode 100644 index 0000000..4fb43c6 --- /dev/null +++ b/Tests/CoberturaCoverage/src/main/java/org/cmake/CoverageTest.java @@ -0,0 +1,52 @@ +package org.cmake.Coverage; + +import java.io.Serializable; +import java.util.Map; +import java.util.List; +import java.awt.*; + +public class CoverageTest { + + public static String VarOne = "test1"; + public static String VarTwo = "test2"; + private Integer IntOne = 4; + + public static Boolean equalsVarOne(String inString) { + + if(VarOne.equals(inString)){ + return true; + } + else { + return false; + } + } + + public static boolean equalsVarTwo(String inString){ + + if(VarTwo.equals(inString)){ + return true; + } + else { + return false; + } + } + + private Integer timesIntOne(Integer inVal){ + + return inVal * IntOne; + } + + public static boolean whileLoop(Integer StopInt){ + + Integer i = 0; + while(i < StopInt){ + i=i+1; + } + if (i.equals(5)){ + return true; + } + else { + return false; + } + } +} diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 5fa46bf..222250c 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -83,6 +83,14 @@ set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_RELEASE CMAKE_IS_FUN_IN_RELEASE_MODE ) +set_property(DIRECTORY + PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO + CMAKE_IS_FUN_IN_RELEASE_MODE + ) +set_property(DIRECTORY + PROPERTY COMPILE_DEFINITIONS_MINSIZEREL + CMAKE_IS_FUN_IN_RELEASE_MODE + ) set(TEST_SEP "a b c") separate_arguments(TEST_SEP) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index d3d9132..3f17dcc 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -83,6 +83,14 @@ set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_RELEASE CMAKE_IS_FUN_IN_RELEASE_MODE ) +set_property(DIRECTORY + PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO + CMAKE_IS_FUN_IN_RELEASE_MODE + ) +set_property(DIRECTORY + PROPERTY COMPILE_DEFINITIONS_MINSIZEREL + CMAKE_IS_FUN_IN_RELEASE_MODE + ) set(TEST_SEP "a b c") separate_arguments(TEST_SEP) diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt index bf1f190..d0d526c 100644 --- a/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt @@ -1,4 +1,4 @@ -CMake Error: +CMake Error at CMakeLists.txt:[0-9]+ \(project\): Generator .* diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset-toolchain.cmake b/Tests/RunCMake/GeneratorToolset/BadToolset-toolchain.cmake new file mode 100644 index 0000000..7bbf327 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolset-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_TOOLSET "Bad Toolset") diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-stderr.txt new file mode 100644 index 0000000..d0d526c --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + does not support toolset specification, but toolset + + Bad Toolset + + was specified.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index 1ccc1ad..d39f33f 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -12,6 +12,17 @@ else() endif() set(RunCMake_GENERATOR_TOOLSET "") + set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) + +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3) + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) + run_cmake(TestToolsetToolchain) + unset(RunCMake_TEST_OPTIONS) +else() + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/BadToolset-toolchain.cmake) + run_cmake(BadToolsetToolchain) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolset-toolchain.cmake b/Tests/RunCMake/GeneratorToolset/TestToolset-toolchain.cmake new file mode 100644 index 0000000..bee2ae4 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolset-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_TOOLSET "Test Toolset") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-stderr.txt new file mode 100644 index 0000000..0623e90 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TestToolsetToolchain.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at TestToolsetToolchain.cmake:[0-9]+ \(message\): + CMAKE_(VS|XCODE)_PLATFORM_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain.cmake new file mode 100644 index 0000000..7c1c415 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain.cmake @@ -0,0 +1,25 @@ +if("x${CMAKE_GENERATOR_TOOLSET}" STREQUAL "xTest Toolset") + message(SEND_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() +if(CMAKE_GENERATOR MATCHES "Visual Studio") + if("x${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "xTest Toolset") + message(SEND_ERROR "CMAKE_VS_PLATFORM_TOOLSET is \"Test Toolset\" as expected.") + else() + message(FATAL_ERROR + "CMAKE_VS_PLATFORM_TOOLSET is \"${CMAKE_VS_PLATFORM_TOOLSET}\" " + "but should be \"Test Toolset\"!") + endif() +endif() +if(CMAKE_GENERATOR MATCHES "Xcode") + if("x${CMAKE_XCODE_PLATFORM_TOOLSET}" STREQUAL "xTest Toolset") + message(SEND_ERROR "CMAKE_XCODE_PLATFORM_TOOLSET is \"Test Toolset\" as expected.") + else() + message(FATAL_ERROR + "CMAKE_XCODE_PLATFORM_TOOLSET is \"${CMAKE_XCODE_PLATFORM_TOOLSET}\" " + "but should be \"Test Toolset\"!") + endif() +endif() |