Skip to content

Commit

Permalink
Merge pull request #73 from thanasipantazides/main
Browse files Browse the repository at this point in the history
Removing boost::filesystem from CMakeLists
  • Loading branch information
thanasipantazides authored Nov 23, 2024
2 parents 8fd24fc + 99eda9f commit 67a0b3f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: "install boost"
run: sudo apt-get -y install libboost-dev
run: sudo apt-get -y install libboost-all-dev
- name: "install nlohmann-json"
run: sudo apt-get -y install nlohmann-json3-dev
- name: "set boost path"
run: export BOOST_ROOT=/usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/
- name: "debug print"
run: ls -l /usr/local/include
- name: "run CMake"
run: cmake -S . build
run: cmake -S . build -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/
- name: "build project"
run: cmake --build build --target all -j4
run: cmake --build build --target formatter foxsimile
43 changes: 17 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,38 +216,29 @@ endif()
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.70 REQUIRED COMPONENTS filesystem program_options)
find_package(Boost 1.74 REQUIRED COMPONENTS program_options)
if(Boost_FOUND)
message(STATUS "Boost version: ${Boost_VERSION}")

# Check if Boost version newer than CMake, or if CMake is too old:
if(NOT TARGET Boost::filesystem)
add_library(Boost::filesystem IMPORTED INTERFACE)
set_property(TARGET Boost::filesystem PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::filesystem PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES})
endif()

# link the user libraries to Boost
target_link_libraries(libcom PUBLIC Boost::filesystem Boost::program_options)
target_link_libraries(libsubsys PUBLIC Boost::filesystem Boost::program_options)
target_link_libraries(libutil PUBLIC Boost::filesystem Boost::program_options)
target_link_libraries(libgse PUBLIC Boost::filesystem Boost::program_options)
target_link_libraries(libcom PUBLIC Boost::program_options)
target_link_libraries(libsubsys PUBLIC Boost::program_options)
target_link_libraries(libutil PUBLIC Boost::program_options)
target_link_libraries(libgse PUBLIC Boost::program_options)

# then link them all to the executables
target_link_libraries(formatter PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(stop PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(shutdown PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(log PUBLIC Boost::filesystem libcom libsubsys libutil libgse)
target_link_libraries(foxsimile PUBLIC Boost::filesystem libcom libsubsys libutil libgse)
target_link_libraries(test_spw_crc PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(test_spw_ping PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(test_spw_reply PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(test_loop PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(test_buffers PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(test PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(test_uart PUBLIC Boost::filesystem libcom libsubsys libutil)
target_link_libraries(formatter PUBLIC libcom libsubsys libutil)
target_link_libraries(stop PUBLIC libcom libsubsys libutil)
target_link_libraries(shutdown PUBLIC libcom libsubsys libutil)
target_link_libraries(log PUBLIC libcom libsubsys libutil libgse)
target_link_libraries(foxsimile PUBLIC libcom libsubsys libutil libgse)
target_link_libraries(test_spw_crc PUBLIC libcom libsubsys libutil)
target_link_libraries(test_spw_ping PUBLIC libcom libsubsys libutil)
target_link_libraries(test_spw_reply PUBLIC libcom libsubsys libutil)
target_link_libraries(test_loop PUBLIC libcom libsubsys libutil)
target_link_libraries(test_buffers PUBLIC libcom libsubsys libutil)
target_link_libraries(test PUBLIC libcom libsubsys libutil)
target_link_libraries(test_uart PUBLIC libcom libsubsys libutil)
elseif(NOT Boost_FOUND)
error("Boost not found.")
endif()
Expand Down

0 comments on commit 67a0b3f

Please sign in to comment.