From 3753840de5d4483902d6a99f94725a8ac6d5f53e Mon Sep 17 00:00:00 2001 From: Edward Hennis Date: Mon, 10 Feb 2020 18:24:19 -0500 Subject: [PATCH] Handle build directories for specific versions of gcc/clang: * Example: gcc.Debug will use the the default version of gcc installed on the system. gcc-9.Debug will use version 9, regardless of the default. This will be most useful when the default is older than required or desired. --- Builds/Test.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Builds/Test.py b/Builds/Test.py index f42538d8f..29cf8ea8a 100755 --- a/Builds/Test.py +++ b/Builds/Test.py @@ -272,9 +272,17 @@ def run_cmake(directory, cmake_dir, args): args += ( '-DCMAKE_BUILD_TYPE=Debug', ) if re.search('release', cmake_dir): args += ( '-DCMAKE_BUILD_TYPE=Release', ) - if re.search('gcc', cmake_dir): + m = re.search('gcc(-[^.]*)', cmake_dir) + if m: + args += ( '-DCMAKE_C_COMPILER=' + m.group(0), + '-DCMAKE_CXX_COMPILER=g++' + m.group(1), ) + elif re.search('gcc', cmake_dir): args += ( '-DCMAKE_C_COMPILER=gcc', '-DCMAKE_CXX_COMPILER=g++', ) - if re.search('clang', cmake_dir): + m = re.search('clang(-[^.]*)', cmake_dir) + if m: + args += ( '-DCMAKE_C_COMPILER=' + m.group(0), + '-DCMAKE_CXX_COMPILER=clang++' + m.group(1), ) + elif re.search('clang', cmake_dir): args += ( '-DCMAKE_C_COMPILER=clang', '-DCMAKE_CXX_COMPILER=clang++', ) args += ( os.path.join('..', '..', '..'), )