diff --git a/scripts/cmake/conan/conan.cmake b/scripts/cmake/conan/conan.cmake
index e7b07f422682e0cf52acc96d9f8904d733e5d6cd..c9fc1c258edb3d6c49a69eb06f70b70225aeebea 100644
--- a/scripts/cmake/conan/conan.cmake
+++ b/scripts/cmake/conan/conan.cmake
@@ -1,3 +1,39 @@
+# The MIT License (MIT)
+
+# Copyright (c) 2018 JFrog
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+
+# This file comes from: https://github.com/conan-io/cmake-conan. Please refer
+# to this repository for issues and documentation.
+
+# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called.
+# It will take CMake current settings (os, compiler, compiler version, architecture)
+# and translate them to conan settings for installing and retrieving dependencies.
+
+# It is intended to facilitate developers building projects that have conan dependencies,
+# but it is only necessary on the end-user side. It is not necessary to create conan
+# packages, in fact it shouldn't be use for that. Check the project documentation.
+
+
 include(CMakeParseArguments)
 
 function(_get_msvc_ide_version result)
@@ -34,12 +70,17 @@ function(conan_cmake_settings result)
     message(STATUS "Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. "
                     "Please check 'conan.cmake' and contribute")
 
+    parse_arguments(${ARGV})
+    set(arch ${ARGUMENTS_ARCH})
+
     if(CONAN_CMAKE_MULTI)
         set(_SETTINGS -g cmake_multi)
     else()
         set(_SETTINGS -g cmake)
     endif()
-    if(CMAKE_BUILD_TYPE)
+    if(ARGUMENTS_BUILD_TYPE)
+        set(_SETTINGS ${_SETTINGS} -s build_type=${ARGUMENTS_BUILD_TYPE})
+    elseif(CMAKE_BUILD_TYPE)
         set(_SETTINGS ${_SETTINGS} -s build_type=${CMAKE_BUILD_TYPE})
     else()
         message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
@@ -73,6 +114,10 @@ function(conan_cmake_settings result)
         message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.")
     endif()
 
+    if(arch)
+        set(_SETTINGS ${_SETTINGS} -s arch=${arch})
+    endif()
+
     if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU)
         # using GCC
         # TODO: Handle other params
@@ -128,24 +173,36 @@ function(conan_cmake_settings result)
             set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=${_VISUAL_VERSION})
         endif()
 
-        if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64")
-            set(_SETTINGS ${_SETTINGS} -s arch=x86_64)
-        elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM")
-            message(STATUS "Conan: Using default ARM architecture from MSVC")
-            set(_SETTINGS ${_SETTINGS} -s arch=armv6)
-        elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86")
-            set(_SETTINGS ${_SETTINGS} -s arch=x86)
-        else ()
-            message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]")
+        if(NOT arch)
+            if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64")
+                set(_SETTINGS ${_SETTINGS} -s arch=x86_64)
+            elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM")
+                message(STATUS "Conan: Using default ARM architecture from MSVC")
+                set(_SETTINGS ${_SETTINGS} -s arch=armv6)
+            elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86")
+                set(_SETTINGS ${_SETTINGS} -s arch=x86)
+            else ()
+                message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]")
+            endif()
         endif()
 
         conan_cmake_detect_vs_runtime(_vs_runtime)
         message(STATUS "Detected VS runtime: ${_vs_runtime}")
         set(_SETTINGS ${_SETTINGS} -s compiler.runtime=${_vs_runtime})
+
+        if (CMAKE_GENERATOR_TOOLSET)
+            set(_SETTINGS ${_SETTINGS} -s compiler.toolset=${CMAKE_VS_PLATFORM_TOOLSET})
+        elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja"))
+            set(_SETTINGS ${_SETTINGS} -s compiler.toolset=${CMAKE_VS_PLATFORM_TOOLSET})
+        endif()
     else()
         message(FATAL_ERROR "Conan: compiler setup not recognized")
     endif()
 
+    foreach(ARG ${ARGUMENTS_SETTINGS})
+        set(_SETTINGS ${_SETTINGS} -s ${ARG})
+    endforeach()
+
     set(${result} ${_SETTINGS} PARENT_SCOPE)
 endfunction()
 
@@ -202,9 +259,9 @@ endfunction()
 
 
 macro(parse_arguments)
-  set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS)
-  set(oneValueArgs CONANFILE DEBUG_PROFILE RELEASE_PROFILE PROFILE)
-  set(multiValueArgs REQUIRES OPTIONS IMPORTS BUILD CONAN_COMMAND)
+  set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_OUTPUT_DIRS)
+  set(oneValueArgs CONANFILE DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE PROFILE ARCH BUILD_TYPE INSTALL_FOLDER)
+  set(multiValueArgs REQUIRES OPTIONS IMPORTS SETTINGS BUILD CONAN_COMMAND)
   cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
 endmacro()
 
@@ -246,13 +303,23 @@ function(conan_cmake_install)
     if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE)
       set(settings -pr ${ARGUMENTS_RELEASE_PROFILE})
     endif()
+    if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE)
+      set(settings -pr ${ARGUMENTS_RELWITHDEBINFO_PROFILE})
+    endif()
+    if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE)
+      set(settings -pr ${ARGUMENTS_MINSIZEREL_PROFILE})
+    endif()
     if(ARGUMENTS_PROFILE)
       set(settings -pr ${ARGUMENTS_PROFILE})
     endif()
     if(ARGUMENTS_UPDATE)
       set(CONAN_INSTALL_UPDATE --update)
     endif()
-    set(conan_args install ${CONANFILE} ${settings} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_OPTIONS})
+    set(CONAN_INSTALL_FOLDER "")
+    if(ARGUMENTS_INSTALL_FOLDER)
+      set(CONAN_INSTALL_FOLDER -if ${ARGUMENTS_INSTALL_FOLDER})
+    endif()
+    set(conan_args install ${CONANFILE} ${settings} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER})
 
     string (REPLACE ";" " " _conan_args "${conan_args}")
     message(STATUS "Conan executing: ${conan_command} ${_conan_args}")
@@ -333,12 +400,13 @@ macro(conan_cmake_run)
         conan_cmake_setup_conanfile(${ARGV})
         if(CONAN_CMAKE_MULTI)
             foreach(CMAKE_BUILD_TYPE "Release" "Debug")
-                conan_cmake_settings(settings)
+                set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE})
+                conan_cmake_settings(settings ${ARGV})
                 conan_cmake_install(SETTINGS ${settings} ${ARGV})
             endforeach()
             set(CMAKE_BUILD_TYPE)
         else()
-            conan_cmake_settings(settings)
+            conan_cmake_settings(settings ${ARGV})
             conan_cmake_install(SETTINGS ${settings} ${ARGV})
         endif()
     endif()
@@ -346,18 +414,15 @@ macro(conan_cmake_run)
     conan_load_buildinfo()
 
     if(ARGUMENTS_BASIC_SETUP)
-      if(ARGUMENTS_CMAKE_TARGETS)
-        if(ARGUMENTS_KEEP_RPATHS)
-            conan_basic_setup(TARGETS KEEP_RPATHS)
-        else()
-            conan_basic_setup(TARGETS)
-        endif()
-      else()
-        if(ARGUMENTS_KEEP_RPATHS)
-            conan_basic_setup(KEEP_RPATHS)
-        else()
-            conan_basic_setup()
-        endif()
-      endif()
+        foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS)
+            if(ARGUMENTS_${_option})
+                if(${_option} STREQUAL "CMAKE_TARGETS")
+                    list(APPEND _setup_options "TARGETS")
+                else()
+                    list(APPEND _setup_options ${_option})
+                endif()
+            endif()
+        endforeach()
+        conan_basic_setup(${_setup_options})
     endif()
 endmacro()