2024-11-15 08:38:38 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2024-06-26 08:57:23 +00:00
|
|
|
project(SimpleArchiver C)
|
|
|
|
|
2024-11-25 08:18:30 +00:00
|
|
|
set(SimpleArchiver_VERSION 1.8)
|
2024-06-26 08:57:23 +00:00
|
|
|
|
|
|
|
set(SimpleArchiver_SOURCES
|
|
|
|
src/main.c
|
2024-06-27 02:57:29 +00:00
|
|
|
src/parser.c
|
2024-07-02 05:25:01 +00:00
|
|
|
src/helpers.c
|
2024-07-16 07:16:58 +00:00
|
|
|
src/archiver.c
|
2024-06-28 04:54:38 +00:00
|
|
|
src/data_structures/linked_list.c
|
2024-06-28 08:31:34 +00:00
|
|
|
src/data_structures/hash_map.c
|
2024-06-30 06:32:17 +00:00
|
|
|
src/data_structures/priority_heap.c
|
2024-06-28 08:31:34 +00:00
|
|
|
src/algorithms/linear_congruential_gen.c
|
2024-06-26 08:57:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
add_compile_options(
|
|
|
|
-Wall -Wextra -Wpedantic -Wno-missing-braces
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:-Weffc++>
|
2024-06-27 02:57:29 +00:00
|
|
|
$<$<CONFIG:DEBUG>:-Og>
|
2024-06-26 08:57:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
message(STATUS "Setting build type to 'Debug', none was specified.")
|
|
|
|
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
|
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
|
|
|
endif()
|
|
|
|
|
2024-06-27 08:20:46 +00:00
|
|
|
add_executable(simplearchiver ${SimpleArchiver_SOURCES})
|
2024-06-28 04:54:38 +00:00
|
|
|
|
2024-09-26 08:31:06 +00:00
|
|
|
target_compile_options(simplearchiver PUBLIC
|
|
|
|
-Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
|
|
|
-Werror=format-security
|
|
|
|
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
|
|
|
-D_GLIBCXX_ASSERTIONS
|
|
|
|
-fstrict-flex-arrays=3
|
|
|
|
-fstack-clash-protection -fstack-protector-strong
|
|
|
|
-Wl,-z,nodlopen -Wl,-z,noexecstack
|
|
|
|
-Wl,-z,relro -Wl,-z,now
|
|
|
|
-Wl,--as-needed -Wl,--no-copy-dt-needed-entries
|
|
|
|
-fPIE -pie
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_options(simplearchiver PUBLIC
|
|
|
|
-Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
|
|
|
-Werror=format-security
|
|
|
|
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
|
|
|
-D_GLIBCXX_ASSERTIONS
|
|
|
|
-fstrict-flex-arrays=3
|
|
|
|
-fstack-clash-protection -fstack-protector-strong
|
|
|
|
-Wl,-z,nodlopen -Wl,-z,noexecstack
|
|
|
|
-Wl,-z,relro -Wl,-z,now
|
|
|
|
-Wl,--as-needed -Wl,--no-copy-dt-needed-entries
|
|
|
|
-fPIE -pie
|
|
|
|
)
|
|
|
|
|
|
|
|
# Inhibit format-string-related warning in src/archiver.c .
|
|
|
|
set_source_files_properties(src/archiver.c
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS -Wno-format-nonliteral
|
|
|
|
)
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
|
|
target_compile_options(simplearchiver PUBLIC
|
|
|
|
-fno-delete-null-pointer-checks -fno-strict-overflow
|
|
|
|
-fno-strict-aliasing -ftrivial-auto-var-init=zero
|
|
|
|
)
|
|
|
|
target_link_options(simplearchiver PUBLIC
|
|
|
|
-fno-delete-null-pointer-checks -fno-strict-overflow
|
|
|
|
-fno-strict-aliasing -ftrivial-auto-var-init=zero
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-06-28 04:54:38 +00:00
|
|
|
add_executable(test_datastructures
|
2024-06-28 08:31:34 +00:00
|
|
|
src/data_structures/test.c
|
|
|
|
src/data_structures/linked_list.c
|
|
|
|
src/data_structures/hash_map.c
|
2024-06-30 06:32:17 +00:00
|
|
|
src/data_structures/priority_heap.c
|
2024-06-28 08:31:34 +00:00
|
|
|
src/algorithms/linear_congruential_gen.c
|
2024-06-28 04:54:38 +00:00
|
|
|
)
|
2024-07-01 06:13:06 +00:00
|
|
|
|
|
|
|
add_executable(test_simplearchiver
|
|
|
|
src/test.c
|
|
|
|
src/parser.c
|
2024-07-02 05:25:01 +00:00
|
|
|
src/helpers.c
|
2024-10-02 04:15:30 +00:00
|
|
|
src/archiver.c
|
2024-07-03 10:54:44 +00:00
|
|
|
src/algorithms/linear_congruential_gen.c
|
|
|
|
src/data_structures/linked_list.c
|
|
|
|
src/data_structures/hash_map.c
|
2024-10-08 06:12:44 +00:00
|
|
|
src/data_structures/priority_heap.c
|
2024-07-01 06:13:06 +00:00
|
|
|
)
|