cieter/CMakeLists.txt

33 lines
715 B
CMake
Raw Normal View History

2022-12-03 22:50:32 +01:00
cmake_minimum_required(VERSION 3.20)
2022-12-03 23:27:44 +01:00
project(cieter C)
2022-12-03 22:50:32 +01:00
set(CMAKE_C_STANDARD 17)
find_package(LibArchive REQUIRED)
2022-12-04 09:01:32 +01:00
add_subdirectory(vendor/unity)
include_directories(include vendor/unity/src)
2022-12-03 22:50:32 +01:00
2022-12-03 23:27:44 +01:00
file(GLOB CIETER_SRCS src/cieter/**.c)
2022-12-03 22:50:32 +01:00
if(CMAKE_BUILD_TYPE STREQUAL Release)
add_compile_options(-O3 -flto)
endif()
2022-12-03 23:27:44 +01:00
add_library(cieter SHARED ${CIETER_SRCS})
2022-12-04 09:01:32 +01:00
target_link_libraries(cieter LibArchive::LibArchive)
if(CMAKE_BUILD_TYPE MATCHES "^Test")
enable_testing()
add_subdirectory(test)
endif()
2022-12-03 23:27:44 +01:00
option(BUILD_CIETERD "Build cieterd binary" ON)
if (BUILD_CIETERD)
file(GLOB CIETERD_SRCS src/cieterd/**.c)
add_executable(cieterd ${CIETERD_SRCS})
2022-12-04 09:01:32 +01:00
target_link_libraries(cieterd cieter)
2022-12-03 23:27:44 +01:00
endif()