-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
71 lines (55 loc) · 1.81 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.14)
project(search VERSION 0.1.1)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
include(FetchContent)
function(fetch_if_not_exists name git_repo git_tag)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/vendor/${name})
FetchContent_Declare(
${name}
GIT_REPOSITORY ${git_repo}
GIT_TAG ${git_tag}
SOURCE_DIR ${CMAKE_SOURCE_DIR}/vendor/${name}
)
FetchContent_MakeAvailable(${name})
else()
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/${name})
endif()
endfunction()
fetch_if_not_exists(minizip
https://github.com/nmoinvaz/minizip.git
4.0.7
)
add_executable(search src/Search.cc)
target_link_libraries(search PRIVATE minizip)
target_include_directories(search PRIVATE
${CMAKE_SOURCE_DIR}/vendor/minizip
${CMAKE_SOURCE_DIR}/vendor/minizip/zlib
${CMAKE_SOURCE_DIR}/vendor/tbb/include
)
target_compile_options(search PRIVATE
$<$<CONFIG:Release>:-Os>
$<$<CONFIG:Debug>:-Og>
)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_link_options(search PRIVATE
$<$<CONFIG:Release>:-s>
)
endif()
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
set_target_properties(search PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_VENDOR "Volker Schwaberow")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Rockyou2024 search tool")
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_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
install(TARGETS search
RUNTIME DESTINATION bin
COMPONENT applications)
include(CPack)