Skip to content

Commit

Permalink
cmake: Fix C++ build
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Jun 4, 2024
1 parent 09e0172 commit 5b87d86
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,13 @@ if(BUILD_TESTING)
CMAKE_DEPENDENT_OPTION(BUILD_googletest "Build googletest" OFF
"NOT BUILD_DEPS" ON)
message(STATUS "Build googletest: ${BUILD_googletest}")

CMAKE_DEPENDENT_OPTION(BUILD_benchmark "Build benchmark" OFF
"NOT BUILD_DEPS" ON)
message(STATUS "Build benchmark: ${BUILD_benchmark}")
else()
set(BUILD_googletest OFF)
set(BUILD_benchmark OFF)
endif()

# Optional third party solvers (enabled by default)
Expand Down
15 changes: 15 additions & 0 deletions cmake/dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,18 @@ if(BUILD_googletest)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()

if(BUILD_benchmark)
message(CHECK_START "Fetching benchmark")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.8.4)
set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_WERROR OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
FetchContent_MakeAvailable(benchmark)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
1 change: 1 addition & 0 deletions ortools/graph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ list(REMOVE_ITEM _SRCS
${CMAKE_CURRENT_SOURCE_DIR}/multi_dijkstra_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/one_tree_lower_bound_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/perfect_matching_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/rooted_tree_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/shortest_paths_benchmarks.cc
${CMAKE_CURRENT_SOURCE_DIR}/shortest_paths_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/solve_flow_model.cc
Expand Down

0 comments on commit 5b87d86

Please sign in to comment.