-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
48 lines (36 loc) · 1.34 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
# build instructions--
# cmake -S . -B build
# cmake --build build
# cmake --install build
cmake_minimum_required(VERSION 3.25)
project(tidesdb_cpp CXX)
set(CMAKE_CXX_STANDARD 20)
set(PROJECT_VERSION 0.1.0)
add_compile_options(-Wextra -Wall -Werror)
find_library(LIBRARY_TIDEDB NAMES tidesdb REQUIRED) # require tidesdb library
add_library(tidesdb_cpp SHARED tidesdb.cpp)
install(FILES tidesdb.hpp
DESTINATION include)
if(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
target_include_directories(tidesdb_cpp PUBLIC /opt/homebrew/include)
target_link_directories(tidesdb_cpp PUBLIC /opt/homebrew/lib)
elseif(APPLE)
target_include_directories(tidesdb_cpp PUBLIC /usr/local/include)
target_link_directories(tidesdb_cpp PUBLIC /usr/local/lib)
endif()
target_link_libraries(tidesdb_cpp PUBLIC ${LIBRARY_TIDEDB})
install(TARGETS tidesdb_cpp
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
add_executable(tests test/tests.cpp)
target_link_libraries(tests GTest::gtest_main tidesdb_cpp ${LIBRARY_TIDEDB})
include(GoogleTest)
gtest_discover_tests(tests)