-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
51 lines (38 loc) · 1.65 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
cmake_minimum_required(VERSION 3.16)
project(search_engine)
include(FetchContent)
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
set(CMAKE_CXX_STANDARD 17)
message("-- ENABLE_TESTS: " ${ENABLE_TESTS})
find_package(Threads REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
set(Boost_NO_WARN_NEW_VERSIONS 1)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS thread system REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
FetchContent_Declare(
json
URL
https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz
)
FetchContent_MakeAvailable(json)
if(ENABLE_TESTS)
FetchContent_Declare(
googletest
URL
https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
FetchContent_MakeAvailable(googletest)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
set(gtest_disable_pthreads on)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
enable_testing()
add_executable(search_engine_test src/ConverterJSON.cpp tests/tests.cpp src/InvertedIndex.cpp src/SearchServer.cpp)
target_link_libraries(search_engine_test PRIVATE nlohmann_json::nlohmann_json gtest_main Threads::Threads ${Boost_LIBRARIES})
include(GoogleTest)
gtest_discover_tests(search_engine_test)
endif()
add_executable(search_engine src/main.cpp src/ConverterJSON.cpp src/InvertedIndex.cpp src/SearchServer.cpp )
target_link_libraries(search_engine PRIVATE nlohmann_json::nlohmann_json Threads::Threads ${Boost_LIBRARIES})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/search_engine DESTINATION .)