Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make header library available for CMake's FetchContent #103

Conversation

cprieto
Copy link
Contributor

@cprieto cprieto commented Jun 17, 2024

Now the header library is available using FetchContent, for example:

cmake_minimum_required(VERSION 3.28)
project(blah LANGUAGES C)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED YES)

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

add_executable(all_tests all_tests.c test_suite1.c)
target_link_libraries(all_tests PRIVATE CloveUnit)

@fdefelici fdefelici self-assigned this Jun 18, 2024
@fdefelici fdefelici added this to the v.2.4.5 milestone Jun 18, 2024
@fdefelici fdefelici changed the base branch from master to release_v2.4.5 June 19, 2024 08:04
@fdefelici fdefelici changed the base branch from release_v2.4.5 to 104-cmake-make-header-library-interoperable-with-cmakes-fetchcontent-api June 19, 2024 08:51
@fdefelici fdefelici removed this from the v2.4.5 milestone Jun 19, 2024
@fdefelici
Copy link
Owner

Summary of the improvements made:

  • library naming: clove-unit
  • set minimum compiler to: c_std_11
  • avoid to import development targets and test specific configuration
  • update Readme with CMAke dependency management examples

@fdefelici fdefelici merged commit 034f2af into fdefelici:104-cmake-make-header-library-interoperable-with-cmakes-fetchcontent-api Jun 19, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants