Skip to content

Conversation

kgamora
Copy link

@kgamora kgamora commented May 31, 2025

Add the ability to include and build the project as a dependency using CMake

Example project that uses this library with CMake:

./CMakeLists.txt

cmake_minimum_required(VERSION 3.10)

project(dymmy-proj)

add_subdirectory(contrib)

add_executable(dummy
    src/main.cpp
)

target_link_libraries(dummy
    PRIVATE
        libstud-uuid
)

./contrib/CMakeLists.txt

cmake_minimum_required(VERSION 3.10)

include(FetchContent)

FetchContent_Declare(
  libstud-uuid
  GIT_REPOSITORY https://github.com/kgamora/libstud-uuid # As it's not in main for now, example uses my fork
  GIT_TAG        origin/add-cmake-support                                     # This is not standard for the same reason
)

FetchContent_MakeAvailable(libstud-uuid)

./main.cpp
Content of tests/basics/driver.cxx

To build and run:

cmake -B build && cd build && make && ./dummy && echo "test was successful"

@boris-kolpackov
Copy link
Contributor

Please see earlier PR with the same aim: #2

The position expressed has not changed and the offer to point to a fork where you will maintain CMake support stands.

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