-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
72 lines (55 loc) · 1.84 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
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required(VERSION 3.10)
set(PATCH_VERSION "1" CACHE INTERNAL "Patch version")
set(PROJECT_VESRION 0.0.${PATCH_VERSION})
project(otus_editor VERSION ${PROJECT_VESRION})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS_INIT} -std=c++17 -fPIC")
message( "CMAKE_BINARY_DIR : " ${CMAKE_BINARY_DIR} )
include_directories(SYSTEM ./include)
# add source files
file(GLOB SOURCES "src/*/*.cpp")
add_library(otus_editor_lib SHARED ${SOURCES})
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} otus_editor_lib)
find_package(GTest REQUIRED)
add_executable(test_main tests/test_main.cpp)
target_include_directories(test_main
PRIVATE
"${CMAKE_BINARY_DIR}"
"${CMAKE_HOME_DIRECTORY}"
"${GTEST_INCLUDE_DIR}"
)
target_link_libraries(test_main
${GTEST_LIBRARIES}
${GTEST_MAIN_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
if (MSVC)
target_compile_options(otus_editor_lib PRIVATE
/W4
)
target_compile_options(${PROJECT_NAME} PRIVATE
/W4
)
target_compile_options(test_main PRIVATE
/W4)
else ()
target_compile_options(otus_editor_lib PRIVATE
-Wall -Wextra -pedantic -Werror
)
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall -Wextra -pedantic -Werror
)
target_compile_options(test_main PRIVATE
-Wall -Wextra -pedantic -Werror
)
endif()
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_CONTACT [email protected])
include(CPack)
enable_testing()
add_test(test_main test_main)