@@ -34,35 +34,33 @@ set GENERATOR=%1
3434:: TODO Print CMake and VS versions. Maybe in build-deps.cmd would be better than here.
3535
3636:: Supported Visual Studio versions:
37- set GENERATOR_VS2015_32 = " Visual Studio 14 2015"
38- set GENERATOR_VS2015_64 = " Visual Studio 14 2015 Win64"
37+ set GENERATORS[0] = " Visual Studio 14 2015"
38+ set GENERATORS[1] = " Visual Studio 14 2015 Win64"
3939:: TODO Check CMake version and convert possible new format (>= 3.0) generator names
4040:: to the old versions if using older CMake for VS <= 2013,
4141:: see http://www.cmake.org/cmake/help/v3.0/release/3.0.0.html#other-changes
42- set GENERATOR_VS2013_32 = " Visual Studio 12"
43- set GENERATOR_VS2013_64 = " Visual Studio 12 Win64"
44- set GENERATOR_VS2012_32 = " Visual Studio 11"
45- set GENERATOR_VS2012_64 = " Visual Studio 11 Win64"
46- set GENERATOR_VS2010_32 = " Visual Studio 10"
47- set GENERATOR_VS2010_64 = " Visual Studio 10 Win64"
48- set GENERATOR_VS2008_32 = " Visual Studio 9 2008"
49- set GENERATOR_VS2008_64 = " Visual Studio 9 2008 Win64"
50- set GENERATOR_DEFAULT = %GENERATOR_VS2015_64 %
42+ set GENERATORS[2] = " Visual Studio 12"
43+ set GENERATORS[3] = " Visual Studio 12 Win64"
44+ set GENERATORS[4] = " Visual Studio 11"
45+ set GENERATORS[5] = " Visual Studio 11 Win64"
46+ set GENERATORS[6] = " Visual Studio 10"
47+ set GENERATORS[7] = " Visual Studio 10 Win64"
48+ set GENERATORS[8] = " Visual Studio 9 2008"
49+ set GENERATORS[9] = " Visual Studio 9 2008 Win64"
50+ set GENERATOR_DEFAULT = %GENERATORS[1] %
5151
5252IF " !GENERATOR! " == " " (
5353 set GENERATOR = %GENERATOR_DEFAULT%
5454 call utils\cecho.cmd 0 14 " vs-cfg.cmd: Warning: Generator not passed - using the default '`" %GENERATOR_DEFAULT% `'`t
5555)
5656
57- IF NOT !GENERATOR! == %GENERATOR_VS2008_32% IF NOT !GENERATOR! == %GENERATOR_VS2008_64% (
58- IF NOT !GENERATOR! == %GENERATOR_VS2010_32% IF NOT !GENERATOR! == %GENERATOR_VS2010_64% (
59- IF NOT !GENERATOR! == %GENERATOR_VS2012_32% IF NOT !GENERATOR! == %GENERATOR_VS2012_64% (
60- IF NOT !GENERATOR! == %GENERATOR_VS2013_32% IF NOT !GENERATOR! == %GENERATOR_VS2013_64% (
61- IF NOT !GENERATOR! == %GENERATOR_VS2015_32% IF NOT !GENERATOR! == %GENERATOR_VS2015_64% (
62- call utils\cecho.cmd 0 12 " vs-cfg.cmd: Invalid or unsupported CMake generator string passed: '`" !GENERATOR! `'" . Cannot proceed, aborting!"
63- exit /b 1
64- )))))
57+ FOR /l %%i in (0,1,9) DO (
58+ IF !GENERATOR! == !GENERATORS[%%i ]! GOTO :GeneratorValid
59+ )
60+ call utils\cecho.cmd 0 12 " vs-cfg.cmd: Invalid or unsupported CMake generator string passed: '`" !GENERATOR! `'" . Cannot proceed, aborting!"
61+ exit /b 1
6562
63+ :GeneratorValid
6664:: Figure out the build configuration from the CMake generator string.
6765:: Are we building 32-bit or 64-bit version.
6866set ARCH_BITS = 32
@@ -71,6 +69,7 @@ set TARGET_ARCH=x86
7169set VS_PLATFORM = Win32
7270
7371:: Split the string for closer inspection.
72+ :: TODO A bit clumsy and not dynamic when new VS is released, clean this up.
7473:: VS_VER and VC_VER are convenience variables used f.ex. for filenames.
7574set GENERATOR_NO_DOUBLEQUOTES = %GENERATOR:" =%
7675set GENERATOR_SPLIT = %GENERATOR_NO_DOUBLEQUOTES: =, %
0 commit comments