Skip to content

Commit

Permalink
remove libzeep
Browse files Browse the repository at this point in the history
  • Loading branch information
mhekkel committed Feb 23, 2025
1 parent 7695e68 commit 4752c59
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions cmake/FindOrFetch.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# CMake module to find a package, or fetch it if not found

function(find_or_fetch_package _package)
set(flags VERBOSE)
set(options VERSION GIT_REPOSITORY GIT_TAG)
cmake_parse_arguments(FOF_OPTIONS "${flags}" "${options}" "" ${ARGN})

if(NOT _package)
message(FATAL_ERROR "TARGET option is missing")
endif()

if(TARGET "${_package}" OR ${_package}_FOUND)
return()
endif()

find_package("${_package}" ${FOF_OPTIONS_VERSION} QUIET)

if(${_package}_FOUND)
return()
endif()

include(FetchContent)

if(NOT FOF_OPTIONS_GIT_REPOSITORY)
message("Package ${_package} not found and GIT_REPOSITORY option is missing")
endif()

if(NOT FOF_OPTIONS_GIT_TAG)
message("Package ${_package} not found and GIT_TAG option is missing")
endif()

FetchContent_Declare(
"${_package}"
GIT_REPOSITORY ${FOF_OPTIONS_GIT_REPOSITORY}
GIT_TAG ${FOF_OPTIONS_GIT_TAG})

FetchContent_MakeAvailable("${_package}")

endfunction()

0 comments on commit 4752c59

Please sign in to comment.