blob: 71b5b35c31a75e26924ead564f6e2d895c9af484 [file] [log] [blame]
#
# Copyright The Transfer List Library Contributors
#
# SPDX-License-Identifier: MIT OR GPL-2.0-or-later
#
cmake_minimum_required(VERSION 3.15)
project(libtl VERSION 0.9 LANGUAGES C CXX ASM)
#
# Set global flags.
#
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_EXTENSIONS TRUE)
add_library(cxx_compiler_flags INTERFACE)
target_compile_features(cxx_compiler_flags INTERFACE cxx_std_11)
SET(TARGET_GROUP release CACHE STRING "Specify the Build Target [\"release\" by default]")
add_library(tl STATIC "${CMAKE_CURRENT_SOURCE_DIR}/src/transfer_list.c")
target_include_directories(tl PUBLIC include)
target_link_libraries(tl PUBLIC cxx_compiler_flags)
if(TARGET_GROUP STREQUAL test)
include(CTest)
# Check if local unity/ directory exists
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/unity/CMakeLists.txt")
message(STATUS "Using local Unity framework.")
add_subdirectory(unity)
else()
message(STATUS "Fetching Unity framework using FetchContent...")
include(FetchContent)
FetchContent_Declare(
unity
GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity.git
GIT_TAG master
)
FetchContent_MakeAvailable(unity)
endif()
add_subdirectory(test)
endif()