From 3e9f6e36f3f5fd50303d1b71fc153c0ae8f916f5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Jun 2014 13:07:08 -0400 Subject: Xcode: Rename internal variable {Platform => Generator}Toolset The latter matches with CMAKE_GENERATOR_TOOLSET better. --- Source/cmGlobalXCodeGenerator.cxx | 10 +++++----- Source/cmGlobalXCodeGenerator.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e5fc436..6c0eaea 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -206,7 +206,7 @@ bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts) { if(this->XcodeVersion >= 30) { - this->PlatformToolset = ts; + this->GeneratorToolset = ts; return true; } else @@ -239,10 +239,10 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vectorconst& } } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - if(!this->PlatformToolset.empty()) + if(!this->GeneratorToolset.empty()) { mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", - this->PlatformToolset.c_str()); + this->GeneratorToolset.c_str()); } this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); const char* osxArch = @@ -3363,10 +3363,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 diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c9937ed..ecbc3f9 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -246,7 +246,7 @@ private: std::map TargetGroup; std::map FileRefs; std::vector Architectures; - std::string PlatformToolset; + std::string GeneratorToolset; }; #endif -- cgit v0.12 From 98afb4549f66c692eeec8bbc8a1f7b333d3051a5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Jun 2014 13:09:35 -0400 Subject: VS: Split user- and generator-provided PlatformToolset Divide the cmGlobalVisualStudio10Generator "PlatformToolset" member into two members representing the generator-selected default toolset and the user-specified CMAKE_GENERATOR_TOOLSET value. Prefer the user-specified value, if any, and then fall back to the generator-selected default. --- Source/cmGlobalVisualStudio10Generator.cxx | 28 +++++++++++++++++++--------- Source/cmGlobalVisualStudio10Generator.h | 6 ++++-- Source/cmGlobalVisualStudio11Generator.cxx | 2 +- Source/cmGlobalVisualStudio12Generator.cxx | 2 +- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 37a416b..a252fa0 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -118,7 +118,7 @@ cmGlobalVisualStudio10Generator::MatchesGeneratorName( bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts) { - this->PlatformToolset = ts; + this->GeneratorToolset = ts; return true; } @@ -126,10 +126,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 +221,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 +427,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( //---------------------------------------------------------------------------- bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) { - if(!this->PlatformToolset.empty()) + if(this->GetPlatformToolset()) { return true; } @@ -435,7 +445,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..0360fa6 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -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"; } //---------------------------------------------------------------------------- -- cgit v0.12 From 528e8af19f68c01c3a42af9e74801a39c16237dd Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Jun 2014 13:21:55 -0400 Subject: Allow a toolchain file to specify a generator toolset Delay use of CMAKE_GENERATOR_TOOLSET until the CMakeSystem.cmake file has been configured and loaded during the first project() or enable_language() command. This gives the toolchain file named by CMAKE_TOOLCHAIN_FILE a chance to set CMAKE_GENERATOR_TOOLSET. This point is still early enough to set the generator toolset prior to the initialization of any languages that might use the toolset. The cmake::GeneratorToolset member variable remains an indication of what was specified by the -T option or loaded from the cache. It does not need to be updated based on the toolchain file setting. The cmMakefile::TryCompile can still pass cmake::GeneratorToolset into the inner instance because the try-compiled project will do platform and language initialization using the CMakeSystem module configured for the outer project. Extend the RunCMake.GeneratorToolset test with cases that use a toolchain file to set CMAKE_GENERATOR_TOOLSET. --- Help/release/dev/delay-generator-toolset.rst | 8 +++++++ Help/variable/CMAKE_GENERATOR_TOOLSET.rst | 6 ++++++ Source/cmGlobalGenerator.cxx | 15 ++++++++++--- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 4 +++- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 12 +++++------ Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmake.cxx | 5 ----- .../GeneratorToolset/BadToolset-stderr.txt | 2 +- .../GeneratorToolset/BadToolset-toolchain.cmake | 1 + .../BadToolsetToolchain-result.txt | 1 + .../BadToolsetToolchain-stderr.txt | 10 +++++++++ .../GeneratorToolset/BadToolsetToolchain.cmake | 1 + Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake | 11 ++++++++++ .../GeneratorToolset/TestToolset-toolchain.cmake | 1 + .../TestToolsetToolchain-result.txt | 1 + .../TestToolsetToolchain-stderr.txt | 9 ++++++++ .../GeneratorToolset/TestToolsetToolchain.cmake | 25 ++++++++++++++++++++++ 19 files changed, 98 insertions(+), 20 deletions(-) create mode 100644 Help/release/dev/delay-generator-toolset.rst create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolset-toolchain.cmake create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-result.txt create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-stderr.txt create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetToolchain.cmake create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolset-toolchain.cmake create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-result.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-stderr.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetToolchain.cmake 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/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::vectorconst& 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 a252fa0..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->GeneratorToolset = ts; + this->AddVSPlatformToolsetDefinition(mf); return true; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 0360fa6..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& makeCommand, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6c0eaea..87ccfbd 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->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::vectorconst& } } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - if(!this->GeneratorToolset.empty()) - { - mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", - this->GeneratorToolset.c_str()); - } this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ecbc3f9..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, 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/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() -- cgit v0.12