From 0d34b2f7692aba066213c038b810623c216b6980 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 27 Nov 2017 11:42:35 +0200 Subject: Add {c,cxx}.class variables Compiler class describes a set of compilers that follow more or less the same command line interface. Compilers that don't belong to any of the existing classes are in classes of their own (say, Sun CC would be on its own if we were to support it). Currently defined compiler classes: gcc gcc, clang, clang-apple, icc (on non-Windows) msvc msvc, clang-cl, icc (Windows) --- build2/cc/module.cxx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'build2/cc/module.cxx') diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx index badd0ef..92a04a7 100644 --- a/build2/cc/module.cxx +++ b/build2/cc/module.cxx @@ -122,6 +122,8 @@ namespace build2 rs.assign (x_id_type) = ci.id.type; rs.assign (x_id_variant) = ci.id.variant; + rs.assign (x_class) = to_string (ci.class_); + rs.assign (x_version) = ci.version.string; rs.assign (x_version_major) = ci.version.major; rs.assign (x_version_minor) = ci.version.minor; @@ -159,15 +161,20 @@ namespace build2 dir_paths lib_dirs; dir_paths inc_dirs; - if (ci.id.value () == compiler_id::msvc) - { - lib_dirs = msvc_library_search_paths (ci.path, rs); - inc_dirs = msvc_header_search_paths (ci.path, rs); - } - else + switch (ci.class_) { - lib_dirs = gcc_library_search_paths (ci.path, rs); - inc_dirs = gcc_header_search_paths (ci.path, rs); + case compiler_class::gcc: + { + lib_dirs = gcc_library_search_paths (ci.path, rs); + inc_dirs = gcc_header_search_paths (ci.path, rs); + break; + } + case compiler_class::msvc: + { + lib_dirs = msvc_library_search_paths (ci.path, rs); + inc_dirs = msvc_header_search_paths (ci.path, rs); + break; + } } sys_lib_dirs_extra = lib_dirs.size (); -- cgit v1.1