From 0b5d6d7880bd6595571e0b556f72f84ba300343b Mon Sep 17 00:00:00 2001 From: Jacco Geul Date: Thu, 14 Sep 2017 11:36:41 +0200 Subject: [PATCH] Variable cleaning fix for Mac OS X bug. --- external/CMake/add_boost.cmake | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/external/CMake/add_boost.cmake b/external/CMake/add_boost.cmake index a54e2be9d..a1d75c352 100755 --- a/external/CMake/add_boost.cmake +++ b/external/CMake/add_boost.cmake @@ -108,9 +108,14 @@ foreach(Component ${BoostComponents}) set(BoostComponentsDir OFF) endif() - # Need to unset these too, otherwise other find_package calls willl not update them. - unset("${Boost_${ComponentUpper}_FOUND}" CACHE) - unset("${Boost_${ComponentUpper}_LIBRARY}" CACHE) + # Need to unset these too, otherwise other find_package calls willl not update them. Also some are put in current scope and cache + unset("Boost_${ComponentUpper}_FOUND") + unset("Boost_${ComponentUpper}_LIBRARY") + unset("Boost_${ComponentUpper}_FOUND" CACHE) + unset("Boost_${ComponentUpper}_LIBRARY" CACHE) + unset("Boost_${ComponentUpper}_LIBRARIES") + unset("Boost_${ComponentUpper}_LIBRARY_DEBUG" CACHE) + unset("Boost_${ComponentUpper}_LIBRARY_RELEASE" CACHE) # Exit the for loop if a single component fails if(NOT ${BoostComponentsDir}) @@ -123,17 +128,19 @@ foreach(Component ${BoostComponents}) endforeach() # Unset all variable from find_package(Boost), preventing future usages of this macro becoming lazy. -unset(Boost_FOUND CACHE) -unset(Boost_INCLUDE_DIRS CACHE) +# As before some variables are also cached, so need double cleaning +unset(Boost_FOUND) +unset(Boost_INCLUDE_DIRS) +unset(Boost_LIBRARY_DIRS) unset(Boost_LIBRARY_DIRS CACHE) -unset(Boost_LIBRARIES CACHE) +unset(Boost_LIBRARIES) +unset(Boost_VERSION) unset(Boost_VERSION CACHE) +unset(Boost_LIB_VERSION) unset(Boost_LIB_VERSION CACHE) -unset(Boost_MAJOR_VERSION CACHE) -unset(Boost_MINOR_VERSION CACHE) -unset(Boost_SUBMINOR_VERSION CACHE) -unset(Boost_LIB_DIAGNOSTIC_DEFINITIONS CACHE) -endif() +unset(Boost_MAJOR_VERSION) +unset(Boost_MINOR_VERSION) +unset(Boost_SUBMINOR_VERSION) # Check if all components were found and if their location is local and not on the system. if(${BoostComponentsFound} AND ${BoostComponentsDir})