fdefelici / clove-unit

Single-Header Unit Testing framework for C (interoperable with C++) with test autodiscovery feature
MIT License
46 stars 9 forks source link

CMake: Make header library interoperable with CMake's FetchContent api #104

Closed fdefelici closed 4 months ago

fdefelici commented 4 months ago

Allow clove-unit to be imported as dependenciy using cmake like this:

make_minimum_required(VERSION 3.28)
project(MyProject LANGUAGES C)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED YES)

Include(FetchContent)
FetchContent_Declare(
  clove-unit
  GIT_REPOSITORY https://github.com/fdefelici/clove-unit.git
)
FetchContent_MakeAvailable(clove-unit)

add_executable(my_test_target my_suite.c)
target_link_libraries(all_tests PRIVATE clove-unit)

Feature proposed by this PR: #103