-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
56 lines (43 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
cmake_minimum_required(VERSION 3.22)
project(dictionary CXX)
option(USE_ASAN "Use address sanitizer" FALSE)
option(BUILD_TESTS TRUE)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
find_package(FLTK 1.4 REQUIRED)
find_package(OpenSSL REQUIRED)
add_executable(dictionary "src/main.cpp")
add_executable(save_words "src/save_words.cpp")
if (NOT $<CONFIG:Debug>)
set_target_properties(dictionary PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE)
include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
if (result)
set_target_properties(dictionary PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
set_target_properties(dictionary PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
else()
message(WARNING "IPO is not supported. Error: ${output}")
endif()
endif()
target_compile_features(dictionary PUBLIC cxx_std_23)
set_target_properties(dictionary PROPERTIES CXX_EXTENSIONS FALSE)
target_compile_features(save_words PUBLIC cxx_std_23)
set_target_properties(save_words PROPERTIES CXX_EXTENSIONS FALSE)
if (MSVC)
target_compile_options(dictionary PRIVATE /W4)
else()
target_compile_options(dictionary PRIVATE -Wall -Wextra -pedantic)
endif()
set_target_properties(dictionary PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_include_directories(dictionary PUBLIC "include")
target_link_libraries(dictionary PUBLIC fltk::fltk)
target_include_directories(dictionary PUBLIC ${OPENSSL_INCLUDE_DIR})
target_link_libraries(dictionary PUBLIC ${OPENSSL_LIBRARIES})
target_include_directories(save_words PUBLIC "include")
target_include_directories(save_words PUBLIC ${OPENSSL_INCLUDE_DIR})
target_link_libraries(save_words PUBLIC ${OPENSSL_LIBRARIES})
if (USE_ASAN)
target_compile_options(dictionary PRIVATE -fsanitize=address)
target_link_options(dictionary PRIVATE -fsanitize=address)
endif()