2022-11-20 19:13:37 +00:00
|
|
|
cmake_minimum_required(VERSION 3.8..3.22)
|
|
|
|
|
2023-01-26 21:14:22 +00:00
|
|
|
project(minitar LANGUAGES C VERSION 1.5.0)
|
2022-11-20 19:13:37 +00:00
|
|
|
|
2023-01-29 21:08:13 +00:00
|
|
|
option(MINITAR_IGNORE_UNSUPPORTED_TYPES "Skip past entries that have unsupported types instead of panicking (deprecated)" OFF)
|
2022-12-30 10:13:21 +00:00
|
|
|
|
2022-11-20 19:13:37 +00:00
|
|
|
set(SOURCES
|
|
|
|
src/tar.c
|
|
|
|
src/util.c
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(minitar STATIC ${SOURCES})
|
|
|
|
|
2022-12-30 10:13:21 +00:00
|
|
|
if(MINITAR_IGNORE_UNSUPPORTED_TYPES)
|
2023-01-29 21:08:13 +00:00
|
|
|
message(WARNING "MINITAR_IGNORE_UNSUPPORTED_TYPES is deprecated, since there are no unsupported types anymore")
|
2022-12-30 10:13:21 +00:00
|
|
|
endif()
|
|
|
|
|
2022-11-23 20:22:40 +00:00
|
|
|
target_include_directories(minitar PUBLIC ${CMAKE_CURRENT_LIST_DIR}) # for minitar.h
|
|
|
|
|
2022-11-20 19:13:37 +00:00
|
|
|
set_target_properties(minitar PROPERTIES OUTPUT_NAME mtar)
|
|
|
|
|
2022-12-25 11:59:09 +00:00
|
|
|
set_target_properties(minitar PROPERTIES C_STANDARD 11)
|
|
|
|
set_target_properties(minitar PROPERTIES C_STANDARD_REQUIRED ON)
|
|
|
|
|
2022-11-20 19:13:37 +00:00
|
|
|
if (MSVC)
|
|
|
|
target_compile_options(minitar PRIVATE /W4 /WX)
|
|
|
|
else()
|
2022-12-25 12:06:02 +00:00
|
|
|
target_compile_options(minitar PRIVATE -Wall -Wextra -pedantic -Werror)
|
2022-11-20 19:13:37 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
install(TARGETS minitar DESTINATION lib)
|
2023-01-19 21:30:23 +00:00
|
|
|
install(FILES minitar.h DESTINATION include)
|
|
|
|
|
|
|
|
add_subdirectory(examples)
|