Attached Files | FindBoost.cmake [^] (55,192 bytes) 2015-01-23 03:09
98bf613c+0001-FindBoost-Separate-search-for-debug-and-release-libraries.patch [^] (7,729 bytes) 2015-01-23 08:43 [Show Content] [Hide Content]From 27fa930e016890433dd0c4316fa0bf45324b470e Mon Sep 17 00:00:00 2001
Message-Id: <27fa930e016890433dd0c4316fa0bf45324b470e.1422020569.git.brad.king@kitware.com>
From: Gunther Laure <gunther.laure@gmail.com>
Date: Fri, 23 Jan 2015 03:09:00 -0500
Subject: [PATCH] FindBoost: Separate search for debug and release libraries
(#15364)
---
Modules/FindBoost.cmake | 94 +++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 79 insertions(+), 15 deletions(-)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 99293c1..05749fc 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -50,6 +50,8 @@
#
# Boost_INCLUDE_DIR - Directory containing Boost headers
# Boost_LIBRARY_DIR - Directory containing Boost libraries
+# Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries
+# Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries
# Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant
# Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
#
@@ -305,26 +307,60 @@ macro(_Boost_CHANGE_DETECT changed_var)
endforeach()
endmacro()
-macro(_Boost_FIND_LIBRARY var)
+macro(_Boost_FIND_LIBRARY_RELEASE var)
find_library(${var} ${ARGN})
if(${var})
- # If this is the first library found then save Boost_LIBRARY_DIR.
- if(NOT Boost_LIBRARY_DIR)
+ # If this is the first library found then save Boost_LIBRARY_DIR_RELEASE.
+ if(NOT Boost_LIBRARY_DIR_RELEASE)
get_filename_component(_dir "${${var}}" PATH)
- set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
+ set(Boost_LIBRARY_DIR_RELEASE "${_dir}" CACHE PATH "Boost library directory release" FORCE)
endif()
+
elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
# Try component-specific hints but do not save Boost_LIBRARY_DIR.
find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
endif()
- # If Boost_LIBRARY_DIR is known then search only there.
- if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ # If Boost_LIBRARY_DIR_RELEASE is known then search only there.
+ if(Boost_LIBRARY_DIR_RELEASE)
+ set(_boost_LIBRARY_SEARCH_DIRS_RELEASE ${Boost_LIBRARY_DIR_RELEASE} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
+ endif()
endif()
+
endmacro()
+
+macro(_Boost_FIND_LIBRARY_DEBUG var)
+ find_library(${var} ${ARGN})
+
+ if(${var})
+ # If this is the first library found then save Boost_LIBRARY_DIR_DEBUG.
+ if(NOT Boost_LIBRARY_DIR_DEBUG)
+ get_filename_component(_dir "${${var}}" PATH)
+ set(Boost_LIBRARY_DIR_DEBUG "${_dir}" CACHE PATH "Boost library directory debug" FORCE)
+ endif()
+
+ elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
+ # Try component-specific hints but do not save Boost_LIBRARY_DIR.
+ find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
+ endif()
+
+ # If Boost_LIBRARY_DIR_DEBUG is known then search only there.
+ if(Boost_LIBRARY_DIR_DEBUG)
+ set(_boost_LIBRARY_SEARCH_DIRS_DEBUG ${Boost_LIBRARY_DIR_DEBUG} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
+ endif()
+ endif()
+
+endmacro()
+
+
#-------------------------------------------------------------------------------
#
@@ -453,6 +489,21 @@ endfunction()
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
+# preinit.
+# If set, copy the value of to Boost_LIBRARY_DIR_RELEASE and
+# Boost_LIBRARY_DIR_DEBUG, but only if those are unset.
+#
+if(Boost_LIBRARY_DIR)
+ if(NOT Boost_LIBRARY_DIR_RELEASE)
+ set(Boost_LIBRARY_DIR_RELEASE ${Boost_LIBRARY_DIR} CACHE PATH "Boost library directory release" FORCE)
+ endif()
+ if(NOT Boost_LIBRARY_DIR_DEBUG)
+ set(Boost_LIBRARY_DIR_DEBUG ${Boost_LIBRARY_DIR} CACHE PATH "Boost library directory debug" FORCE)
+ endif()
+endif()
+
+
+#-------------------------------------------------------------------------------
# main.
#-------------------------------------------------------------------------------
@@ -854,8 +905,15 @@ if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED)
unset(Boost_LIBRARY_DIR CACHE)
endif()
-if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+# check set cache entries
+# if Boost_LIBRARY_DIR is set, Boost_LIBRARY_DIR_RELEASE and Boost_LIBRARY_DIR_DEBUG are set too
+if(Boost_LIBRARY_DIR OR Boost_LIBRARY_DIR_RELEASE OR Boost_LIBRARY_DIR_DEBUG)
+ if(Boost_LIBRARY_DIR_RELEASE)
+ set(_boost_LIBRARY_SEARCH_DIRS_RELEASE ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ endif()
+ if(Boost_LIBRARY_DIR_DEBUG )
+ set(_boost_LIBRARY_SEARCH_DIRS_DEBUG ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ endif()
else()
set(_boost_LIBRARY_SEARCH_DIRS "")
if(BOOST_LIBRARYDIR)
@@ -884,11 +942,17 @@ else()
/sw/local/lib
)
endif()
+
+ # copy the search paths to RELEASE and DEBUG, invalidate _boost_LIBRARY_SEARCH_DIRS
+ set(_boost_LIBRARY_SEARCH_DIRS_RELEASE ${_boost_LIBRARY_SEARCH_DIRS})
+ set(_boost_LIBRARY_SEARCH_DIRS_DEBUG ${_boost_LIBRARY_SEARCH_DIRS})
+ unset(_boost_LIBRARY_SEARCH_DIRS)
endif()
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
+ "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
+ "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
@@ -1003,9 +1067,9 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
endif()
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+ _Boost_FIND_LIBRARY_RELEASE(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
NAMES ${_boost_RELEASE_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
@@ -1039,9 +1103,9 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
endif()
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+ _Boost_FIND_LIBRARY_DEBUG(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
NAMES ${_boost_DEBUG_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
@@ -1067,7 +1131,7 @@ endif()
# ------------------------------------------------------------------------
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
-set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})
+set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE} ${Boost_LIBRARY_DIR_DEBUG})
# The above setting of Boost_FOUND was based only on the header files.
# Update it for the requested component libraries.
--
2.1.4
0001-FindBoost-Separate-search-for-debug-and-release-libr.patch [^] (8,189 bytes) 2015-01-26 07:51 [Show Content] [Hide Content]From 3987b4d4669737bf68ab27c42b1f1e35e0c0df7a Mon Sep 17 00:00:00 2001
From: unknown <glaure@HARR.dewetron.com>
Date: Mon, 26 Jan 2015 13:45:25 +0100
Subject: [PATCH] FindBoost: Separate search for debug and release libraries.
Allows FindBoost.cmake to look for boost libs in separate directories. Once valid
directories have been determinded only use them for additional needed boost libs.
---
Modules/FindBoost.cmake | 91 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 75 insertions(+), 16 deletions(-)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 99293c1..d1fc684 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -49,7 +49,8 @@
# and saves search results persistently in CMake cache entries::
#
# Boost_INCLUDE_DIR - Directory containing Boost headers
-# Boost_LIBRARY_DIR - Directory containing Boost libraries
+# Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries
+# Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries
# Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant
# Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
#
@@ -219,6 +220,7 @@ if (NOT Boost_NO_BOOST_CMAKE)
endif()
+
#-------------------------------------------------------------------------------
# FindBoost functions & macros
#
@@ -305,26 +307,37 @@ macro(_Boost_CHANGE_DETECT changed_var)
endforeach()
endmacro()
-macro(_Boost_FIND_LIBRARY var)
+#
+# Find the given library (var).
+# Use 'build_type' to support different lib paths for RELEASE or DEBUG builds
+#
+macro(_Boost_FIND_LIBRARY var build_type)
+
find_library(${var} ${ARGN})
if(${var})
- # If this is the first library found then save Boost_LIBRARY_DIR.
- if(NOT Boost_LIBRARY_DIR)
+ # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
+ if(NOT Boost_LIBRARY_DIR_${build_type})
get_filename_component(_dir "${${var}}" PATH)
- set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
+ set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE)
endif()
elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
# Try component-specific hints but do not save Boost_LIBRARY_DIR.
find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
endif()
- # If Boost_LIBRARY_DIR is known then search only there.
- if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there.
+ if(Boost_LIBRARY_DIR_${build_type})
+ set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}"
+ " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}")
+ endif()
endif()
endmacro()
+
#-------------------------------------------------------------------------------
#
@@ -456,6 +469,14 @@ endfunction()
# main.
#-------------------------------------------------------------------------------
+
+# If the user sets BOOST_LIBRARY_DIR, cache the value in Boost_LIBRARY_DIR_RELEASE.
+# Don't cache Boost_LIBRARY_DIR_DEBUG as it contains the same value in this case.
+if(Boost_LIBRARY_DIR)
+ set(Boost_LIBRARY_DIR_RELEASE ${Boost_LIBRARY_DIR} CACHE PATH "Boost library directory release" FORCE)
+ set(Boost_LIBRARY_DIR_DEBUG ${Boost_LIBRARY_DIR} )
+endif()
+
if(NOT DEFINED Boost_USE_MULTITHREADED)
set(Boost_USE_MULTITHREADED TRUE)
endif()
@@ -854,8 +875,17 @@ if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED)
unset(Boost_LIBRARY_DIR CACHE)
endif()
-if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+# check set cache entries
+# if Boost_LIBRARY_DIR is set (by the user): Boost_LIBRARY_DIR_RELEASE and Boost_LIBRARY_DIR_DEBUG
+# mirror its value
+# if Boost_LIBRARY_DIR_[RELEASE,DEBUG] are set, prefer their values
+if(Boost_LIBRARY_DIR OR Boost_LIBRARY_DIR_RELEASE OR Boost_LIBRARY_DIR_DEBUG)
+ if(Boost_LIBRARY_DIR_RELEASE)
+ set(_boost_LIBRARY_SEARCH_DIRS_RELEASE ${Boost_LIBRARY_DIR_RELEASE} NO_DEFAULT_PATH)
+ endif()
+ if(Boost_LIBRARY_DIR_DEBUG )
+ set(_boost_LIBRARY_SEARCH_DIRS_DEBUG ${Boost_LIBRARY_DIR_DEBUG} NO_DEFAULT_PATH)
+ endif()
else()
set(_boost_LIBRARY_SEARCH_DIRS "")
if(BOOST_LIBRARYDIR)
@@ -884,11 +914,17 @@ else()
/sw/local/lib
)
endif()
+
+ # copy the search paths to RELEASE and DEBUG, invalidate _boost_LIBRARY_SEARCH_DIRS
+ set(_boost_LIBRARY_SEARCH_DIRS_RELEASE ${_boost_LIBRARY_SEARCH_DIRS})
+ set(_boost_LIBRARY_SEARCH_DIRS_DEBUG ${_boost_LIBRARY_SEARCH_DIRS})
+ unset(_boost_LIBRARY_SEARCH_DIRS)
endif()
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
+ "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
+ "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
@@ -1002,16 +1038,26 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
"Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
endif()
+ # if Boost_LIBRARY_DIR_RELEASE is not defined,
+ # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
+ if(NOT Boost_LIBRARY_DIR_RELEASE)
+ if(Boost_LIBRARY_DIR_DEBUG)
+ list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
+ endif()
+ endif()
+
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
NAMES ${_boost_RELEASE_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
DOC "${_boost_docstring_release}"
)
+
+
#
# Find DEBUG libraries
#
@@ -1038,10 +1084,21 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
"Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
endif()
+ # if Boost_LIBRARY_DIR_DEBUG is not defined,
+ # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
+ if(NOT Boost_LIBRARY_DIR_DEBUG)
+ if(Boost_LIBRARY_DIR_RELEASE)
+ list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
+ endif()
+ endif()
+
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+ # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
+
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
NAMES ${_boost_DEBUG_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
@@ -1067,7 +1124,9 @@ endif()
# ------------------------------------------------------------------------
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
-set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})
+set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE} ${Boost_LIBRARY_DIR_DEBUG})
+list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
+
# The above setting of Boost_FOUND was based only on the header files.
# Update it for the requested component libraries.
--
1.9.5.msysgit.0
0002-FindBoost-Separate-search-for-debug-and-release-libr.patch [^] (10,596 bytes) 2015-01-26 12:17 [Show Content] [Hide Content]From 1a46750b42eb96f8c2446db646dd71d89fdcf628 Mon Sep 17 00:00:00 2001
From: Gunther Laure <gunther.laure@gmail.com>
Date: Mon, 26 Jan 2015 18:13:44 +0100
Subject: [PATCH] FindBoost: Separate search for debug and release libraries.
Allows FindBoost.cmake to look for boost libs in separate directories. Once valid
directories have been determinded only use them for additional needed boost libs.
---
Modules/FindBoost.cmake | 127 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 106 insertions(+), 21 deletions(-)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 99293c1..0d0463f 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -49,7 +49,8 @@
# and saves search results persistently in CMake cache entries::
#
# Boost_INCLUDE_DIR - Directory containing Boost headers
-# Boost_LIBRARY_DIR - Directory containing Boost libraries
+# Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries
+# Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries
# Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant
# Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
#
@@ -118,6 +119,8 @@
# "/usr/lib/libboost_system.so". This does not
# affect linking and should not be enabled unless
# the user needs this information.
+# Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and
+# Boost_LIBRARY_DIR_DEBUG.
#
# On Visual Studio and Borland compilers Boost headers request automatic
# linking to corresponding libraries. This requires matching libraries
@@ -219,6 +222,7 @@ if (NOT Boost_NO_BOOST_CMAKE)
endif()
+
#-------------------------------------------------------------------------------
# FindBoost functions & macros
#
@@ -283,6 +287,15 @@ macro(_Boost_ADJUST_LIB_VARS basename)
)
endmacro()
+#
+# Detect changes in used variables.
+# Compares the current variable value with the last one.
+# In short form:
+# v != v_LAST -> CHANGED = 1
+# v is defined, v_LAST not -> CHANGED = 1
+# v is not defined, but v_LAST is -> CHANGED = 1
+# otherwise -> CHANGED = 0
+# CHANGED is returned in $(changed_var)
macro(_Boost_CHANGE_DETECT changed_var)
set(${changed_var} 0)
foreach(v ${ARGN})
@@ -305,26 +318,37 @@ macro(_Boost_CHANGE_DETECT changed_var)
endforeach()
endmacro()
-macro(_Boost_FIND_LIBRARY var)
+#
+# Find the given library (var).
+# Use 'build_type' to support different lib paths for RELEASE or DEBUG builds
+#
+macro(_Boost_FIND_LIBRARY var build_type)
+
find_library(${var} ${ARGN})
if(${var})
- # If this is the first library found then save Boost_LIBRARY_DIR.
- if(NOT Boost_LIBRARY_DIR)
+ # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
+ if(NOT Boost_LIBRARY_DIR_${build_type})
get_filename_component(_dir "${${var}}" PATH)
- set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
+ set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE)
endif()
elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
# Try component-specific hints but do not save Boost_LIBRARY_DIR.
find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
endif()
- # If Boost_LIBRARY_DIR is known then search only there.
- if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there.
+ if(Boost_LIBRARY_DIR_${build_type})
+ set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}"
+ " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}")
+ endif()
endif()
endmacro()
+
#-------------------------------------------------------------------------------
#
@@ -456,6 +480,16 @@ endfunction()
# main.
#-------------------------------------------------------------------------------
+
+# If the user sets BOOST_LIBRARY_DIR, use it as the default for both
+# configurations.
+if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR)
+ set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}")
+endif()
+if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR)
+ set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}")
+endif()
+
if(NOT DEFINED Boost_USE_MULTITHREADED)
set(Boost_USE_MULTITHREADED TRUE)
endif()
@@ -846,16 +880,38 @@ endif()
# ------------------------------------------------------------------------
# Begin finding boost libraries
# ------------------------------------------------------------------------
-set(_Boost_VARS_LIB BOOST_LIBRARYDIR Boost_LIBRARY_DIR)
-_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR ${_Boost_VARS_DIR} ${_Boost_VARS_LIB} Boost_INCLUDE_DIR)
-# Clear Boost_LIBRARY_DIR if it did not change but other input affecting the
+
+# Release
+set(_Boost_VARS_LIB_RELEASE BOOST_LIBRARYDIR Boost_LIBRARY_DIR_RELEASE)
+_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_RELEASE ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_RELEASE} Boost_INCLUDE_DIR)
+# Clear Boost_LIBRARY_DIR_RELEASE if it did not change but other input affecting the
+# location did. We will find a new one based on the new inputs.
+if(_Boost_CHANGE_LIBDIR_RELEASE AND NOT _Boost_LIBRARY_DIR_RELEASE_CHANGED)
+ unset(Boost_LIBRARY_DIR_RELEASE CACHE)
+endif()
+
+# Debug
+set(_Boost_VARS_LIB_DEBUG BOOST_LIBRARYDIR Boost_LIBRARY_DIR_DEBUG)
+_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_DEBUG ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_DEBUG} Boost_INCLUDE_DIR)
+# Clear Boost_LIBRARY_DIR_DEBUG if it did not change but other input affecting the
# location did. We will find a new one based on the new inputs.
-if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED)
- unset(Boost_LIBRARY_DIR CACHE)
+if(_Boost_CHANGE_LIBDIR_DEBUG AND NOT _Boost_LIBRARY_DIR_DEBUG_CHANGED)
+ unset(Boost_LIBRARY_DIR_DEBUG CACHE)
endif()
-if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+
+
+# check set cache entries
+# if Boost_LIBRARY_DIR is set (by the user): Boost_LIBRARY_DIR_RELEASE and Boost_LIBRARY_DIR_DEBUG
+# mirror its value
+# if Boost_LIBRARY_DIR_[RELEASE,DEBUG] are set, prefer their values
+if(Boost_LIBRARY_DIR OR Boost_LIBRARY_DIR_RELEASE OR Boost_LIBRARY_DIR_DEBUG)
+ if(Boost_LIBRARY_DIR_RELEASE)
+ set(_boost_LIBRARY_SEARCH_DIRS_RELEASE ${Boost_LIBRARY_DIR_RELEASE} NO_DEFAULT_PATH)
+ endif()
+ if(Boost_LIBRARY_DIR_DEBUG )
+ set(_boost_LIBRARY_SEARCH_DIRS_DEBUG ${Boost_LIBRARY_DIR_DEBUG} NO_DEFAULT_PATH)
+ endif()
else()
set(_boost_LIBRARY_SEARCH_DIRS "")
if(BOOST_LIBRARYDIR)
@@ -884,11 +940,17 @@ else()
/sw/local/lib
)
endif()
+
+ # copy the search paths to RELEASE and DEBUG, invalidate _boost_LIBRARY_SEARCH_DIRS
+ set(_boost_LIBRARY_SEARCH_DIRS_RELEASE ${_boost_LIBRARY_SEARCH_DIRS})
+ set(_boost_LIBRARY_SEARCH_DIRS_DEBUG ${_boost_LIBRARY_SEARCH_DIRS})
+ unset(_boost_LIBRARY_SEARCH_DIRS)
endif()
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
+ "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
+ "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
@@ -1002,16 +1064,26 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
"Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
endif()
+ # if Boost_LIBRARY_DIR_RELEASE is not defined,
+ # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
+ if(NOT Boost_LIBRARY_DIR_RELEASE)
+ if(Boost_LIBRARY_DIR_DEBUG)
+ list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
+ endif()
+ endif()
+
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
NAMES ${_boost_RELEASE_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
DOC "${_boost_docstring_release}"
)
+
+
#
# Find DEBUG libraries
#
@@ -1038,10 +1110,21 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
"Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
endif()
+ # if Boost_LIBRARY_DIR_DEBUG is not defined,
+ # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
+ if(NOT Boost_LIBRARY_DIR_DEBUG)
+ if(Boost_LIBRARY_DIR_RELEASE)
+ list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
+ endif()
+ endif()
+
+ # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
+
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
NAMES ${_boost_DEBUG_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
@@ -1067,7 +1150,9 @@ endif()
# ------------------------------------------------------------------------
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
-set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})
+set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE} ${Boost_LIBRARY_DIR_DEBUG})
+list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
+
# The above setting of Boost_FOUND was based only on the header files.
# Update it for the requested component libraries.
--
1.9.5.msysgit.0
v2-0001-FindBoost-Search-for-debug-and-release-libraries-sep.patch [^] (11,618 bytes) 2015-02-03 14:17 [Show Content] [Hide Content]From b3b092c96a014d167d8ec94e46526dbbd692410a Mon Sep 17 00:00:00 2001
Message-Id: <b3b092c96a014d167d8ec94e46526dbbd692410a.1422991036.git.brad.king@kitware.com>
From: Gunther Laure <gunther.laure@gmail.com>
Date: Mon, 26 Jan 2015 18:13:44 +0100
Subject: [PATCH] FindBoost: Search for debug and release libraries separately
(#15364)
Split Boost_LIBRARY_DIR into Boost_LIBRARY_DIR_[RELEASE,DEBUG] to allow
libraries to be grouped into per-config directories.
---
Modules/FindBoost.cmake | 156 +++++++++++++++++++++++++++++++++---------------
1 file changed, 107 insertions(+), 49 deletions(-)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 99293c1..466090b 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -49,7 +49,8 @@
# and saves search results persistently in CMake cache entries::
#
# Boost_INCLUDE_DIR - Directory containing Boost headers
-# Boost_LIBRARY_DIR - Directory containing Boost libraries
+# Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries
+# Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries
# Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant
# Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
#
@@ -65,7 +66,8 @@
# using the above hints (excluding BOOST_INCLUDEDIR and
# Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR,
# and the library name configuration settings below. It saves the
-# library directory in Boost_LIBRARY_DIR and individual library
+# library directories in Boost_LIBRARY_DIR_DEBUG and
+# Boost_LIBRARY_DIR_RELEASE and individual library
# locations in Boost_<C>_LIBRARY_DEBUG and Boost_<C>_LIBRARY_RELEASE.
# When one changes settings used by previous searches in the same build
# tree (excluding environment variables) this module discards previous
@@ -118,6 +120,8 @@
# "/usr/lib/libboost_system.so". This does not
# affect linking and should not be enabled unless
# the user needs this information.
+# Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and
+# Boost_LIBRARY_DIR_DEBUG.
#
# On Visual Studio and Borland compilers Boost headers request automatic
# linking to corresponding libraries. This requires matching libraries
@@ -283,6 +287,14 @@ macro(_Boost_ADJUST_LIB_VARS basename)
)
endmacro()
+# Detect changes in used variables.
+# Compares the current variable value with the last one.
+# In short form:
+# v != v_LAST -> CHANGED = 1
+# v is defined, v_LAST not -> CHANGED = 1
+# v is not defined, but v_LAST is -> CHANGED = 1
+# otherwise -> CHANGED = 0
+# CHANGED is returned in variable named ${changed_var}
macro(_Boost_CHANGE_DETECT changed_var)
set(${changed_var} 0)
foreach(v ${ARGN})
@@ -305,23 +317,33 @@ macro(_Boost_CHANGE_DETECT changed_var)
endforeach()
endmacro()
-macro(_Boost_FIND_LIBRARY var)
+#
+# Find the given library (var).
+# Use 'build_type' to support different lib paths for RELEASE or DEBUG builds
+#
+macro(_Boost_FIND_LIBRARY var build_type)
+
find_library(${var} ${ARGN})
if(${var})
- # If this is the first library found then save Boost_LIBRARY_DIR.
- if(NOT Boost_LIBRARY_DIR)
+ # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
+ if(NOT Boost_LIBRARY_DIR_${build_type})
get_filename_component(_dir "${${var}}" PATH)
- set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
+ set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE)
endif()
elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
- # Try component-specific hints but do not save Boost_LIBRARY_DIR.
+ # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
endif()
- # If Boost_LIBRARY_DIR is known then search only there.
- if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there.
+ if(Boost_LIBRARY_DIR_${build_type})
+ set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}"
+ " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}")
+ endif()
endif()
endmacro()
@@ -456,6 +478,16 @@ endfunction()
# main.
#-------------------------------------------------------------------------------
+
+# If the user sets Boost_LIBRARY_DIR, use it as the default for both
+# configurations.
+if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR)
+ set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}")
+endif()
+if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR)
+ set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}")
+endif()
+
if(NOT DEFINED Boost_USE_MULTITHREADED)
set(Boost_USE_MULTITHREADED TRUE)
endif()
@@ -846,49 +878,54 @@ endif()
# ------------------------------------------------------------------------
# Begin finding boost libraries
# ------------------------------------------------------------------------
-set(_Boost_VARS_LIB BOOST_LIBRARYDIR Boost_LIBRARY_DIR)
-_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR ${_Boost_VARS_DIR} ${_Boost_VARS_LIB} Boost_INCLUDE_DIR)
-# Clear Boost_LIBRARY_DIR if it did not change but other input affecting the
-# location did. We will find a new one based on the new inputs.
-if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED)
- unset(Boost_LIBRARY_DIR CACHE)
-endif()
-if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-else()
- set(_boost_LIBRARY_SEARCH_DIRS "")
- if(BOOST_LIBRARYDIR)
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_LIBRARYDIR})
- elseif(_ENV_BOOST_LIBRARYDIR)
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_LIBRARYDIR})
- endif()
-
- if(BOOST_ROOT)
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
- elseif(_ENV_BOOST_ROOT)
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
+foreach(c DEBUG RELEASE)
+ set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c})
+ _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR)
+ # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the
+ # location did. We will find a new one based on the new inputs.
+ if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED)
+ unset(Boost_LIBRARY_DIR_${c} CACHE)
endif()
- list(APPEND _boost_LIBRARY_SEARCH_DIRS
- ${Boost_INCLUDE_DIR}/lib
- ${Boost_INCLUDE_DIR}/../lib
- ${Boost_INCLUDE_DIR}/stage/lib
- )
- if( Boost_NO_SYSTEM_PATHS )
- list(APPEND _boost_LIBRARY_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
+ # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value.
+ if(Boost_LIBRARY_DIR_${c})
+ set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
else()
- list(APPEND _boost_LIBRARY_SEARCH_DIRS PATHS
- C:/boost/lib
- C:/boost
- /sw/local/lib
+ set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
+ if(BOOST_LIBRARYDIR)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
+ elseif(_ENV_BOOST_LIBRARYDIR)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR})
+ endif()
+
+ if(BOOST_ROOT)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
+ elseif(_ENV_BOOST_ROOT)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
+ endif()
+
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
+ ${Boost_INCLUDE_DIR}/lib
+ ${Boost_INCLUDE_DIR}/../lib
+ ${Boost_INCLUDE_DIR}/stage/lib
)
+ if( Boost_NO_SYSTEM_PATHS )
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH)
+ else()
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
+ C:/boost/lib
+ C:/boost
+ /sw/local/lib
+ )
+ endif()
endif()
-endif()
+endforeach()
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
+ "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
+ "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
@@ -1002,10 +1039,16 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
"Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
endif()
+ # if Boost_LIBRARY_DIR_RELEASE is not defined,
+ # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
+ if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG)
+ list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
+ endif()
+
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
NAMES ${_boost_RELEASE_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
@@ -1038,10 +1081,16 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
"Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
endif()
+ # if Boost_LIBRARY_DIR_DEBUG is not defined,
+ # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
+ if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE)
+ list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
+ endif()
+
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
NAMES ${_boost_DEBUG_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
@@ -1067,7 +1116,16 @@ endif()
# ------------------------------------------------------------------------
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
-set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})
+set(Boost_LIBRARY_DIRS)
+if(Boost_LIBRARY_DIR_RELEASE)
+ list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE})
+endif()
+if(Boost_LIBRARY_DIR_DEBUG)
+ list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG})
+endif()
+if(Boost_LIBRARY_DIRS)
+ list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
+endif()
# The above setting of Boost_FOUND was based only on the header files.
# Update it for the requested component libraries.
--
2.1.4
|