diff options
-rw-r--r-- | Help/generator/Visual Studio 10 2010.rst | 17 | ||||
-rw-r--r-- | Help/generator/Visual Studio 11 2012.rst | 18 | ||||
-rw-r--r-- | Help/generator/Visual Studio 12 2013.rst | 15 | ||||
-rw-r--r-- | Help/generator/Visual Studio 14.rst | 15 | ||||
-rw-r--r-- | Help/generator/Visual Studio 8 2005.rst | 14 | ||||
-rw-r--r-- | Help/generator/Visual Studio 9 2008.rst | 18 | ||||
-rw-r--r-- | Help/release/dev/vs-generator-platform.rst | 7 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 14 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 1 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 17 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 15 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.h | 2 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorPlatform/x64Platform.cmake | 7 |
16 files changed, 146 insertions, 31 deletions
diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst index 000677a..77ea9df 100644 --- a/Help/generator/Visual Studio 10 2010.rst +++ b/Help/generator/Visual Studio 10 2010.rst @@ -3,10 +3,17 @@ Visual Studio 10 2010 Generates Visual Studio 10 (VS 2010) project files. -It is possible to append a space followed by the platform name to -create project files for a specific target platform. E.g. -"Visual Studio 10 2010 Win64" will create project files for the -x64 processor; "Visual Studio 10 2010 IA64" for Itanium. +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set +to specify a target platform name. + +For compatibility with CMake versions prior to 3.1, one may specify +a target platform name optionally at the end of this generator name: + +``Visual Studio 10 2010 Win64`` + Specify target platform ``x64``. + +``Visual Studio 10 2010 IA64`` + Specify target platform ``Itanium``. For compatibility with CMake versions prior to 3.0, one may specify this -generator using the name "Visual Studio 10" without the year component. +generator using the name ``Visual Studio 10`` without the year component. diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst index 42f6f91..5fa7f2c 100644 --- a/Help/generator/Visual Studio 11 2012.rst +++ b/Help/generator/Visual Studio 11 2012.rst @@ -3,10 +3,20 @@ Visual Studio 11 2012 Generates Visual Studio 11 (VS 2012) project files. -It is possible to append a space followed by the platform name to -create project files for a specific target platform. E.g. -"Visual Studio 11 2012 Win64" will create project files for the -x64 processor; "Visual Studio 11 2012 ARM" for ARM. +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set +to specify a target platform name. + +For compatibility with CMake versions prior to 3.1, one may specify +a target platform name optionally at the end of this generator name: + +``Visual Studio 11 2012 Win64`` + Specify target platform ``x64``. + +``Visual Studio 11 2012 ARM`` + Specify target platform ``ARM``. + +``Visual Studio 11 2012 <WinCE-SDK>`` + Specify target platform matching a Windows CE SDK name. For compatibility with CMake versions prior to 3.0, one may specify this generator using the name "Visual Studio 11" without the year component. diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst index d2f4912..2c3b119 100644 --- a/Help/generator/Visual Studio 12 2013.rst +++ b/Help/generator/Visual Studio 12 2013.rst @@ -3,10 +3,17 @@ Visual Studio 12 2013 Generates Visual Studio 12 (VS 2013) project files. -It is possible to append a space followed by the platform name to -create project files for a specific target platform. E.g. -"Visual Studio 12 2013 Win64" will create project files for the -x64 processor; "Visual Studio 12 2013 ARM" for ARM. +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set +to specify a target platform name. + +For compatibility with CMake versions prior to 3.1, one may specify +a target platform name optionally at the end of this generator name: + +``Visual Studio 12 2013 Win64`` + Specify target platform ``x64``. + +``Visual Studio 12 2013 ARM`` + Specify target platform ``ARM``. For compatibility with CMake versions prior to 3.0, one may specify this generator using the name "Visual Studio 12" without the year component. diff --git a/Help/generator/Visual Studio 14.rst b/Help/generator/Visual Studio 14.rst index 7f4fdc3..d621b7e 100644 --- a/Help/generator/Visual Studio 14.rst +++ b/Help/generator/Visual Studio 14.rst @@ -3,7 +3,14 @@ Visual Studio 14 Generates Visual Studio 14 project files. -It is possible to append a space followed by the platform name to -create project files for a specific target platform. E.g. -"Visual Studio 14 Win64" will create project files for the -x64 processor; "Visual Studio 14 ARM" for ARM. +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set +to specify a target platform name. + +For compatibility with CMake versions prior to 3.1, one may specify +a target platform name optionally at the end of this generator name: + +``Visual Studio 14 Win64`` + Specify target platform ``x64``. + +``Visual Studio 14 ARM`` + Specify target platform ``ARM``. diff --git a/Help/generator/Visual Studio 8 2005.rst b/Help/generator/Visual Studio 8 2005.rst index d7b6de2..29012c3 100644 --- a/Help/generator/Visual Studio 8 2005.rst +++ b/Help/generator/Visual Studio 8 2005.rst @@ -3,6 +3,14 @@ Visual Studio 8 2005 Generates Visual Studio 8 2005 project files. -It is possible to append a space followed by the platform name to -create project files for a specific target platform. E.g. "Visual -Studio 8 2005 Win64" will create project files for the x64 processor. +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set +to specify a target platform name. + +For compatibility with CMake versions prior to 3.1, one may specify +a target platform name optionally at the end of this generator name: + +``Visual Studio 8 2005 Win64`` + Specify target platform ``x64``. + +``Visual Studio 8 2005 <WinCE-SDK>`` + Specify target platform matching a Windows CE SDK name. diff --git a/Help/generator/Visual Studio 9 2008.rst b/Help/generator/Visual Studio 9 2008.rst index ade9fd5..40471b9 100644 --- a/Help/generator/Visual Studio 9 2008.rst +++ b/Help/generator/Visual Studio 9 2008.rst @@ -3,7 +3,17 @@ Visual Studio 9 2008 Generates Visual Studio 9 2008 project files. -It is possible to append a space followed by the platform name to -create project files for a specific target platform. E.g. "Visual -Studio 9 2008 Win64" will create project files for the x64 processor; -"Visual Studio 9 2008 IA64" for Itanium. +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set +to specify a target platform name. + +For compatibility with CMake versions prior to 3.1, one may specify +a target platform name optionally at the end of this generator name: + +``Visual Studio 9 2008 Win64`` + Specify target platform ``x64``. + +``Visual Studio 9 2008 IA64`` + Specify target platform ``Itanium``. + +``Visual Studio 9 2008 <WinCE-SDK>`` + Specify target platform matching a Windows CE SDK name. diff --git a/Help/release/dev/vs-generator-platform.rst b/Help/release/dev/vs-generator-platform.rst new file mode 100644 index 0000000..df90e19 --- /dev/null +++ b/Help/release/dev/vs-generator-platform.rst @@ -0,0 +1,7 @@ +vs-generator-platform +--------------------- + +* The Visual Studio generators for versions 8 (2005) and above + learned to read the target platform name from a new + :variable:`CMAKE_GENERATOR_PLATFORM` variable when it is + not specified as part of the generator name. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index e753c3c..e2d4645 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -125,6 +125,18 @@ bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, { return false; } + return this->cmGlobalVisualStudio8Generator::SetSystemName(s, mf); +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio10Generator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) +{ + if(!this->cmGlobalVisualStudio8Generator::SetGeneratorPlatform(p, mf)) + { + return false; + } if(this->GetPlatformName() == "Itanium" || this->GetPlatformName() == "x64") { if(this->IsExpressEdition() && !this->Find64BitTools(mf)) @@ -132,7 +144,7 @@ bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, return false; } } - return this->cmGlobalVisualStudio8Generator::SetSystemName(s, mf); + return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 1155508..f1ff9a4 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -31,6 +31,7 @@ public: virtual bool MatchesGeneratorName(const std::string& name) const; virtual bool SetSystemName(std::string const& s, cmMakefile* mf); + virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf); virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); virtual void GenerateBuildCommand( diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index cb82e54..401e475 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -262,6 +262,10 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() //---------------------------------------------------------------------------- std::string const& cmGlobalVisualStudio7Generator::GetPlatformName() const { + if(!this->GeneratorPlatform.empty()) + { + return this->GeneratorPlatform; + } return this->DefaultPlatformName; } @@ -269,6 +273,15 @@ std::string const& cmGlobalVisualStudio7Generator::GetPlatformName() const bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, cmMakefile* mf) { + mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION", + this->GetIntelProjectVersion()); + return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf); +} + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio7Generator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) +{ if(this->GetPlatformName() == "x64") { mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); @@ -278,9 +291,7 @@ bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); } mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); - mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION", - this->GetIntelProjectVersion()); - return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf); + return this->cmGlobalVisualStudioGenerator::SetGeneratorPlatform(p, mf); } void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index dc8b915..04a74db 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -46,6 +46,8 @@ public: virtual bool SetSystemName(std::string const& s, cmMakefile* mf); + virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf); + /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); @@ -175,6 +177,7 @@ protected: // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; + std::string GeneratorPlatform; std::string DefaultPlatformName; bool MasmEnabled; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index c91730f..745515b 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -159,6 +159,21 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) +{ + if(this->DefaultPlatformName == "Win32") + { + this->GeneratorPlatform = p; + return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform("", mf); + } + else + { + return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform(p, mf); + } +} + +//---------------------------------------------------------------------------- // ouput standard header for dsw file void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout) { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index cb6d3d9..4b41ed7 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -40,6 +40,8 @@ public: cmMakefile *, bool optional); virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf); + /** * Override Configure and Generate to add the build-system check * target. diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake index 60217bc..442eb9f 100644 --- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -2,6 +2,12 @@ include(RunCMake) run_cmake(NoPlatform) -set(RunCMake_TEST_OPTIONS "-DCMAKE_GENERATOR_PLATFORM=Bad Platform") -run_cmake(BadPlatform) -unset(RunCMake_TEST_OPTIONS) +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[0124])( 20[0-9][0-9])?$") + set(RunCMake_TEST_OPTIONS "-DCMAKE_GENERATOR_PLATFORM=x64") + run_cmake(x64Platform) + unset(RunCMake_TEST_OPTIONS) +else() + set(RunCMake_TEST_OPTIONS "-DCMAKE_GENERATOR_PLATFORM=Bad Platform") + run_cmake(BadPlatform) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt b/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt new file mode 100644 index 0000000..05a83ff --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_GENERATOR_PLATFORM is 'x64' as expected. +-- CMAKE_VS_PLATFORM_NAME is 'x64' as expected. diff --git a/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake b/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake new file mode 100644 index 0000000..a23bdc7 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake @@ -0,0 +1,7 @@ +foreach(v CMAKE_GENERATOR_PLATFORM CMAKE_VS_PLATFORM_NAME) + if("x${${v}}" STREQUAL "xx64") + message(STATUS "${v} is 'x64' as expected.") + else() + message(FATAL_ERROR "${v} is '${${v}}' but should be 'x64'!") + endif() +endforeach() |