Browse Source

FindBoost: Add Boost_USE_DEBUG_RUNTIME option (#14686)

Add an option to control use of the 'g' runtime debug library tag
on MSVC tools.  Default to ON to preserve existing behavior.
Brad King 11 years ago
parent
commit
d729899a26
1 changed files with 7 additions and 1 deletions
  1. 7 1
      Modules/FindBoost.cmake

+ 7 - 1
Modules/FindBoost.cmake

@@ -82,6 +82,9 @@
 #   Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
 #   Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
 #                              libraries linked statically to the C++ runtime
 #                              libraries linked statically to the C++ runtime
 #                              ('s' tag).  Default is platform dependent.
 #                              ('s' tag).  Default is platform dependent.
+#   Boost_USE_DEBUG_RUNTIME  - Set to ON or OFF to specify whether to use
+#                              libraries linked to the MS debug C++ runtime
+#                              ('g' tag).  Default is ON.
 #   Boost_USE_DEBUG_PYTHON   - Set to ON to use libraries compiled with a
 #   Boost_USE_DEBUG_PYTHON   - Set to ON to use libraries compiled with a
 #                              debug Python build ('y' tag). Default is OFF.
 #                              debug Python build ('y' tag). Default is OFF.
 #   Boost_USE_STLPORT        - Set to ON to use libraries compiled with
 #   Boost_USE_STLPORT        - Set to ON to use libraries compiled with
@@ -446,6 +449,9 @@ endfunction()
 if(NOT DEFINED Boost_USE_MULTITHREADED)
 if(NOT DEFINED Boost_USE_MULTITHREADED)
     set(Boost_USE_MULTITHREADED TRUE)
     set(Boost_USE_MULTITHREADED TRUE)
 endif()
 endif()
+if(NOT DEFINED Boost_USE_DEBUG_RUNTIME)
+  set(Boost_USE_DEBUG_RUNTIME TRUE)
+endif()
 
 
 # Check the version of Boost against the requested version.
 # Check the version of Boost against the requested version.
 if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
 if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
@@ -787,7 +793,7 @@ if(Boost_USE_STATIC_RUNTIME)
 endif()
 endif()
 #  g        using debug versions of the standard and runtime
 #  g        using debug versions of the standard and runtime
 #           support libraries
 #           support libraries
-if(WIN32)
+if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
   if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
   if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
           OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
           OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
     set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
     set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")