|
1 | 1 | project(algorithms) |
2 | | -cmake_minimum_required(VERSION 2.8.11) |
| 2 | +cmake_minimum_required(VERSION 3.10) |
3 | 3 |
|
4 | 4 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}) |
5 | 5 |
|
6 | | -set(CMAKE_CXX_STANDARD 11) |
7 | | - |
8 | | -message(STATUS "cmake module path: ${CMAKE_MODULE_PATH}") |
9 | | - |
10 | | -# download and unpack googletest at configure time |
11 | | -configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) |
12 | | - |
13 | | -execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . |
14 | | - RESULT_VARIABLE result |
15 | | - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download) |
16 | | - |
17 | | -if(result) |
18 | | - message(FATAL_ERROR "CMake step for googletest failed: ${result}") |
19 | | -endif() |
20 | | - |
21 | | -execute_process(COMMAND ${CMAKE_COMMAND} --build . |
22 | | - RESULT_VARIABLE result |
23 | | - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) |
24 | | -if(result) |
25 | | - message(FATAL_ERROR "Build step for googletest failed: ${result}") |
26 | | -endif() |
| 6 | +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) |
| 7 | +conan_basic_setup(TARGETS) |
27 | 8 |
|
28 | | -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) |
| 9 | +set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
29 | 10 |
|
30 | | -add_subdirectory("${CMAKE_BINARY_DIR}/googletest-src" "${CMAKE_BINARY_DIR}/googletest-build") |
| 11 | +message(STATUS "cmake module path: ${CMAKE_MODULE_PATH}") |
31 | 12 |
|
32 | | -if (CMAKE_VERSION VERSION_LESS 2.8.11) |
33 | | - include_directories("${gtest_SOURCE_DIR}/include") |
34 | | -endif() |
| 13 | +set(CMAKE_CXX_STANDARD 11) |
| 14 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 15 | +set(CMAKE_CXX_EXTENSIONS OFF) |
35 | 16 |
|
36 | 17 | enable_testing() |
37 | 18 |
|
38 | | -include(Sources) |
39 | | - |
40 | | -add_library(algorithms_on_strings STATIC ${ALGORITHMS_ON_STRINGS_LIB_SRC}) |
41 | | -target_include_directories(algorithms_on_strings |
42 | | - PUBLIC |
43 | | - algorithms_on_strings/longest_common_substring) |
44 | | - |
45 | | -SET(GTEST_LIBS gtest gtest_main) |
46 | | -SET(STRING_ALGO_LIBS algorithms_on_strings) |
47 | | - |
48 | | -add_library(sorting_algorithms STATIC ${SORTING_ALGORITHMS_LIB_SRC}) |
49 | | -target_include_directories(sorting_algorithms |
50 | | - PUBLIC |
51 | | - sorting_algorithms/quick_sort) |
52 | | -set_property(TARGET sorting_algorithms PROPERTY LINKER_LANGUAGE CXX) |
53 | | - |
54 | | -SET(SORTING_ALGO_LIBS sorting_algorithms) |
55 | | - |
56 | | -add_executable(smoke-test-longest-substring tests/smoke-test-longest-substring.cpp) |
57 | | -target_link_libraries(smoke-test-longest-substring ${GTEST_LIBS} ${STRING_ALGO_LIBS} ${SORTING_ALGO_LIBS}) |
| 19 | +add_subdirectory(algorithms_on_strings) |
| 20 | +add_subdirectory(sorting_algorithms) |
| 21 | +add_subdirectory(tests) |
58 | 22 |
|
59 | | -add_test(NAME longest-substring-test COMMAND smoke-test-longest-substring) |
60 | 23 |
|
61 | 24 |
|
0 commit comments