libstud-uuid icon indicating copy to clipboard operation
libstud-uuid copied to clipboard

Add CMake support

Open kgamora opened this issue 7 months ago • 1 comments

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"

kgamora avatar May 31 '25 20:05 kgamora

Please see earlier PR with the same aim: https://github.com/libstud/libstud-uuid/pull/2

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

boris-kolpackov avatar Jun 03 '25 11:06 boris-kolpackov