2022-01-24 03:28:16 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
|
|
|
|
set(LIB_INCLUDEDIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
|
|
|
|
# version details
|
2022-01-25 17:58:36 +00:00
|
|
|
set(LAIKA_VERSION_MAJOR 0)
|
|
|
|
set(LAIKA_VERSION_MINOR 0)
|
2022-01-24 03:28:16 +00:00
|
|
|
|
2022-01-25 17:58:36 +00:00
|
|
|
project(LaikaLib VERSION ${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR})
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
# Put CMake targets (ALL_BUILD/ZERO_CHECK) into a folder
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
2022-01-27 19:36:36 +00:00
|
|
|
set(sodium_USE_STATIC_LIBS)
|
|
|
|
find_package(Sodium)
|
|
|
|
|
2022-01-24 03:28:16 +00:00
|
|
|
# compile LaikaLib library
|
|
|
|
file(GLOB_RECURSE LIBSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
|
|
|
add_library(LaikaLib STATIC ${LIBSOURCE})
|
2022-01-27 19:36:36 +00:00
|
|
|
target_link_libraries(LaikaLib PRIVATE ${sodium_LIBRARY_RELEASE})
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
# add the version definitions and the 'DEBUG' preprocessor definition if we're compiling as Debug
|
2022-01-25 17:58:36 +00:00
|
|
|
target_compile_definitions(LaikaLib PUBLIC LAIKA_VERSION_MAJOR=${LAIKA_VERSION_MAJOR} LAIKA_VERSION_MINOR=${LAIKA_VERSION_MINOR} "$<$<CONFIG:Debug>:DEBUG>")
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
# add include directory
|
2022-01-27 19:36:36 +00:00
|
|
|
target_include_directories(LaikaLib PUBLIC ${LIB_INCLUDEDIR} ${sodium_INCLUDE_DIR})
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
# set library name
|
2022-01-25 17:58:36 +00:00
|
|
|
set_target_properties(LaikaLib PROPERTIES OUTPUT_NAME laika-${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR})
|