-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
70 lines (55 loc) · 2.17 KB
/
CMakeLists.txt
File metadata and controls
70 lines (55 loc) · 2.17 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
include(ExternalProject)
cmake_minimum_required(VERSION 3.17)
project(mystorecpp VERSION 1.0)
set(CMAKE_CXX_FLAGS "-Wall -pedantic -g -O3")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(ClientTestFiles src/mystorecpp.cpp tests/testclient.cpp)
set(ClientFiles src/mystorecpp.cpp)
ExternalProject_Add(cpp-dotenv
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/cpp-dotenv
GIT_REPOSITORY https://github.com/adeharo9/cpp-dotenv.git
INSTALL_COMMAND ""
)
ExternalProject_Add(thrift-file
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/thriftfile
GIT_REPOSITORY https://github.com/gwint/mystore-thrift-file.git
INSTALL_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/gen-cpp
${CMAKE_CURRENT_SOURCE_DIR}/gen-cpp/ReplicaService.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gen-cpp/replicaservice_types.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gen-cpp/replicaservice_constants.cpp
COMMAND thrift -r --gen cpp ${CMAKE_CURRENT_SOURCE_DIR}/thriftfile/src/thrift-file/replicaservice.thrift
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/thriftfile/src/thrift-file/replicaservice.thrift
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_library(ThriftFileCompilation
${CMAKE_CURRENT_SOURCE_DIR}/gen-cpp/ReplicaService.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gen-cpp/replicaservice_types.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gen-cpp/replicaservice_constants.cpp
)
add_library(MyStoreClient ${ClientFiles})
target_include_directories(MyStoreClient
PUBLIC cpp-dotenv/src/cpp-dotenv/
PUBLIC gen-cpp
PUBLIC include
)
add_executable(MyStoreTests ${ClientTestFiles})
target_include_directories(MyStoreTests
PUBLIC cpp-dotenv/src/cpp-dotenv/
PUBLIC gen-cpp
PUBLIC include
)
add_dependencies(ThriftFileCompilation thrift-file)
add_dependencies(MyStoreClient cpp-dotenv)
add_dependencies(MyStoreClient thrift-file)
target_link_libraries(MyStoreClient ThriftFileCompilation)
target_link_libraries(MyStoreClient thrift)
add_dependencies(MyStoreTests cpp-dotenv)
add_dependencies(MyStoreTests thrift-file)
target_link_libraries(MyStoreTests ThriftFileCompilation)
target_link_libraries(MyStoreTests thrift)