-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
60 lines (44 loc) · 1.53 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
50
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required(VERSION 3.10)
project(plus)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
include(FetchContent)
FetchContent_Declare(
structopt
GIT_REPOSITORY https://github.com/Eshanatnight/structopt
GIT_TAG v0.2.1
)
FetchContent_GetProperties(structopt)
FetchContent_MakeAvailable(structopt)
FetchContent_Declare(
subprocess
GIT_REPOSITORY https://github.com/Eshanatnight/subprocess
GIT_TAG master
)
FetchContent_GetProperties(subprocess)
FetchContent_MakeAvailable(subprocess)
if(MSVC)
# Force to always compile with W4
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
else()
# Update if necessary
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall -Wno-long-long -pedantic")
endif()
set(STRUCTOPT_SRC ${structopt_SOURCE_DIR}/src)
set(PLUS_SRC ./src/main.cpp ./src/git.cpp ./src/file_control.cpp ./src/config.cpp ./src/utils.cpp)
find_package(libgit2)
find_package(tomlplusplus)
add_executable(${PROJECT_NAME} ${PLUS_SRC})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
target_include_directories(${PROJECT_NAME} PUBLIC ${STRUCTOPT_SRC})
target_include_directories(${PROJECT_NAME} PUBLIC ./src/include)
target_link_libraries(${PROJECT_NAME} libgit2::libgit2 tomlplusplus::tomlplusplus subprocess)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# add_definitions("-DDEBUG")
target_compile_definitions(${PROJECT_NAME} PRIVATE DEBUG=1)
endif()