diff --git a/conans/client/build/autotools_environment.py b/conans/client/build/autotools_environment.py
index 2d99729ba..2dba8e3ad 100644
--- a/conans/client/build/autotools_environment.py
+++ b/conans/client/build/autotools_environment.py
@@ -1,42 +1,17 @@
 import copy
-import platform
 import os
+import platform
 
 from conans.client import join_arguments
-from conans.tools import environment_append, args_to_string, cpu_count, cross_building, detected_architecture
-from conans.client.tools.win import unix_path
+from conans.client.build.compiler_flags import (architecture_flag, format_libraries,
+                                                format_library_paths, format_defines,
+                                                sysroot_flag, format_include_paths,
+                                                build_type_flag, libcxx_flag, build_type_define,
+                                                libcxx_define, pic_flag, rpath_flags)
 from conans.client.tools.oss import OSInfo
-
-sun_cc_libcxx_flags_dict = {"libCstd": "-library=Cstd",
-                            "libstdcxx": "-library=stdcxx4",
-                            "libstlport": "-library=stlport4",
-                            "libstdc++": "-library=stdcpp"}
-
-architecture_dict = {"x86_64": "-m64", "x86": "-m32"}
-
-
-def stdlib_flags(compiler, libcxx):
-    ret = []
-    if compiler and "clang" in compiler:
-        if libcxx == "libc++":
-            ret.append("-stdlib=libc++")
-        else:
-            ret.append("-stdlib=libstdc++")
-    elif compiler == "sun-cc":
-        flag = sun_cc_libcxx_flags_dict.get(libcxx, None)
-        if flag:
-            ret.append(flag)
-    return ret
-
-
-def stdlib_defines(compiler, libcxx):
-    ret = []
-    if compiler == "gcc" or compiler == "clang":  # Maybe clang is using the standard library from g++
-        if libcxx == "libstdc++":
-            ret.append("_GLIBCXX_USE_CXX11_ABI=0")
-        elif str(libcxx) == "libstdc++11":
-            ret.append("_GLIBCXX_USE_CXX11_ABI=1")
-    return ret
+from conans.client.tools.win import unix_path
+from conans.tools import (environment_append, args_to_string, cpu_count, cross_building,
+                          detected_architecture)
 
 
 class AutoToolsBuildEnvironment(object):
@@ -47,9 +22,13 @@ class AutoToolsBuildEnvironment(object):
     - LDFLAGS (-L, others like -m64 -m32) linker
     """
 
-    def __init__(self, conanfile, win_bash=False):
+    def __init__(self, conanfile, win_bash=False, include_rpath_flags=False):
+        """
+        FIXME: include_rpath_flags CONAN 2.0 to default True? Could break many packages in center
+        """
         self._conanfile = conanfile
         self._win_bash = win_bash
+        self._include_rpath_flags = include_rpath_flags
         self.subsystem = OSInfo().detect_windows_subsystem() if self._win_bash else None
         self._deps_cpp_info = conanfile.deps_cpp_info
         self._arch = conanfile.settings.get_safe("arch")
@@ -122,8 +101,10 @@ class AutoToolsBuildEnvironment(object):
         :param args: Optional arguments to pass to configure.
         :param build: In which system the program will be built. "False" skips the --build flag
         :param host: In which system the generated program will run.  "False" skips the --host flag
-        :param target: This option is only used to build a cross-compiling toolchain.  "False" skips the --target flag
-                       When the tool chain generates executable program, in which target system the program will run.
+        :param target: This option is only used to build a cross-compiling toolchain.
+                       "False" skips the --target flag
+                       When the tool chain generates executable program, in which target system
+                       the program will run.
         :return: None
 
         http://jingfenghanmax.blogspot.com.es/2010/09/configure-with-host-target-and-build.html
@@ -136,9 +117,8 @@ class AutoToolsBuildEnvironment(object):
             configure_dir = "."
         auto_build, auto_host, auto_target = None, None, None
         if build is None or host is None or target is None:
-            auto_build, auto_host, auto_target = self._get_host_build_target_flags(detected_architecture(),
-                                                                                   platform.system())
-
+            flags = self._get_host_build_target_flags(detected_architecture(), platform.system())
+            auto_build, auto_host, auto_target = flags
         triplet_args = []
 
         if build is not False:  # Skipped by user
@@ -179,40 +159,52 @@ class AutoToolsBuildEnvironment(object):
         with environment_append(self.vars):
             str_args = args_to_string(args)
             cpu_count_option = ("-j%s" % cpu_count()) if "-j" not in str_args else None
-            self._conanfile.run("%s" % join_arguments([make_program, target, str_args, cpu_count_option]),
+            self._conanfile.run("%s" % join_arguments([make_program, target, str_args,
+                                                       cpu_count_option]),
                                 win_bash=self._win_bash, subsystem=self.subsystem)
 
-    @property
-    def _sysroot_flag(self):
-        if self._compiler == 'Visual Studio':
-            return None
-        else:
-            return "--sysroot=%s" % self._adjust_path(self._deps_cpp_info.sysroot) if self._deps_cpp_info.sysroot else None
-
     def _configure_link_flags(self):
         """Not the -L"""
         ret = copy.copy(self._deps_cpp_info.sharedlinkflags)
         ret.extend(self._deps_cpp_info.exelinkflags)
-        ret.append(self._architecture_flag)
-        if self._sysroot_flag:
-            ret.append(self._sysroot_flag)
+        arch_flag = architecture_flag(compiler=self._compiler, arch=self._arch)
+        if arch_flag:
+            ret.append(arch_flag)
+
+        sysf = sysroot_flag(self._deps_cpp_info.sysroot, win_bash=self._win_bash,
+                            subsystem=self.subsystem,
+                            compiler=self._compiler)
+        if sysf:
+            ret.append(sysf)
+
+        if self._include_rpath_flags:
+            the_os = self._conanfile.settings.get_safe("os_build") or \
+                 self._conanfile.settings.get_safe("os")
+            ret.extend(rpath_flags(the_os, self._compiler, self._deps_cpp_info.lib_paths))
+
         return ret
 
     def _configure_flags(self):
         ret = copy.copy(self._deps_cpp_info.cflags)
-        ret.append(self._architecture_flag)
-        if self._build_type == "Debug" and str(self._compiler) in ['gcc', 'clang', 'apple-clang', 'sun-cc']:
-            ret.append("-g")  # default debug information
-        elif self._build_type == "Release" and self._compiler == "gcc":
-            # Remove all symbol table and relocation information from the executable.
-            ret.append("-s")
-        if self._sysroot_flag:
-            ret.append(self._sysroot_flag)
+        arch_flag = architecture_flag(compiler=self._compiler, arch=self._arch)
+        if arch_flag:
+            ret.append(arch_flag)
+        btf = build_type_flag(compiler=self._compiler, build_type=self._build_type)
+        if btf:
+            ret.append(btf)
+        srf = sysroot_flag(self._deps_cpp_info.sysroot, win_bash=self._win_bash,
+                           subsystem=self.subsystem,
+                           compiler=self._compiler)
+        if srf:
+            ret.append(srf)
+
         return ret
 
     def _configure_cxx_flags(self):
         ret = copy.copy(self._deps_cpp_info.cppflags)
-        ret.extend(stdlib_flags(self._compiler, self._libcxx))
+        cxxf = libcxx_flag(compiler=self._compiler, libcxx=self._libcxx)
+        if cxxf:
+            ret.append(cxxf)
         return ret
 
     def _configure_defines(self):
@@ -220,19 +212,16 @@ class AutoToolsBuildEnvironment(object):
         ret = copy.copy(self._deps_cpp_info.defines)
 
         # Debug definition for GCC
-        if self._build_type == "Release" and self._compiler == "gcc":
-            ret.append("NDEBUG")
+        btf = build_type_define(build_type=self._build_type)
+        if btf:
+            ret.append(btf)
 
         # CXX11 ABI
-        ret.extend(stdlib_defines(self._compiler, self._libcxx))
+        abif = libcxx_define(compiler=self._compiler, libcxx=self._libcxx)
+        if abif:
+            ret.append(abif)
         return ret
 
-    @property
-    def _architecture_flag(self):
-        if str(self._compiler) in ['gcc', 'clang', 'apple-clang', 'sun-cc']:
-            return architecture_dict.get(self._arch, "")
-        return ""
-
     def _get_vars(self):
         def append(*args):
             ret = []
@@ -244,22 +233,18 @@ class AutoToolsBuildEnvironment(object):
                         ret.append(arg)
             return ret
 
-        if self._compiler == 'Visual Studio':
-            lib_paths = ['/LIBPATH:%s' % x.replace("/", "\\") for x in self.library_paths]
-            include_paths = ['-I%s' % x.replace("/", "\\") for x in self.include_paths]
-            libs = [lib for lib in self.libs]
-        else:
-            lib_paths = ['-L%s' % self._adjust_path(x.replace("\\", "/")) for x in self.library_paths]
-            include_paths = ['-I%s' % self._adjust_path(x.replace("\\", "/")) for x in self.include_paths]
-            libs = ['-l%s' % lib for lib in self.libs]
+        lib_paths = format_library_paths(self.library_paths, win_bash=self._win_bash,
+                                         subsystem=self.subsystem, compiler=self._compiler)
+        include_paths = format_include_paths(self.include_paths, win_bash=self._win_bash,
+                                             subsystem=self.subsystem, compiler=self._compiler)
 
         ld_flags = append(self.link_flags, lib_paths)
-
-        cpp_flags = append(include_paths, ["-D%s" % x for x in self.defines])
+        cpp_flags = append(include_paths, format_defines(self.defines, self._compiler))
+        libs = format_libraries(self.libs, compiler=self._compiler)
 
         tmp_compilation_flags = copy.copy(self.flags)
-        if self.fpic and not self._compiler == 'Visual Studio':
-            tmp_compilation_flags.append("-fPIC")
+        if self.fpic:
+            tmp_compilation_flags.append(pic_flag(self._compiler))
 
         cxx_flags = append(tmp_compilation_flags, self.cxx_flags)
         c_flags = tmp_compilation_flags
diff --git a/conans/client/build/cmake.py b/conans/client/build/cmake.py
index 264fb76fb..d57a117cb 100644
--- a/conans/client/build/cmake.py
+++ b/conans/client/build/cmake.py
@@ -15,6 +15,7 @@ from conans.tools import cpu_count, args_to_string
 from conans import tools
 from conans.util.log import logger
 from conans.util.config_parser import get_bool_from_text
+from conans.client.build.compiler_flags import architecture_flag
 
 
 def _get_env_cmake_system_name():
@@ -25,7 +26,7 @@ def _get_env_cmake_system_name():
 class CMake(object):
 
     def __init__(self, conanfile, generator=None, cmake_system_name=True,
-                 parallel=True, build_type=None, toolset=None, make_program=None):
+                 parallel=True, build_type=None, toolset=None, make_program=None, set_cmake_flags=False):
         """
         :param settings_or_conanfile: Conanfile instance (or settings for retro compatibility)
         :param generator: Generator name to use or none to autodetect
@@ -35,6 +36,8 @@ class CMake(object):
         :param build_type: Overrides default build type comming from settings
         :param toolset: Toolset name to use (such as llvm-vs2014) or none for default one,
                 applies only to certain generators (e.g. Visual Studio)
+        :param set_cmake_flags: whether or not to set CMake flags like CMAKE_CXX_FLAGS, CMAKE_C_FLAGS, etc.
+               it's vital to set for certain projects (e.g. using CMAKE_SIZEOF_VOID_P or CMAKE_LIBRARY_ARCHITECTURE)
         """
         if not isinstance(conanfile, ConanFile):
             raise ConanException("First argument of CMake() has to be ConanFile. Use CMake(self)")
@@ -60,6 +63,7 @@ class CMake(object):
         if self._cmake_system_name is None:  # Not overwritten using environment
             self._cmake_system_name = cmake_system_name
         self.parallel = parallel
+        self._set_cmake_flags = set_cmake_flags
         self.definitions = self._get_cmake_definitions()
         if build_type and build_type != self._build_type:
             # Call the setter to warn and update the definitions if needed
@@ -255,6 +259,17 @@ class CMake(object):
         return ""
 
     def _get_cmake_definitions(self):
+        def add_cmake_flag(cmake_flags, name, flag):
+            """
+            appends compiler linker flags (if already present), or just sets
+            """
+            if flag:
+                if name not in cmake_flags:
+                    cmake_flags[name] = flag
+                else:
+                    cmake_flags[name] = ' ' + flag
+            return cmake_flags
+
         ret = OrderedDict()
         ret.update(self._build_type_definition())
         ret.update(self._runtime_definition())
@@ -268,16 +283,14 @@ class CMake(object):
             ret["CONAN_COMPILER_VERSION"] = str(self._compiler_version)
 
         # Force compiler flags -- TODO: give as environment/setting parameter?
-        if self._compiler in ("gcc", "clang", "apple-clang", "sun-cc"):
-            if self._arch == "x86" or self._arch == "sparc":
-                ret["CONAN_CXX_FLAGS"] = "-m32"
-                ret["CONAN_SHARED_LINKER_FLAGS"] = "-m32"
-                ret["CONAN_C_FLAGS"] = "-m32"
-
-            if self._arch == "x86_64" or self._arch == "sparcv9":
-                ret["CONAN_CXX_FLAGS"] = "-m64"
-                ret["CONAN_SHARED_LINKER_FLAGS"] = "-m64"
-                ret["CONAN_C_FLAGS"] = "-m64"
+        arch_flag = architecture_flag(compiler=self._compiler, arch=self._arch)
+        ret = add_cmake_flag(ret, 'CONAN_CXX_FLAGS', arch_flag)
+        ret = add_cmake_flag(ret, 'CONAN_SHARED_LINKER_FLAGS', arch_flag)
+        ret = add_cmake_flag(ret, 'CONAN_C_FLAGS', arch_flag)
+        if self._set_cmake_flags:
+            ret = add_cmake_flag(ret, 'CMAKE_CXX_FLAGS', arch_flag)
+            ret = add_cmake_flag(ret, 'CMAKE_SHARED_LINKER_FLAGS', arch_flag)
+            ret = add_cmake_flag(ret, 'CMAKE_C_FLAGS', arch_flag)
 
         if self._libcxx:
             ret["CONAN_LIBCXX"] = self._libcxx
@@ -328,7 +341,6 @@ class CMake(object):
     def configure(self, args=None, defs=None, source_dir=None, build_dir=None,
                   source_folder=None, build_folder=None, cache_build_folder=None):
 
-
         # TODO: Deprecate source_dir and build_dir in favor of xxx_folder
         args = args or []
         defs = defs or {}
diff --git a/conans/client/build/compiler_flags.py b/conans/client/build/compiler_flags.py
new file mode 100644
index 000000000..05b3c929e
--- /dev/null
+++ b/conans/client/build/compiler_flags.py
@@ -0,0 +1,155 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+from conans.tools import unix_path
+
+
+def rpath_flags(os_build, compiler, lib_paths):
+    if not os_build:
+        return []
+    if compiler in ("clang", "apple-clang", "gcc"):
+        rpath_separator = "," if os_build in ["Macos", "iOS", "watchOS", "tvOS"] else "="
+        return ['-Wl,-rpath%s"%s"' % (rpath_separator, x.replace("\\", "/"))
+                for x in lib_paths if x]
+    return []
+
+
+def architecture_flag(compiler, arch):
+    """
+    returns flags specific to the target architecture and compiler
+    """
+    if not compiler or not arch:
+        return ""
+
+    if str(compiler) in ['gcc', 'apple-clang', 'clang', 'sun-cc']:
+        if str(arch) in ['x86_64', 'sparcv9']:
+            return '-m64'
+        elif str(arch) in ['x86', 'sparc']:
+            return '-m32'
+    return ""
+
+
+def libcxx_define(compiler, libcxx):
+
+    if not compiler or not libcxx:
+        return ""
+
+    if str(compiler) in ['gcc', 'clang', 'apple-clang']:
+        if str(libcxx) == 'libstdc++':
+            return '_GLIBCXX_USE_CXX11_ABI=0'
+        elif str(libcxx) == 'libstdc++11':
+            return '_GLIBCXX_USE_CXX11_ABI=1'
+    return ""
+
+
+def libcxx_flag(compiler, libcxx):
+    """
+    returns flag specific to the target C++ standard library
+    """
+    if not compiler or not libcxx:
+        return ""
+    if str(compiler) in ['clang', 'apple-clang']:
+        if str(libcxx) in ['libstdc++', 'libstdc++11']:
+            return '-stdlib=libstdc++'
+        elif str(libcxx) == 'libc++':
+            return '-stdlib=libc++'
+    elif str(compiler) == 'sun-cc':
+        return ({"libCstd": "-library=Cstd",
+                         "libstdcxx": "-library=stdcxx4",
+                         "libstlport": "-library=stlport4",
+                         "libstdc++": "-library=stdcpp"}.get(libcxx, ""))
+    return ""
+
+
+def pic_flag(compiler=None):
+    """
+    returns PIC (position independent code) flags, such as -fPIC
+    """
+    if not compiler or compiler == 'Visual Studio':
+        return ""
+    return '-fPIC'
+
+
+def build_type_flag(compiler, build_type):
+    """
+    returns flags specific to the build type (Debug, Release, etc.)
+    (-s, -g, /Zi, etc.)
+    """
+    if not compiler or not build_type:
+        return ""
+
+    if str(compiler) == 'Visual Studio':
+        if build_type == 'Debug':
+            return '/Zi'
+    else:
+        if build_type == 'Debug':
+            return '-g'
+        elif build_type == 'Release' and str(compiler) == 'gcc':
+            return '-s'
+    return ""
+
+
+def build_type_define(build_type=None):
+    """
+    returns definitions specific to the build type (Debug, Release, etc.)
+    like DEBUG, _DEBUG, NDEBUG
+    """
+    return 'NDEBUG' if build_type == 'Release' else ""
+
+
+def adjust_path(path, win_bash=False, subsystem=None, compiler=None):
+    """
+    adjusts path to be safely passed to the compiler command line
+    for Windows bash, ensures path is in format according to the subsystem
+    for path with spaces, places double quotes around it
+    converts slashes to backslashes, or vice versa
+    """
+    if str(compiler) == 'Visual Studio':
+        path = path.replace('/', '\\')
+    else:
+        path = path.replace('\\', '/')
+    if win_bash:
+        path = unix_path(path, subsystem)
+    return '"%s"' % path if ' ' in path else path
+
+
+def sysroot_flag(sysroot, win_bash=False, subsystem=None, compiler=None):
+    if str(compiler) != 'Visual Studio' and sysroot:
+        sysroot = adjust_path(sysroot, win_bash=win_bash, subsystem=subsystem, compiler=compiler)
+        return '--sysroot=%s' % sysroot
+    return ""
+
+
+def visual_runtime(runtime):
+    if runtime:
+       return "/%s" % runtime
+    return ""
+
+def _option_char(compiler):
+    """-L vs /L"""
+    return "-" if compiler != "Visual Studio" else "/"
+
+
+def format_defines(defines, compiler):
+    return ["%sD%s" % (_option_char(compiler), define) for define in defines if define]
+
+
+def format_include_paths(include_paths, win_bash=False, subsystem=None, compiler=None):
+    return ["%sI%s" % (_option_char(compiler),
+                       adjust_path(include_path, win_bash=win_bash,
+                                   subsystem=subsystem, compiler=compiler))
+            for include_path in include_paths if include_path]
+
+
+def format_library_paths(library_paths, win_bash=False, subsystem=None, compiler=None):
+
+    pattern = "/LIBPATH:%s" if str(compiler) == 'Visual Studio' else "-L%s"
+    return [pattern % adjust_path(library_path, win_bash=win_bash,
+                                  subsystem=subsystem, compiler=compiler)
+            for library_path in library_paths if library_path]
+
+
+def format_libraries(libraries, compiler=None):
+    pattern = "%s.lib" if str(compiler) == 'Visual Studio' else "-l%s"
+    return [pattern % library for library in libraries if library]
diff --git a/conans/client/build/visual_environment.py b/conans/client/build/visual_environment.py
index 60f86a2af..c3004e9d7 100644
--- a/conans/client/build/visual_environment.py
+++ b/conans/client/build/visual_environment.py
@@ -1,6 +1,8 @@
 import copy
 import os
 
+from conans.client.build.compiler_flags import build_type_define, build_type_flag, visual_runtime, format_defines
+
 
 class VisualStudioBuildEnvironment(object):
     """
@@ -21,6 +23,8 @@ class VisualStudioBuildEnvironment(object):
         self._settings = conanfile.settings
         self._options = conanfile.options
         self._deps_cpp_info = conanfile.deps_cpp_info
+        self._build_type = self._settings.get_safe("build_type")
+        self._runtime = self._settings.get_safe("runtime")
 
         self.include_paths = conanfile.deps_cpp_info.include_paths
         self.lib_paths = conanfile.deps_cpp_info.lib_paths
@@ -37,20 +41,27 @@ class VisualStudioBuildEnvironment(object):
 
     def _configure_flags(self):
         ret = copy.copy(self._deps_cpp_info.cflags)
-        if self._settings.get_safe("build_type") == "Debug":
-            ret.append("/Zi")  # default debug information
+        btd = build_type_define(build_type=self._build_type)
+        if btd:
+            ret.extend(format_defines([btd], compiler="Visual Studio"))
+        btf = build_type_flag("Visual Studio", build_type=self._build_type)
+        if btf:
+            ret.append(btf)
         return ret
 
     def _get_cl_list(self, quotes=True):
+        # FIXME: It should be managed with the compiler_flags module
+        # But need further investigation about the quotes and so on, so better to not break anything
         if quotes:
             ret = ['/I"%s"' % lib for lib in self.include_paths]
         else:
             ret = ['/I%s' % lib for lib in self.include_paths]
 
-        if self.runtime:
-            ret.append("/%s" % self.runtime)
+        runtime = visual_runtime(self._runtime)
+        if runtime:
+            ret.append(runtime)
 
-        ret.extend(['/D%s' % lib for lib in self.defines])
+        ret.extend(format_defines(self.defines, "Visual Studio"))
         ret.extend(self.flags)
         ret.extend(self.cxx_flags)
         ret.extend(self.link_flags)
diff --git a/conans/client/generators/__init__.py b/conans/client/generators/__init__.py
index 679f4ae5c..626dd42b2 100644
--- a/conans/client/generators/__init__.py
+++ b/conans/client/generators/__init__.py
@@ -1,5 +1,6 @@
 from os.path import join
 
+from conans.client.generators.compiler_args import CompilerArgsGenerator
 from conans.client.generators.pkg_config import PkgConfigGenerator
 from conans.errors import ConanException
 from conans.util.files import save, normalize
@@ -47,6 +48,7 @@ registered_generators = _GeneratorManager()
 
 registered_generators.add("txt", TXTGenerator)
 registered_generators.add("gcc", GCCGenerator)
+registered_generators.add("compiler_args", CompilerArgsGenerator)
 registered_generators.add("cmake", CMakeGenerator)
 registered_generators.add("cmake_multi", CMakeMultiGenerator)
 registered_generators.add("qmake", QmakeGenerator)
diff --git a/conans/client/generators/cmake_multi.py b/conans/client/generators/cmake_multi.py
index 290e217ff..3853f91dd 100644
--- a/conans/client/generators/cmake_multi.py
+++ b/conans/client/generators/cmake_multi.py
@@ -1,7 +1,9 @@
-from conans.model import Generator
-from conans.client.generators.cmake_common import cmake_dependency_vars, cmake_package_info,\
-    cmake_macros_multi, generate_targets_section, cmake_dependencies, cmake_global_vars, cmake_user_info_vars
 from conans.client.generators.cmake import DepsCppCmake
+from conans.client.generators.cmake_common import (cmake_dependency_vars, cmake_package_info,
+                                                   cmake_macros_multi, generate_targets_section,
+                                                   cmake_dependencies, cmake_global_vars,
+                                                   cmake_user_info_vars)
+from conans.model import Generator
 from conans.model.build_info import CppInfo
 
 
diff --git a/conans/client/generators/compiler_args.py b/conans/client/generators/compiler_args.py
new file mode 100644
index 000000000..66bd528ca
--- /dev/null
+++ b/conans/client/generators/compiler_args.py
@@ -0,0 +1,79 @@
+from conans.model import Generator
+from conans.paths import BUILD_INFO_COMPILER_ARGS
+from conans.client.build.compiler_flags import (architecture_flag, sysroot_flag,
+                                                format_defines, format_include_paths,
+                                                format_library_paths, format_libraries,
+                                                build_type_flag, build_type_define, libcxx_flag,
+                                                libcxx_define, rpath_flags, visual_runtime)
+
+
+class CompilerArgsGenerator(Generator):
+
+    @property
+    def filename(self):
+        return BUILD_INFO_COMPILER_ARGS
+
+    @property
+    def compiler(self):
+        return self.conanfile.settings.get_safe("compiler")
+
+    @property
+    def content(self):
+        """With compiler_args you can invoke your compiler:
+        $ gcc main.c @conanbuildinfo.args -o main
+        $ clang main.c @conanbuildinfo.args -o main
+        $ cl /EHsc main.c @conanbuildinfo.args
+        """
+        flags = []
+        flags.extend(format_defines(self._deps_build_info.defines, compiler=self.compiler))
+        flags.extend(format_include_paths(self._deps_build_info.include_paths, compiler=self.compiler))
+
+        flags.extend(self._deps_build_info.cppflags)
+        flags.extend(self._deps_build_info.cflags)
+
+        arch_flag = architecture_flag(arch=self.conanfile.settings.get_safe("arch"), compiler=self.compiler)
+        if arch_flag:
+            flags.append(arch_flag)
+
+        build_type = self.conanfile.settings.get_safe("build_type")
+        btf = build_type_flag(compiler=self.compiler, build_type=build_type)
+        if btf:
+            flags.append(btf)
+        btd = build_type_define(build_type=build_type)
+        if btd:
+            flags.extend(format_defines([btd], self.compiler))
+
+        if self.compiler == "Visual Studio":
+            runtime = visual_runtime(self.conanfile.settings.get_safe("compiler.runtime"))
+            if runtime:
+                flags.append(runtime)
+            # Necessary in the "cl" invocation before specify the rest of linker flags
+            flags.append("/link")
+
+        the_os = self.conanfile.settings.get_safe("os_build") or \
+                 self.conanfile.settings.get_safe("os")
+        flags.extend(rpath_flags(the_os, self.compiler, self._deps_build_info.lib_paths))
+        flags.extend(format_library_paths(self._deps_build_info.lib_paths, compiler=self.compiler))
+        flags.extend(format_libraries(self._deps_build_info.libs, compiler=self.compiler))
+        flags.extend(self._deps_build_info.sharedlinkflags)
+        flags.extend(self._deps_build_info.exelinkflags)
+        flags.extend(self._libcxx_flags())
+        sysrf = sysroot_flag(self._deps_build_info.sysroot, compiler=self.compiler)
+        if sysrf:
+            flags.append(sysrf)
+
+        return " ".join(flag for flag in flags if flag)
+
+    def _libcxx_flags(self):
+        libcxx = self.conanfile.settings.get_safe("compiler.libcxx")
+        compiler = self.conanfile.settings.get_safe("compiler")
+
+        lib_flags = []
+        if libcxx:
+            stdlib_define = libcxx_define(compiler=compiler, libcxx=libcxx)
+            lib_flags.extend(format_defines([stdlib_define], compiler=compiler))
+            cxxf = libcxx_flag(compiler=compiler, libcxx=libcxx)
+            if cxxf:
+                lib_flags.append(cxxf)
+
+        return lib_flags
diff --git a/conans/client/generators/gcc.py b/conans/client/generators/gcc.py
index 3bf43b869..d1eeb4608 100644
--- a/conans/client/generators/gcc.py
+++ b/conans/client/generators/gcc.py
@@ -1,57 +1,13 @@
-from conans.client.build.autotools_environment import architecture_dict, stdlib_flags, \
-    stdlib_defines
-from conans.model import Generator
+from conans.client.generators.compiler_args import CompilerArgsGenerator
 from conans.paths import BUILD_INFO_GCC
-import platform
 
 
-class GCCGenerator(Generator):
+class GCCGenerator(CompilerArgsGenerator):
+    """Backwards compatibility with 'gcc' generator, there the compiler was fixed to gcc always"""
     @property
     def filename(self):
         return BUILD_INFO_GCC
 
     @property
-    def content(self):
-        """With gcc_flags you can invoke gcc like that:
-        $ gcc main.c @conanbuildinfo.gcc -o main
-        """
-        flags = []
-        flags.extend(["-D%s" % x for x in self._deps_build_info.defines])
-        flags.extend(['-I"%s"' % x.replace("\\", "/") for x in self._deps_build_info.include_paths])
-        rpath_separator = "," if platform.system() == "Darwin" else "="
-        flags.extend(['-Wl,-rpath%s"%s"' % (rpath_separator, x.replace("\\", "/")) 
-                      for x in self._deps_build_info.lib_paths]) # rpaths
-        flags.extend(['-L"%s"' % x.replace("\\", "/") for x in self._deps_build_info.lib_paths])
-        flags.extend(["-l%s" % x for x in self._deps_build_info.libs])
-        flags.extend(self._deps_build_info.cppflags)
-        flags.extend(self._deps_build_info.cflags)
-        flags.extend(self._deps_build_info.sharedlinkflags)
-        flags.extend(self._deps_build_info.exelinkflags)
-        flags.extend(self._libcxx_flags())
-        if self._deps_build_info.sysroot:
-            flags.append("--sysroot=%s" % self._deps_build_info.sysroot)
-        arch = self.conanfile.settings.get_safe("arch")
-        flags.append(architecture_dict.get(arch, ""))
-
-        build_type = self.conanfile.settings.get_safe("build_type")
-        if build_type == "Release":
-            compiler = self.conanfile.settings.get_safe("compiler")
-            if compiler == "gcc":
-                flags.append("-s")
-            flags.append("-DNDEBUG")
-        elif build_type == "Debug":
-            flags.append("-g")
-
-        return " ".join(flags)
-
-    def _libcxx_flags(self):
-        libcxx = self.conanfile.settings.get_safe("compiler.libcxx")
-        compiler = self.conanfile.settings.get_safe("compiler")
-
-        lib_flags = []
-        if libcxx:
-            lib_flags.extend(["-D%s" % define for define in stdlib_defines(compiler, libcxx)])
-            lib_flags.extend(stdlib_flags(compiler, libcxx))
-
-        return lib_flags
-
+    def compiler(self):
+        return "gcc"
diff --git a/conans/client/manager.py b/conans/client/manager.py
index ad3316a6c..146a144be 100644
--- a/conans/client/manager.py
+++ b/conans/client/manager.py
@@ -237,8 +237,8 @@ class ConanManager(object):
             conanfile.requires(str(inject_require))
 
     def _get_graph_builder(self, loader, update, remote_proxy):
-        local_search = self._search_manager
-        resolver = RequireResolver(self._user_io.out, local_search, remote_proxy, update=update)
+        local_search = None if update else self._search_manager
+        resolver = RequireResolver(self._user_io.out, local_search, remote_proxy)
         graph_builder = DepsGraphBuilder(remote_proxy, self._user_io.out, loader, resolver)
         return graph_builder
 
diff --git a/conans/client/require_resolver.py b/conans/client/require_resolver.py
index e59029363..8b1f99196 100644
--- a/conans/client/require_resolver.py
+++ b/conans/client/require_resolver.py
@@ -22,11 +22,10 @@ def satisfying(list_versions, versionexpr, output):
 
 class RequireResolver(object):
 
-    def __init__(self, output, local_search, remote_search, update):
+    def __init__(self, output, local_search, remote_search):
         self._output = output
         self._local_search = local_search
         self._remote_search = remote_search
-        self._update = update
 
     def resolve(self, require, base_conanref):
         version_range = require.version_range
@@ -49,24 +48,20 @@ class RequireResolver(object):
         ref = require.conan_reference
         # The search pattern must be a string
         search_ref = str(ConanFileReference(ref.name, "*", ref.user, ref.channel))
-
-        if self._update:
-            searches = (self._resolve_remote, self._resolve_local)
-        else:
-            searches = (self._resolve_local, self._resolve_remote)
-
-        for fcn in searches:
-            resolved = fcn(search_ref, version_range)
-            if resolved:
-                break
+        resolved = self._resolve_local(search_ref, version_range)
+        if not resolved:
+            # We should use ignorecase=False, we want the exact case!
+            remote_found = self._remote_search.search_remotes(search_ref, ignorecase=False)
+            if remote_found:
+                resolved = self._resolve_version(version_range, remote_found)
 
         if resolved:
             self._output.success("Version range '%s' required by '%s' resolved to '%s'"
                                  % (version_range, base_conanref, str(resolved)))
             require.conan_reference = resolved
         else:
-            raise ConanException("The version in '%s' from requirement '%s' could not be resolved"
-                                 % (version_range, require))
+            raise ConanException(
+                "The version in '%s' from requirement '%s' could not be resolved" % (version_range, require))
 
     def _resolve_local(self, search_ref, version_range):
         if self._local_search:
@@ -76,12 +71,6 @@ class RequireResolver(object):
                 if resolved_version:
                     return resolved_version
 
-    def _resolve_remote(self, search_ref, version_range):
-        # We should use ignorecase=False, we want the exact case!
-        remote_found = self._remote_search.search_remotes(search_ref, ignorecase=False)
-        if remote_found:
-            return self._resolve_version(version_range, remote_found)
-
     def _resolve_version(self, version_range, local_found):
         versions = {ref.version: ref for ref in local_found}
         result = satisfying(versions, version_range, self._output)
diff --git a/conans/client/tools/__init__.py b/conans/client/tools/__init__.py
index c1f321c38..d5577b118 100644
--- a/conans/client/tools/__init__.py
+++ b/conans/client/tools/__init__.py
@@ -12,4 +12,4 @@ from .system_pm import *
 # noinspection PyUnresolvedReferences
 from .win import *
 # noinspection PyUnresolvedReferences
-from .pkg_config import *
\ No newline at end of file
+from .pkg_config import *
diff --git a/conans/client/tools/win.py b/conans/client/tools/win.py
index b29e77e85..99ea22167 100644
--- a/conans/client/tools/win.py
+++ b/conans/client/tools/win.py
@@ -110,7 +110,7 @@ def vswhere(all_=False, prerelease=False, products=None, requires=None, version=
 
     arguments = list()
     arguments.append(vswhere_path)
-
+    
     # Output json format
     arguments.append("-format")
     arguments.append("json")
@@ -148,7 +148,7 @@ def vswhere(all_=False, prerelease=False, products=None, requires=None, version=
 
     try:
         output = subprocess.check_output(arguments)
-        vswhere_out = decode_text(output).strip()
+        vswhere_out = output.decode().strip()
     except (ValueError, subprocess.CalledProcessError, UnicodeDecodeError) as e:
         raise ConanException("vswhere error: %s" % str(e))
 
@@ -229,7 +229,7 @@ def vcvars_command(settings, arch=None, compiler_version=None, force=False):
                                          "and vswhere didn't find it" % env_var)
             if not os.path.isdir(vs_path):
                 _global_output.warn('VS variable %s points to the non-existing path "%s",'
-                                    'please check that you have set it correctly' % (env_var, vs_path))
+                    'please check that you have set it correctly' % (env_var, vs_path))
             vcvars_path = os.path.join(vs_path, "../../VC/Auxiliary/Build/vcvarsall.bat")
             command = ('set "VSCMD_START_DIR=%%CD%%" && '
                        'call "%s" %s' % (vcvars_path, vcvars_arch))
@@ -240,7 +240,7 @@ def vcvars_command(settings, arch=None, compiler_version=None, force=False):
                 raise ConanException("VS '%s' variable not defined. Please install VS" % env_var)
             if not os.path.isdir(vs_path):
                 _global_output.warn('VS variable %s points to the non-existing path "%s",'
-                                    'please check that you have set it correctly' % (env_var, vs_path))
+                    'please check that you have set it correctly' % (env_var, vs_path))
             vcvars_path = os.path.join(vs_path, "../../VC/vcvarsall.bat")
             command = ('call "%s" %s' % (vcvars_path, vcvars_arch))
 
@@ -321,7 +321,6 @@ def get_cased_path(name):
         return None
     return res[0]
 
-
 MSYS2 = 'msys2'
 MSYS = 'msys'
 CYGWIN = 'cygwin'
@@ -334,6 +333,7 @@ def unix_path(path, path_flavor=None):
     c/users/path/to/file. Not working in a regular console or MinGW!"""
     if not path:
         return None
+    from conans.client.tools.oss import os_info
 
     if os.path.exists(path):
         path = get_cased_path(path)  # if the path doesn't exist (and abs) we cannot guess the casing
diff --git a/conans/paths.py b/conans/paths.py
index 973410b70..1e8719966 100644
--- a/conans/paths.py
+++ b/conans/paths.py
@@ -28,6 +28,7 @@ CONANFILE_TXT = "conanfile.txt"
 CONAN_MANIFEST = "conanmanifest.txt"
 BUILD_INFO = 'conanbuildinfo.txt'
 BUILD_INFO_GCC = 'conanbuildinfo.gcc'
+BUILD_INFO_COMPILER_ARGS = 'conanbuildinfo.args'
 BUILD_INFO_CMAKE = 'conanbuildinfo.cmake'
 BUILD_INFO_QMAKE = 'conanbuildinfo.pri'
 BUILD_INFO_QBS = 'conanbuildinfo.qbs'
diff --git a/conans/tools.py b/conans/tools.py
index 3289293a8..45d360092 100644
--- a/conans/tools.py
+++ b/conans/tools.py
@@ -5,8 +5,6 @@ import requests
 from conans.client.tools import *
 from conans.client.output import ConanOutput
 # noinspection PyUnresolvedReferences
-from conans.util.env_reader import get_env
-# noinspection PyUnresolvedReferences
 from conans.util.files import (_generic_algorithm_sum, load, save, sha256sum,
                                sha1sum, md5sum, md5, touch, relative_dirs, rmdir, mkdir)
 
diff --git a/conans/util/env_reader.py b/conans/util/env_reader.py
index cd6f77bb8..8628843c8 100644
--- a/conans/util/env_reader.py
+++ b/conans/util/env_reader.py
@@ -9,11 +9,8 @@
 import os
 
 
-def get_env(env_key, default=None, environment=None):
+def get_env(env_key, default=None, environment=os.environ):
     """Get the env variable associated with env_key"""
-    if environment is None:
-        environment = os.environ
-
     env_var = environment.get(env_key, default)
     if env_var != default:
         if isinstance(default, str):

"gcc" generator could be generalised to any compiler even "cl"
The `gcc` generator could be a `compiler_args` generator (not breaking), even managing flags for compiling in command line using the `cl` compiler.

```
cl /ehSC main.cpp @conanbuildinfo.args
gcc main.cpp -o main @conanbuildinfo.args
clang main.cpp -o main @conanbuildinfo.args
```

diff --git a/conans/test/build_helpers/autotools_configure_test.py b/conans/test/build_helpers/autotools_configure_test.py
index d4ecf2233..3564b51ae 100644
--- a/conans/test/build_helpers/autotools_configure_test.py
+++ b/conans/test/build_helpers/autotools_configure_test.py
@@ -55,13 +55,12 @@ class AutoToolsConfigureTest(unittest.TestCase):
 
         be = AutoToolsBuildEnvironment(conanfile)
         expected = {'CFLAGS': 'a_c_flag',
-                    'CPPFLAGS': '-Ipath\\includes -Iother\\include\\path -Donedefinition -Dtwodefinition',
-                    'CXXFLAGS': 'a_c_flag  a_cpp_flag',
-                    'LDFLAGS': 'shared_link_flag exe_link_flag  /LIBPATH:one\\lib\\path',
-                    'LIBS': 'onelib twolib'}
+                    'CPPFLAGS': '/Ipath\\includes /Iother\\include\\path /Donedefinition /Dtwodefinition /DNDEBUG',
+                    'CXXFLAGS': 'a_c_flag a_cpp_flag',
+                    'LDFLAGS': 'shared_link_flag exe_link_flag /LIBPATH:one\\lib\\path',
+                    'LIBS': 'onelib.lib twolib.lib'}
 
         self.assertEquals(be.vars, expected)
-
         # GCC 32
         settings = MockSettings({"build_type": "Release",
                                  "arch": "x86",
@@ -107,7 +106,7 @@ class AutoToolsConfigureTest(unittest.TestCase):
         self._set_deps_info(conanfile)
         expected = {'CFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder',
                     'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition'
-                                ' -D_GLIBCXX_USE_CXX11_ABI=0',
+                                ' -DNDEBUG -D_GLIBCXX_USE_CXX11_ABI=0',
                     'CXXFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder a_cpp_flag -stdlib=libstdc++',
                     'LDFLAGS': 'shared_link_flag exe_link_flag -m64 --sysroot=/path/to/folder -Lone/lib/path',
                     'LIBS': '-lonelib -ltwolib'}
@@ -123,7 +122,7 @@ class AutoToolsConfigureTest(unittest.TestCase):
         conanfile.settings = settings
         self._set_deps_info(conanfile)
         expected = {'CFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder',
-                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition',
+                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition -DNDEBUG',
                     'CXXFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder a_cpp_flag -stdlib=libc++',
                     'LDFLAGS': 'shared_link_flag exe_link_flag -m64 --sysroot=/path/to/folder -Lone/lib/path',
                     'LIBS': '-lonelib -ltwolib'}
@@ -156,7 +155,7 @@ class AutoToolsConfigureTest(unittest.TestCase):
         conanfile.settings = settings
         self._set_deps_info(conanfile)
         expected = {'CFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder',
-                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition',
+                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition -DNDEBUG',
                     'CXXFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder a_cpp_flag -library=Cstd',
                     'LDFLAGS': 'shared_link_flag exe_link_flag -m64 --sysroot=/path/to/folder -Lone/lib/path',
                     'LIBS': '-lonelib -ltwolib'}
@@ -171,7 +170,7 @@ class AutoToolsConfigureTest(unittest.TestCase):
         conanfile.settings = settings
         self._set_deps_info(conanfile)
         expected = {'CFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder',
-                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition',
+                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition -DNDEBUG',
                     'CXXFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder a_cpp_flag -library=stdcxx4',
                     'LDFLAGS': 'shared_link_flag exe_link_flag -m64 --sysroot=/path/to/folder -Lone/lib/path',
                     'LIBS': '-lonelib -ltwolib'}
@@ -186,7 +185,7 @@ class AutoToolsConfigureTest(unittest.TestCase):
         conanfile.settings = settings
         self._set_deps_info(conanfile)
         expected = {'CFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder',
-                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition',
+                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition -DNDEBUG',
                     'CXXFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder a_cpp_flag -library=stlport4',
                     'LDFLAGS': 'shared_link_flag exe_link_flag -m64 --sysroot=/path/to/folder -Lone/lib/path',
                     'LIBS': '-lonelib -ltwolib'}
@@ -201,13 +200,32 @@ class AutoToolsConfigureTest(unittest.TestCase):
         conanfile.settings = settings
         self._set_deps_info(conanfile)
         expected = {'CFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder',
-                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition',
+                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition -DNDEBUG',
                     'CXXFLAGS': 'a_c_flag -m64 --sysroot=/path/to/folder a_cpp_flag -library=stdcpp',
                     'LDFLAGS': 'shared_link_flag exe_link_flag -m64 --sysroot=/path/to/folder -Lone/lib/path',
                     'LIBS': '-lonelib -ltwolib'}
         be = AutoToolsBuildEnvironment(conanfile)
         self.assertEquals(be.vars, expected)
 
+    def rpath_optin_test(self):
+        settings = MockSettings({"os_build": "Linux",
+                                 "build_type": "Release",
+                                 "arch": "x86_64",
+                                 "compiler": "gcc",
+                                 "compiler.libcxx": "libstdc++11"})
+        conanfile = MockConanfile(settings)
+        conanfile.settings = settings
+        self._set_deps_info(conanfile)
+        expected = {'CFLAGS': 'a_c_flag -m64 -s --sysroot=/path/to/folder',
+                    'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -Dtwodefinition -DNDEBUG '
+                                '-D_GLIBCXX_USE_CXX11_ABI=1',
+                    'CXXFLAGS': 'a_c_flag -m64 -s --sysroot=/path/to/folder a_cpp_flag',
+                    'LDFLAGS': 'shared_link_flag exe_link_flag -m64 --sysroot=/path/to/folder '
+                               '-Wl,-rpath="one/lib/path" -Lone/lib/path',
+                    'LIBS': '-lonelib -ltwolib'}
+        be = AutoToolsBuildEnvironment(conanfile, include_rpath_flags=True)
+        self.assertEquals(be.vars, expected)
+
     def environment_append_test(self):
         settings = MockSettings({"build_type": "Debug",
                                  "arch": "x86_64",
@@ -225,11 +243,11 @@ class AutoToolsConfigureTest(unittest.TestCase):
         with(tools.environment_append(env_vars)):
             be = AutoToolsBuildEnvironment(conanfile)
             expected = {'CPPFLAGS': '-Ipath/includes -Iother/include/path -Donedefinition -'
-                                    'Dtwodefinition -D_GLIBCXX_USE_CXX11_ABI=0 -additionalcppflag', 
-                        'CXXFLAGS': 'a_c_flag -m64 -g --sysroot=/path/to/folder a_cpp_flag -additionalcxxflag', 
-                        'LIBS': '-lonelib -ltwolib -additionallibs', 
+                                    'Dtwodefinition -D_GLIBCXX_USE_CXX11_ABI=0 -additionalcppflag',
+                        'CXXFLAGS': 'a_c_flag -m64 -g --sysroot=/path/to/folder a_cpp_flag -additionalcxxflag',
+                        'LIBS': '-lonelib -ltwolib -additionallibs',
                         'LDFLAGS': 'shared_link_flag exe_link_flag -m64 '
-                                   '--sysroot=/path/to/folder -Lone/lib/path -additionalldflag', 
+                                   '--sysroot=/path/to/folder -Lone/lib/path -additionalldflag',
                         'CFLAGS': 'a_c_flag -m64 -g --sysroot=/path/to/folder -additionalcflag'}
             self.assertEquals(be.vars, expected)
 
diff --git a/conans/test/build_helpers/cmake_test.py b/conans/test/build_helpers/cmake_test.py
index 4c418f83c..d46dfcd65 100644
--- a/conans/test/build_helpers/cmake_test.py
+++ b/conans/test/build_helpers/cmake_test.py
@@ -180,7 +180,7 @@ class CMakeTest(unittest.TestCase):
         conan_file = ConanFileMock()
         conan_file.settings = settings
 
-        def check(text, build_config, generator=None):
+        def check(text, build_config, generator=None, set_cmake_flags=False):
             os = str(settings.os)
             os_ver = str(settings.os.version) if settings.get_safe('os.version') else None
             for cmake_system_name in (True, False):
@@ -188,7 +188,8 @@ class CMakeTest(unittest.TestCase):
                 cross = ("-DCMAKE_SYSTEM_NAME=\"%s\" %s-DCMAKE_SYSROOT=\"/path/to/sysroot\" "
                          % ({"Macos": "Darwin"}.get(os, os), cross_ver)
                          if (platform.system() != os and cmake_system_name) else "")
-                cmake = CMake(conan_file, generator=generator, cmake_system_name=cmake_system_name)
+                cmake = CMake(conan_file, generator=generator, cmake_system_name=cmake_system_name,
+                              set_cmake_flags=set_cmake_flags)
                 new_text = text.replace("-DCONAN_EXPORTED", "%s-DCONAN_EXPORTED" % cross)
                 if "Visual Studio" in text:
                     cores = ('-DCONAN_CXX_FLAGS="/MP{0}" '
@@ -205,6 +206,10 @@ class CMakeTest(unittest.TestCase):
               '-DCONAN_COMPILER="Visual Studio" -DCONAN_COMPILER_VERSION="12" -Wno-dev',
               '', generator="Custom Generator")
 
+        check('-G "Custom Generator" -DCONAN_EXPORTED="1" '
+              '-DCONAN_COMPILER="Visual Studio" -DCONAN_COMPILER_VERSION="12" -Wno-dev',
+              '', generator="Custom Generator", set_cmake_flags=True)
+
         settings.build_type = "Debug"
         check('-G "Visual Studio 12 2013" -DCONAN_EXPORTED="1" '
               '-DCONAN_COMPILER="Visual Studio" -DCONAN_COMPILER_VERSION="12" -Wno-dev',
@@ -218,10 +223,9 @@ class CMakeTest(unittest.TestCase):
         settings.compiler = "gcc"
         settings.compiler.version = "4.8"
         generator = "MinGW Makefiles" if platform.system() == "Windows" else "Unix Makefiles"
-        check('-G "%s" -DCMAKE_BUILD_TYPE="Debug" -DCONAN_EXPORTED="1" -DCONAN_COMPILER="gcc" '
-              '-DCONAN_COMPILER_VERSION="4.8" -DCONAN_CXX_FLAGS="-m64" '
-              '-DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" '
-              '-Wno-dev' % generator, "")
+        check('-G "%s" -DCMAKE_BUILD_TYPE="Debug" -DCONAN_EXPORTED="1" '
+              '-DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="4.8" -DCONAN_CXX_FLAGS="-m64" '
+              '-DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -Wno-dev' % generator, "")
 
         settings.os = "Linux"
         settings.arch = "x86"
@@ -238,6 +242,14 @@ class CMakeTest(unittest.TestCase):
               '-DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -Wno-dev' % generator,
               "")
 
+        check('-G "%s" -DCMAKE_BUILD_TYPE="Debug"'
+              ' -DCONAN_EXPORTED="1" -DCONAN_COMPILER="gcc" '
+              '-DCONAN_COMPILER_VERSION="4.8" -DCONAN_CXX_FLAGS="-m64" '
+              '-DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" '
+              '-DCMAKE_CXX_FLAGS="-m64" -DCMAKE_SHARED_LINKER_FLAGS="-m64" -DCMAKE_C_FLAGS="-m64" '
+              '-Wno-dev' % generator,
+              "", set_cmake_flags=True)
+
         settings.os = "FreeBSD"
         settings.compiler = "clang"
         settings.compiler.version = "3.8"
diff --git a/conans/test/build_helpers/compiler_flags_test.py b/conans/test/build_helpers/compiler_flags_test.py
new file mode 100644
index 000000000..629508d9a
--- /dev/null
+++ b/conans/test/build_helpers/compiler_flags_test.py
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import unittest
+import platform
+from nose.plugins.attrib import attr
+
+from conans.client.build.compiler_flags import architecture_flag, libcxx_flag, libcxx_define, \
+    pic_flag, build_type_flag, build_type_define, adjust_path, sysroot_flag, format_defines, \
+    format_include_paths, format_library_paths, format_libraries
+
+
+class CompilerFlagsTest(unittest.TestCase):
+
+    def test_arch_flag(self):
+        for compiler in ("gcc", "clang", "sun-cc"):
+            arch_flag = architecture_flag(arch='x86', compiler=compiler)
+            self.assertEquals(arch_flag, '-m32')
+
+        arch_flag = architecture_flag(arch='sparc', compiler='sun-cc')
+        self.assertEquals(arch_flag, '-m32')
+
+        for compiler in ("gcc", "clang", "sun-cc"):
+            arch_flag = architecture_flag(arch='x86_64', compiler=compiler)
+            self.assertEquals(arch_flag, '-m64')
+
+        arch_flag = architecture_flag(arch='sparcv9', compiler='sun-cc')
+        self.assertEquals(arch_flag, '-m64')
+
+        for compiler in ("gcc", "clang", "sun-cc"):
+            arch_flag = architecture_flag(arch='armv7', compiler=compiler)
+            self.assertEquals(arch_flag, '')
+
+        arch_flag = architecture_flag(arch='x86', compiler='Visual Studio')
+        self.assertEquals(arch_flag, '')
+
+        arch_flag = architecture_flag(arch='x86_64', compiler='Visual Studio')
+        self.assertEquals(arch_flag, '')
+
+    def test_libcxx_flags(self):
+        arch_define = libcxx_define(compiler='gcc', libcxx='libstdc++')
+        self.assertEquals(arch_define, '_GLIBCXX_USE_CXX11_ABI=0')
+
+        arch_define = libcxx_define(compiler='gcc', libcxx='libstdc++11')
+        self.assertEquals(arch_define, '_GLIBCXX_USE_CXX11_ABI=1')
+
+        arch_flags = libcxx_flag(compiler='clang', libcxx='libc++')
+        self.assertEquals(arch_flags, '-stdlib=libc++')
+
+        arch_flags = libcxx_flag(compiler='clang', libcxx='libstdc++')
+        self.assertEquals(arch_flags, '-stdlib=libstdc++')
+
+        arch_define = libcxx_define(compiler='clang', libcxx='libstdc++')
+        self.assertEquals(arch_define, '_GLIBCXX_USE_CXX11_ABI=0')
+
+        arch_flags = libcxx_flag(compiler='clang', libcxx='libstdc++')
+        self.assertEquals(arch_flags, '-stdlib=libstdc++')
+        arch_define = libcxx_define(compiler='clang', libcxx='libstdc++')
+        self.assertEquals(arch_define, '_GLIBCXX_USE_CXX11_ABI=0')
+
+        arch_flags = libcxx_flag(compiler='apple-clang', libcxx='libc++')
+        self.assertEquals(arch_flags, '-stdlib=libc++')
+
+        arch_flags = libcxx_flag(compiler='Visual Studio', libcxx=None)
+        self.assertEquals(arch_flags, "")
+
+        arch_flags = libcxx_flag(compiler='sun-cc', libcxx='libCstd')
+        self.assertEquals(arch_flags, '-library=Cstd')
+
+        arch_flags = libcxx_flag(compiler='sun-cc', libcxx='libstdcxx')
+        self.assertEquals(arch_flags, '-library=stdcxx4')
+
+        arch_flags = libcxx_flag(compiler='sun-cc', libcxx='libstlport')
+        self.assertEquals(arch_flags, '-library=stlport4')
+
+        arch_flags = libcxx_flag(compiler='sun-cc', libcxx='libstdc++')
+        self.assertEquals(arch_flags, '-library=stdcpp')
+
+    def test_pic_flags(self):
+        flag = pic_flag()
+        self.assertEquals(flag, '')
+
+        flags = pic_flag(compiler='gcc')
+        self.assertEquals(flags, '-fPIC')
+
+        flags = pic_flag(compiler='Visual Studio')
+        self.assertEquals(flags, "")
+
+    def test_build_type_flags(self):
+        flags = build_type_flag(compiler='Visual Studio', build_type='Debug')
+        self.assertEquals(flags, '/Zi')
+
+        flags = build_type_flag(compiler='Visual Studio', build_type='Release')
+        self.assertEquals(flags, "")
+
+        flags = build_type_flag(compiler='gcc', build_type='Debug')
+        self.assertEquals(flags, '-g')
+
+        flags = build_type_flag(compiler='gcc', build_type='Release')
+        self.assertEquals(flags, '-s')
+        define = build_type_define(build_type='Release')
+        self.assertEquals(define, 'NDEBUG')
+
+        flags = build_type_flag(compiler='clang', build_type='Debug')
+        self.assertEquals(flags, '-g')
+
+        flags = build_type_flag(compiler='clang', build_type='Release')
+        self.assertEquals(flags, '')
+
+    def test_adjust_path(self):
+        self.assertEquals('home/www', adjust_path('home\\www'))
+        self.assertEquals('home/www', adjust_path('home\\www', compiler='gcc'))
+
+        self.assertEquals('"home/www root"', adjust_path('home\\www root'))
+        self.assertEquals('"home/www root"', adjust_path('home\\www root', compiler='gcc'))
+
+    @attr('visual_studio')
+    def test_adjust_path_visual_studio(self):
+        #  NOTE : test cannot be run on *nix systems, as adjust_path uses
+        # tools.unix_path which is Windows-only
+        if platform.system() != "Windows":
+            return
+        self.assertEquals('home\\www', adjust_path('home/www', compiler='Visual Studio'))
+        self.assertEquals('"home\\www root"',
+                          adjust_path('home/www root', compiler='Visual Studio'))
+        self.assertEquals('home/www',
+                          adjust_path('home\\www', compiler='Visual Studio', win_bash=True))
+        self.assertEquals('home/www',
+                          adjust_path('home/www', compiler='Visual Studio', win_bash=True))
+        self.assertEquals('"home/www root"',
+                          adjust_path('home\\www root', compiler='Visual Studio', win_bash=True))
+        self.assertEquals('"home/www root"',
+                          adjust_path('home/www root', compiler='Visual Studio', win_bash=True))
+
+    def test_sysroot_flag(self):
+        sysroot = sysroot_flag(sysroot=None)
+        self.assertEquals(sysroot, "")
+
+        sysroot = sysroot_flag(sysroot='sys/root', compiler='Visual Studio')
+        self.assertEquals(sysroot, "")
+
+        sysroot = sysroot_flag(sysroot='sys/root')
+        self.assertEquals(sysroot, "--sysroot=sys/root")
+
+    def test_format_defines(self):
+        self.assertEquals(['-DFOO', '-DBAR=1'], format_defines(['FOO', 'BAR=1'], "gcc"))
+
+    def test_format_include_paths(self):
+        self.assertEquals(['-Ipath1', '-I"with spaces"'], format_include_paths(['path1', 'with spaces']))
+
+    def test_format_library_paths(self):
+        self.assertEquals(['-Lpath1', '-L"with spaces"'], format_library_paths(['path1', 'with spaces']))
+        self.assertEquals(['/LIBPATH:path1', '/LIBPATH:"with spaces"'],
+                          format_library_paths(['path1', 'with spaces'], compiler='Visual Studio'))
+
+    def test_format_libraries(self):
+        self.assertEquals(['-llib1', '-llib2'], format_libraries(['lib1', 'lib2']))
+        self.assertEquals(['lib1.lib', 'lib2.lib'], format_libraries(['lib1', 'lib2'],
+                                                                     compiler='Visual Studio'))
diff --git a/conans/test/generators/compiler_args_test.py b/conans/test/generators/compiler_args_test.py
new file mode 100644
index 000000000..3db09256a
--- /dev/null
+++ b/conans/test/generators/compiler_args_test.py
@@ -0,0 +1,114 @@
+import unittest
+
+from conans.client.conf import default_settings_yml
+from conans.client.generators.compiler_args import CompilerArgsGenerator
+from conans.client.generators.gcc import GCCGenerator
+from conans.model.build_info import DepsCppInfo, CppInfo
+from conans.model.env_info import DepsEnvInfo, EnvInfo
+from conans.model.settings import Settings
+from conans.model.user_info import DepsUserInfo
+from conans.test.build_helpers.cmake_test import ConanFileMock
+
+
+class CompilerArgsTest(unittest.TestCase):
+
+    def _get_conanfile(self, settings):
+        conan_file = ConanFileMock()
+        conan_file.settings = settings
+        conan_file.source_folder = "my_cache_source_folder"
+        conan_file.build_folder = "my_cache_build_folder"
+        conan_file.deps_env_info = DepsEnvInfo()
+        conan_file.deps_user_info = DepsUserInfo()
+        conan_file.deps_cpp_info = DepsCppInfo()
+        cpp_info = CppInfo("/root")
+        cpp_info.include_paths.append("path/to/include1")
+        cpp_info.lib_paths.append("path/to/lib1")
+        cpp_info.libs.append("mylib")
+        cpp_info.bindirs = "path/to/bin1"
+        cpp_info.cflags.append("c_flag1")
+        cpp_info.cppflags.append("cxx_flag1")
+        cpp_info.defines.append("mydefine1")
+
+        conan_file.deps_cpp_info.update(cpp_info, "zlib")
+        conan_file.env_info = EnvInfo()
+        return conan_file
+
+
+    def gcc_test(self):
+        settings = Settings.loads(default_settings_yml)
+        settings.os = "Linux"
+        settings.compiler = "gcc"
+        settings.compiler.version = "6.3"
+        settings.arch = "x86"
+        settings.build_type = "Release"
+
+        conan_file = self._get_conanfile(settings)
+        gcc = GCCGenerator(conan_file)
+        self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m32 -s -DNDEBUG '
+                          '-Wl,-rpath="path/to/lib1" '
+                          '-Lpath/to/lib1 -lmylib', gcc.content)
+
+        settings.arch = "x86_64"
+        settings.build_type = "Debug"
+        settings.compiler.libcxx = "libstdc++11"
+
+        gcc = GCCGenerator(conan_file)
+        self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m64 -g '
+                          '-Wl,-rpath="path/to/lib1" -Lpath/to/lib1 -lmylib '
+                          '-D_GLIBCXX_USE_CXX11_ABI=1',
+                          gcc.content)
+
+        settings.compiler.libcxx = "libstdc++"
+        gcc = GCCGenerator(conan_file)
+        self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m64 -g '
+                          '-Wl,-rpath="path/to/lib1" -Lpath/to/lib1 -lmylib '
+                          '-D_GLIBCXX_USE_CXX11_ABI=0',
+                          gcc.content)
+
+        settings.os = "Windows"
+        settings.compiler = "Visual Studio"
+        settings.compiler.version = "15"
+        settings.arch = "x86"
+        settings.build_type = "Release"
+        gcc = GCCGenerator(conan_file)
+        # GCC generator ignores the compiler setting, it is always gcc
+        self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m32 -s '
+                          '-DNDEBUG -Wl,-rpath="path/to/lib1" -Lpath/to/lib1 -lmylib', gcc.content)
+
+    def compiler_args_test(self):
+        settings = Settings.loads(default_settings_yml)
+        settings.os = "Windows"
+        settings.compiler = "Visual Studio"
+        settings.compiler.version = "15"
+        settings.arch = "x86"
+        settings.build_type = "Release"
+
+        conan_file = self._get_conanfile(settings)
+        gen = CompilerArgsGenerator(conan_file)
+        self.assertEquals('/Dmydefine1 /Ipath\\to\\include1 cxx_flag1 c_flag1 /DNDEBUG '
+                          '/link /LIBPATH:path\\to\\lib1 mylib.lib', gen.content)
+
+        settings = Settings.loads(default_settings_yml)
+        settings.os = "Macos"
+        settings.compiler = "apple-clang"
+        settings.compiler.version = "9.0"
+        settings.arch = "x86"
+        settings.build_type = "Release"
+        conan_file = self._get_conanfile(settings)
+        gen = CompilerArgsGenerator(conan_file)
+        self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m32 -DNDEBUG '
+                          '-Wl,-rpath,"path/to/lib1" -Lpath/to/lib1 -lmylib', gen.content)
+
+        settings = Settings.loads(default_settings_yml)
+        settings.os = "Linux"
+        settings.os_build = "Macos"
+        settings.compiler = "apple-clang"
+        settings.compiler.version = "9.0"
+        settings.arch = "x86"
+        settings.build_type = "Release"
+
+        conan_file = self._get_conanfile(settings)
+        args = CompilerArgsGenerator(conan_file)
+        self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m32 -DNDEBUG '
+                          '-Wl,-rpath,"path/to/lib1" '
+                          '-Lpath/to/lib1 -lmylib', args.content)
diff --git a/conans/test/integration/version_range_error_test.py b/conans/test/integration/version_range_error_test.py
index ae48a5dc1..b05d20edb 100644
--- a/conans/test/integration/version_range_error_test.py
+++ b/conans/test/integration/version_range_error_test.py
@@ -12,23 +12,3 @@ class VersionRangesErrorTest(unittest.TestCase):
         error = client.run("install . --build", ignore_error=True)
         self.assertTrue(error)
         self.assertIn("from requirement 'MyOtherPkg/[~0.1]@user/testing'", client.user_io.out)
-
-    def werror_fail_test(self):
-        client = TestClient()
-
-        def add(name, version, requires=None):
-            conanfile = TestConanFile(name, version, requires=requires)
-            client.save({CONANFILE: str(conanfile)})
-            client.run("export . user/testing")
-
-        add("MyPkg1", "0.1.0")
-        add("MyPkg1", "0.2.0")
-        add("MyPkg2", "0.1", ["MyPkg1/[~0.1]@user/testing"])
-        add("MyPkg3", "0.1", ["MyPkg1/[~0.2]@user/testing", "MyPkg2/[~0.1]@user/testing"])
-
-        error = client.run("install . --build", ignore_error=True)
-        self.assertTrue(error)
-        self.assertNotIn("WARN: Version range '~0.1' required", client.out)
-        self.assertIn("ERROR: Version range '~0.1' required by 'MyPkg2/0.1@user/testing' "
-                      "not valid for downstream requirement 'MyPkg1/0.2.0@user/testing'",
-                      client.out)
diff --git a/conans/test/integration/version_ranges_conflict_test.py b/conans/test/integration/version_ranges_conflict_test.py
new file mode 100644
index 000000000..9d68de64a
--- /dev/null
+++ b/conans/test/integration/version_ranges_conflict_test.py
@@ -0,0 +1,27 @@
+import unittest
+from conans.test.utils.tools import TestClient
+from conans.paths import CONANFILE
+from conans.test.utils.conanfile import TestConanFile
+
+
+class VersionRangesConflictTest(unittest.TestCase):
+
+    def setUp(self):
+        self.client = TestClient()
+
+        def add(name, version, requires=None):
+            conanfile = TestConanFile(name, version, requires=requires)
+            self.client.save({CONANFILE: str(conanfile)})
+            self.client.run("export . user/testing")
+        add("MyPkg1", "0.1.0")
+        add("MyPkg1", "0.2.0")
+        add("MyPkg2", "0.1", ["MyPkg1/[~0.1]@user/testing"])
+        add("MyPkg3", "0.1", ["MyPkg1/[~0.2]@user/testing", "MyPkg2/[~0.1]@user/testing"])
+
+    def werror_fail_test(self):
+        error = self.client.run("install . --build", ignore_error=True)
+        self.assertTrue(error)
+        self.assertNotIn("WARN: Version range '~0.1' required", self.client.user_io.out)
+        self.assertIn("ERROR: Version range '~0.1' required by 'MyPkg2/0.1@user/testing' "
+                      "not valid for downstream requirement 'MyPkg1/0.2.0@user/testing'",
+                      self.client.user_io.out)
diff --git a/conans/test/integration/version_ranges_diamond_test.py b/conans/test/integration/version_ranges_diamond_test.py
index 29a86264e..acd72efd9 100644
--- a/conans/test/integration/version_ranges_diamond_test.py
+++ b/conans/test/integration/version_ranges_diamond_test.py
@@ -1,96 +1,9 @@
 import unittest
 from conans.test.utils.tools import TestClient, TestServer
 from conans.paths import CONANFILE
-from conans.util.files import load, save
+from conans.util.files import load
 import os
 from nose_parameterized import parameterized
-from conans.model.ref import ConanFileReference
-
-
-class VersionRangesUpdatingTest(unittest.TestCase):
-
-    def update_test(self):
-        client = TestClient(servers={"default": TestServer()},
-                            users={"default": [("lasote", "mypass")]})
-        conanfile = """from conans import ConanFile
-class HelloReuseConan(ConanFile):
-    pass
-"""
-        client.save({"conanfile.py": conanfile})
-        client.run("create . Pkg/1.1@lasote/testing")
-        client.run("create . Pkg/1.2@lasote/testing")
-        client.run("upload Pkg* -r=default --all --confirm")
-        client.run("remove Pkg/1.2@lasote/testing -f")
-        conanfile = """from conans import ConanFile
-class HelloReuseConan(ConanFile):
-    requires = "Pkg/[~1]@lasote/testing"
-"""
-        client.save({"conanfile.py": conanfile})
-        client.run("install .")
-        # Resolves to local package
-        self.assertIn("Pkg/1.1@lasote/testing: Already installed!", client.out)
-        client.run("install . --update")
-        # Resolves to remote package
-        self.assertIn("Pkg/1.2@lasote/testing: Package installed", client.out)
-        self.assertNotIn("Pkg/1.1", client.out)
-
-        # removes remote
-        client.run("remove Pkg* -r=default --f")
-        # Resolves to local package
-        client.run("install .")
-        self.assertIn("Pkg/1.2@lasote/testing: Already installed!", client.out)
-        # Update also resolves to local package
-        client.run("install . --update")
-        self.assertIn("Pkg/1.2@lasote/testing: Already installed!", client.out)
-        self.assertNotIn("Pkg/1.1", client.out)
-
-    def update_pkg_test(self):
-        server = TestServer()
-        client = TestClient(servers={"default": server},
-                            users={"default": [("lasote", "mypass")]})
-        conanfile = """from conans import ConanFile
-class HelloReuseConan(ConanFile):
-    def package_info(self):
-        self.output.info("PACKAGE_INFO {}")
-"""
-        client.save({"conanfile.py": conanfile.format("1.1")})
-        client.run("create . Pkg/1.1@lasote/testing")
-        client.save({"conanfile.py": conanfile.format("1.2")})
-        client.run("create . Pkg/1.2@lasote/testing")
-        client.run("upload Pkg* -r=default --all --confirm")
-        consumer = """from conans import ConanFile
-class HelloReuseConan(ConanFile):
-    requires = "Pkg/[~1]@lasote/testing"
-"""
-        client.save({"conanfile.py": consumer})
-        client.run("install .")
-        # Resolves to local package
-        self.assertIn("Pkg/1.2@lasote/testing: Already installed!", client.out)
-        self.assertIn("Pkg/1.2@lasote/testing: PACKAGE_INFO 1.2", client.out)
-
-        # modify remote 1.2
-        client2 = TestClient(servers={"default": server},
-                             users={"default": [("lasote", "mypass")]})
-        client2.save({"conanfile.py": conanfile.format("*1.2*")})
-        client2.run("create . Pkg/1.2@lasote/testing")
-        conan_reference = ConanFileReference.loads("Pkg/1.2@lasote/testing")
-        manifest = client2.client_cache.digestfile_conanfile(conan_reference)
-        # Make sure timestamp increases, in some machines in testing, it can fail due to same timestamp
-        content = load(manifest).splitlines()
-        content[0] = str(int(content[0]) + 1)
-        save(manifest, "\n".join(content))
-        client2.run("upload Pkg* -r=default --all --confirm")
-
-        client.run("install .")
-        # Resolves to local package
-        self.assertIn("Pkg/1.2@lasote/testing: Already installed!", client.out)
-        self.assertIn("Pkg/1.2@lasote/testing: PACKAGE_INFO 1.2", client.out)
-
-        client.run("install . --update")
-        # Resolves to local package
-        self.assertIn("Pkg/1.2@lasote/testing: Package installed", client.out)
-        self.assertNotIn("Pkg/1.2@lasote/testing: PACKAGE_INFO 1.2", client.out)
-        self.assertIn("Pkg/1.2@lasote/testing: PACKAGE_INFO *1.2*", client.out)
 
 
 class VersionRangesMultiRemoteTest(unittest.TestCase):
diff --git a/conans/test/model/version_ranges_test.py b/conans/test/model/version_ranges_test.py
index 9d2ce94bc..66ef14142 100644
--- a/conans/test/model/version_ranges_test.py
+++ b/conans/test/model/version_ranges_test.py
@@ -171,7 +171,7 @@ class VersionRangesTest(unittest.TestCase):
         self.loader = ConanFileLoader(None, Settings.loads(""), Profile())
         self.retriever = Retriever(self.loader, self.output)
         self.remote_search = MockSearchRemote()
-        self.resolver = RequireResolver(self.output, self.retriever, self.remote_search, update=False)
+        self.resolver = RequireResolver(self.output, self.retriever, self.remote_search)
         self.builder = DepsGraphBuilder(self.retriever, self.output, self.loader, self.resolver)
 
         for v in ["0.1", "0.2", "0.3", "1.1", "1.1.2", "1.2.1", "2.1", "2.2.1"]:
diff --git a/conans/test/util/tools_test.py b/conans/test/util/tools_test.py
index 7c690dc47..c66818d0f 100644
--- a/conans/test/util/tools_test.py
+++ b/conans/test/util/tools_test.py
@@ -71,85 +71,6 @@ class ToolsTest(unittest.TestCase):
         with tools.environment_append({"CONAN_CPU_COUNT": "34"}):
             self.assertEquals(tools.cpu_count(), 34)
 
-    def get_env_unit_test(self):
-        """
-        Unit tests tools.get_env
-        """
-        # Test default
-        self.assertIsNone(
-            tools.get_env("NOT_DEFINED", environment={}),
-            None
-        )
-        # Test defined default
-        self.assertEqual(
-            tools.get_env("NOT_DEFINED_KEY", default="random_default", environment={}),
-            "random_default"
-        )
-        # Test return defined string
-        self.assertEqual(
-            tools.get_env("FROM_STR", default="", environment={"FROM_STR": "test_string_value"}),
-            "test_string_value"
-        )
-        # Test boolean conversion
-        self.assertEqual(
-            tools.get_env("BOOL_FROM_STR", default=False, environment={"BOOL_FROM_STR": "1"}),
-            True
-        )
-        self.assertEqual(
-            tools.get_env("BOOL_FROM_STR", default=True, environment={"BOOL_FROM_STR": "0"}),
-            False
-        )
-        self.assertEqual(
-            tools.get_env("BOOL_FROM_STR", default=False, environment={"BOOL_FROM_STR": "True"}),
-            True
-        )
-        self.assertEqual(
-            tools.get_env("BOOL_FROM_STR", default=True, environment={"BOOL_FROM_STR": ""}),
-            False
-        )
-        # Test int conversion
-        self.assertEqual(
-            tools.get_env("TO_INT", default=2, environment={"TO_INT": "1"}),
-            1
-        )
-        # Test float conversion
-        self.assertEqual(
-            tools.get_env("TO_FLOAT", default=2.0, environment={"TO_FLOAT": "1"}),
-            1.0
-        ),
-        # Test list conversion
-        self.assertEqual(
-            tools.get_env("TO_LIST", default=[], environment={"TO_LIST": "1,2,3"}),
-            ["1", "2", "3"]
-        )
-        self.assertEqual(
-            tools.get_env("TO_LIST_NOT_TRIMMED", default=[], environment={"TO_LIST_NOT_TRIMMED": " 1 , 2 , 3 "}),
-            [" 1 ", " 2 ", " 3 "]
-        )
-
-    def test_get_env_in_conanfile(self):
-        """
-        Test get_env is available and working in conanfile
-        """
-        client = TestClient()
-
-        conanfile = """from conans import ConanFile, tools
-
-class HelloConan(ConanFile):
-    name = "Hello"
-    version = "0.1"
-
-    def build(self):
-        run_tests = tools.get_env("CONAN_RUN_TESTS", default=False)
-        print("test_get_env_in_conafile CONAN_RUN_TESTS=%r" % run_tests)
-        assert(run_tests == True)
-        """
-        client.save({"conanfile.py": conanfile})
-
-        with tools.environment_append({"CONAN_RUN_TESTS": "1"}):
-            client.run("install .")
-            client.run("build .")
-
     def test_global_tools_overrided(self):
         client = TestClient()
 

pip install -e .[dev]
parse_log_pytest
requirements.txt
nose nose-cov pytest
apt-get update apt-get install -y gcc g++-multilib
3.6
conans/requirements.txt conans/requirements_osx.txt conans/requirements_server.txt conans/requirements_dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
asn1crypto==1.5.1
astroid==1.6.6
attrs==22.2.0
beautifulsoup4==4.12.3
bottle==0.12.25
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
codecov==2.1.13
colorama==0.3.9
-e git+https://github.com/conan-io/conan.git@544682392b632d8e7cc51372d9e51c887af5139e#egg=conan
cov-core==1.15.0
coverage==4.2
cryptography==2.1.4
distro==1.1.0
fasteners==0.19
future==0.16.0
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
isort==5.10.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
mock==1.3.0
ndg-httpsclient==0.4.4
node-semver==0.2.0
nose==1.3.7
nose-cov==1.6
nose-parameterized==0.5.0
packaging==21.3
patch==1.16
pbr==6.1.1
pluggy==1.0.0
pluginbase==0.7
py==1.11.0
pyasn==1.5.0b7
pyasn1==0.5.1
pycparser==2.21
Pygments==2.14.0
PyJWT==1.7.1
pylint==1.8.4
pyOpenSSL==17.5.0
pyparsing==3.1.4
pytest==7.0.1
PyYAML==3.12
requests==2.27.1
six==1.17.0
soupsieve==2.3.2.post1
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
waitress==2.0.0
WebOb==1.8.9
WebTest==2.0.35
wrapt==1.16.0
zipp==3.6.0

name: conan
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - asn1crypto==1.5.1
      - astroid==1.6.6
      - attrs==22.2.0
      - beautifulsoup4==4.12.3
      - bottle==0.12.25
      - cffi==1.15.1
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - colorama==0.3.9
      - cov-core==1.15.0
      - coverage==4.2
      - cryptography==2.1.4
      - distro==1.1.0
      - fasteners==0.19
      - future==0.16.0
      - idna==3.10
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - isort==5.10.1
      - lazy-object-proxy==1.7.1
      - mccabe==0.7.0
      - mock==1.3.0
      - ndg-httpsclient==0.4.4
      - node-semver==0.2.0
      - nose==1.3.7
      - nose-cov==1.6
      - nose-parameterized==0.5.0
      - packaging==21.3
      - patch==1.16
      - pbr==6.1.1
      - pluggy==1.0.0
      - pluginbase==0.7
      - py==1.11.0
      - pyasn==1.5.0b7
      - pyasn1==0.5.1
      - pycparser==2.21
      - pygments==2.14.0
      - pyjwt==1.7.1
      - pylint==1.8.4
      - pyopenssl==17.5.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pyyaml==3.12
      - requests==2.27.1
      - six==1.17.0
      - soupsieve==2.3.2.post1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - waitress==2.0.0
      - webob==1.8.9
      - webtest==2.0.35
      - wrapt==1.16.0
      - zipp==3.6.0
prefix: /opt/conda/envs/conan

conans/test/build_helpers/autotools_configure_test.py::AutoToolsConfigureTest::test_make_targets conans/test/build_helpers/autotools_configure_test.py::AutoToolsConfigureTest::test_mocked_methods conans/test/build_helpers/autotools_configure_test.py::AutoToolsConfigureTest::test_previous_env conans/test/build_helpers/autotools_configure_test.py::AutoToolsConfigureTest::test_variables conans/test/build_helpers/cmake_test.py::CMakeTest::test_clean_sh_path conans/test/build_helpers/cmake_test.py::CMakeTest::test_cores_ancient_visual conans/test/build_helpers/cmake_test.py::CMakeTest::test_deprecated_behaviour conans/test/build_helpers/cmake_test.py::CMakeTest::test_run_tests conans/test/build_helpers/cmake_test.py::CMakeTest::test_shared conans/test/build_helpers/cmake_test.py::CMakeTest::test_sysroot conans/test/build_helpers/cmake_test.py::CMakeTest::test_verbose conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_adjust_path conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_adjust_path_visual_studio conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_arch_flag conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_build_type_flags conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_format_defines conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_format_include_paths conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_format_libraries conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_format_library_paths conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_libcxx_flags conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_pic_flags conans/test/build_helpers/compiler_flags_test.py::CompilerFlagsTest::test_sysroot_flag conans/test/model/version_ranges_test.py::VersionRangesTest::test_local_basic conans/test/model/version_ranges_test.py::VersionRangesTest::test_remote_basic conans/test/util/tools_test.py::ReplaceInFileTest::test_replace_in_file conans/test/util/tools_test.py::ToolsTest::test_environment_nested
conans/test/build_helpers/autotools_configure_test.py::AutoToolsConfigureTest::test_pkg_config_paths conans/test/util/tools_test.py::ToolsTest::test_global_tools_overrided
conans/client/generators/gcc.py conans/client/tools/win.py conans/client/generators/__init__.py conans/client/build/compiler_flags.py conans/client/manager.py conans/client/require_resolver.py conans/client/build/cmake.py conans/tools.py conans/util/env_reader.py conans/client/build/autotools_environment.py conans/client/generators/cmake_multi.py conans/paths.py conans/client/build/visual_environment.py conans/client/generators/compiler_args.py conans/client/tools/__init__.py
conans/client/generators/gcc.py conans/client/tools/win.py conans/client/generators/__init__.py conans/client/build/compiler_flags.py conans/client/manager.py conans/client/require_resolver.py conans/client/build/cmake.py conans/tools.py conans/util/env_reader.py conans/client/build/autotools_environment.py conans/client/generators/cmake_multi.py conans/paths.py conans/client/build/visual_environment.py conans/client/generators/compiler_args.py conans/client/tools/__init__.py