aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/module.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-11-27 11:42:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-11-27 11:42:35 +0200
commit0d34b2f7692aba066213c038b810623c216b6980 (patch)
tree9c2d5db91cf075b84307957a8d9d3d10b1773a90 /build2/cc/module.cxx
parent6324239cf260f82312143a83855eb53bdc890a70 (diff)
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)
Diffstat (limited to 'build2/cc/module.cxx')
-rw-r--r--build2/cc/module.cxx23
1 files changed, 15 insertions, 8 deletions
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 ();