@remill
You can also add a FetchContent CMake declaration that will build your library during compilation. Here is an example for yaml-cpp
include(FetchContent)
# Fetch yaml-cpp from GitHub
FetchContent_Declare(
yaml-cpp
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
GIT_TAG yaml-cpp-0.6.3
)
# Disable yaml-cpp tests
set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(YAML_BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE) #cross 4.0 quits the chat if building static
FetchContent_MakeAvailable(yaml-cpp)
# Confirm target exists
if (TARGET yaml-cpp)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()
install(FILES
${yaml-cpp_BINARY_DIR}/libyaml-cpp.so
${yaml-cpp_BINARY_DIR}/libyaml-cpp.so.0.6
${yaml-cpp_BINARY_DIR}/libyaml-cpp.so.0.6.3
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)