Skip to content

Commit

Permalink
Merge pull request #17 from leoisl/boost_root
Browse files Browse the repository at this point in the history
Refactoring BOOST search in CMake
  • Loading branch information
leoisl authored Jul 19, 2022
2 parents 7c9804b + 24b6aac commit 5154fef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,9 @@ jobs:
- name: Build and test
run: |
# set up some variables so that CMake can find boost
export BOOST_INCLUDE_DIR="/usr/local/opt/[email protected]/include"
export BOOST_LIBRARY_DIR="/usr/local/opt/[email protected]/lib"
export CXXFLAGS="-DUSE_BOOST -I${BOOST_INCLUDE_DIR} -L${BOOST_LIBRARY_DIR}"
export LDFLAGS="-L${BOOST_LIBRARY_DIR} -lboost_filesystem -lboost_system"
export BOOST_ROOT="/usr/local/opt/[email protected]"
mkdir build
cd build
cmake -DBOOST=1 -DNOOPENMP=1 -DSKIP_PYTHON=1 ..
cmake -DNOOPENMP=1 -DSKIP_PYTHON=1 ..
make
make test
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,10 @@ set(COBS_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${COBS_INCLUDE_DIRS})
set(COBS_LINK_LIBRARIES ${ZLIB_LIBRARIES} ${COBS_LINK_LIBRARIES})

### check if we should use BOOST ###
if(BOOST)
if(DEFINED ENV{BOOST_INCLUDE_DIR} AND DEFINED ENV{BOOST_LIBRARY_DIR})
message(WARNING "NOT FINDING BOOST THROUGH CMAKE, USING ENV VARIABLES!")
else()
find_package(Boost 1.72.0 COMPONENTS system filesystem)
set(COBS_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${COBS_INCLUDE_DIRS})
set(COBS_LINK_LIBRARIES ${Boost_LIBRARIES} ${COBS_LINK_LIBRARIES})
endif()
find_package(Boost 1.72.0 COMPONENTS system filesystem)
if(BOOST_FOUND)
set(COBS_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${COBS_INCLUDE_DIRS})
set(COBS_LINK_LIBRARIES ${Boost_LIBRARIES} ${COBS_LINK_LIBRARIES})
add_compile_definitions(COBS_USE_BOOST)
else()
set(COBS_LINK_LIBRARIES stdc++fs ${COBS_LINK_LIBRARIES})
Expand Down

0 comments on commit 5154fef

Please sign in to comment.