Skip to content

Commit

Permalink
fix corner cases for Boost
Browse files Browse the repository at this point in the history
- when USE_SYSTEM_BOOST=OFF, set Boost_NO_SYSTEM_PATHS=ON to increase our chances
of finding our own version
- when USE_SYSTEM_BOOST=OFF, pass BOOSTROOT and Boost_DIR to projects (when set)

Fixes SyneRBI#627
  • Loading branch information
KrisThielemans committed Nov 18, 2021
1 parent 4483562 commit 8f4ec72
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions SuperBuild/External_Boost.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#========================================================================
# Author: Benjamin A Thomas
# Author: Kris Thielemans
# Copyright 2017, 2020 University College London
# Copyright 2017, 2020, 2021 University College London
#
# This file is part of the CCP SyneRBI (formerly PETMR) Synergistic Image Reconstruction Framework (SIRF) SuperBuild.
#
Expand Down Expand Up @@ -74,13 +74,13 @@ if(NOT ( DEFINED "USE_SYSTEM_${externalProjName}" AND "${USE_SYSTEM_${externalPr
)

set(BOOST_ROOT ${Boost_Install_Dir})
set(BOOST_INCLUDEDIR ${Boost_Install_Dir}/include)
set(BOOST_LIBRARY_DIR ${Boost_Install_Dir}/lib)

set(Boost_CMAKE_ARGS
-DBOOST_INCLUDEDIR:PATH=${BOOST_ROOT}/include/
-DBOOST_LIBRARYDIR:PATH=${BOOST_LIBRARY_DIR}
-DBOOST_ROOT:PATH=${BOOST_ROOT}
-DBoost_NO_SYSTEM_PATHS:BOOL=ON
)

else()
Expand All @@ -91,9 +91,16 @@ if(NOT ( DEFINED "USE_SYSTEM_${externalProjName}" AND "${USE_SYSTEM_${externalPr
# TODO might need to use Boost_LIBRARY_DIR_Debug for Debug builds
set(Boost_CMAKE_ARGS ${Boost_CMAKE_ARGS} -DBOOST_LIBRARYDIR:PATH=${Boost_LIBRARY_DIR_RELEASE})
endif()
# pass on any options specified by the caller
if (BOOST_ROOT)
set(Boost_CMAKE_ARGS ${Boost_CMAKE_ARGS} -DBOOST_ROOT:PATH=${BOOST_ROOT})
endif()
if (BOOSTROOT)
set(Boost_CMAKE_ARGS ${Boost_CMAKE_ARGS} -DBOOSTROOT:PATH=${BOOSTROOT})
endif()
if (Boost_DIR)
set(Boost_CMAKE_ARGS ${Boost_CMAKE_ARGS} -DBoost_DIR:PATH=${Boost_DIR})
endif()
if (WIN32)
# need to tell boost to use dynamic libraries as otherwise it tends to compile as static,
# but link with dynamic libraries, resulting in linking problems
Expand Down

0 comments on commit 8f4ec72

Please sign in to comment.