Last active
July 13, 2016 19:21
-
-
Save rpavlik/3ad0e691e5d51606bd67 to your computer and use it in GitHub Desktop.
Compute the CMake generator for Windows (for use in Jenkins, for instance) based on some orthogonal environment variables.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ComputeGenerator.groovy by Ryan Pavlik - maintained at https://gist.github.com/rpavlik/3ad0e691e5d51606bd67 */ | |
/* Uncomment the following for testing purposes only */ | |
/* | |
VS='12' | |
BIT='64' | |
*/ | |
/* should give result [GENERATOR:Visual Studio 12 2013 Win64] */ | |
def getVSVersionName(vsVerNum) { | |
def result = 'Visual Studio ' + vsVerNum | |
switch (vsVerNum) { | |
case '8': | |
result += ' 2005' | |
break | |
case '9': | |
result += ' 2008' | |
break | |
case '10': | |
result += ' 2010' | |
break | |
case '11': | |
result += ' 2012' | |
break | |
case '12': | |
result += ' 2013' | |
break | |
case '14': | |
result += ' 2015' | |
break | |
} | |
result | |
} | |
def getVSGenerator(vsVerNum, bits) { | |
def result = getVSVersionName(vsVerNum) | |
if (bits.equals('64')) { | |
result += ' Win64'; | |
} | |
result | |
} | |
/* return value */ | |
[GENERATOR: getVSGenerator(VS, BIT)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment