File tree Expand file tree Collapse file tree 2 files changed +36
-9
lines changed
Expand file tree Collapse file tree 2 files changed +36
-9
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.15.0)
22
33project (TreeSearchSolver LANGUAGES CXX )
44
5- # Options.
5+ # Build options.
6+ option (TREESEARCHSOLVER_BUILD_TEST "Build the unit tests" ON )
67option (TREESEARCHSOLVER_BUILD_EXAMPLES "Build examples" ON )
78
89# Avoid FetchContent warning.
@@ -17,7 +18,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1718# Add sub-directories.
1819add_subdirectory (extern )
1920add_subdirectory (src )
20- add_subdirectory (test )
21+ if (TREESEARCHSOLVER_BUILD_TEST)
22+ add_subdirectory (test )
23+ endif ()
2124if (TREESEARCHSOLVER_BUILD_EXAMPLES)
2225 add_subdirectory (examples )
2326endif ()
Original file line number Diff line number Diff line change 11# Enable FetchContent.
22include (FetchContent )
33
4+ # Fetch boost.
5+ if (TREESEARCHSOLVER_BUILD_TEST OR TREESEARCHSOLVER_BUILD_EXAMPLES)
6+ set (BOOST_INCLUDE_LIBRARIES thread filesystem system program_options dynamic_bitset)
7+ set (BOOST_ENABLE_CMAKE ON )
8+ FetchContent_Declare (
9+ Boost
10+ URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
11+ EXCLUDE_FROM_ALL )
12+ FetchContent_MakeAvailable (Boost)
13+ endif ()
14+
15+ # Fetch googletest.
16+ if (TREESEARCHSOLVER_BUILD_TEST)
17+ FetchContent_Declare (
18+ googletest
19+ URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip)
20+ # For Windows: Prevent overriding the parent project's compiler/linker settings
21+ set (gtest_force_shared_crt ON CACHE BOOL "" FORCE )
22+ set (INSTALL_GTEST OFF )
23+ FetchContent_MakeAvailable (googletest)
24+ endif ()
25+
426# Fetch fontanf/orproblems.
5- FetchContent_Declare (
6- orproblems
7- GIT_REPOSITORY https://github.com/fontanf/orproblems.git
8- GIT_TAG ba099d6bd0ac186e4113fe340789a1800fa72852
9- #SOURCE_DIR "${PROJECT_SOURCE_DIR}/../orproblems/"
10- EXCLUDE_FROM_ALL )
11- FetchContent_MakeAvailable (orproblems)
27+ if (TREESEARCHSOLVER_BUILD_EXAMPLES)
28+ FetchContent_Declare (
29+ orproblems
30+ GIT_REPOSITORY https://github.com/fontanf/orproblems.git
31+ GIT_TAG ba099d6bd0ac186e4113fe340789a1800fa72852
32+ # SOURCE_DIR "${PROJECT_SOURCE_DIR}/../orproblems/"
33+ EXCLUDE_FROM_ALL )
34+ FetchContent_MakeAvailable (orproblems)
35+ endif ()
You can’t perform that action at this time.
0 commit comments