1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-keygen synced 2026-06-17 03:50:03 +02:00
antelope-keygen/CMakeModules/libeoskeygen.cmake
Henrik Hautakoski 47767e3443 CMakeModules/libeoskeygen.cmake: handle custom libeoskeygen via LIBEOSKEYGEN_SOURCE_DIR variable correctly.
by include()'ing the targets file. cmake only knows how to link but not to build.
The proper ways is to use add_subdirectory()
2020-03-25 17:03:22 +01:00

41 lines
1.1 KiB
CMake

# --------------------------------
# Variables
# --------------------------------
set( LIBEOSKEYGEN_GIT_URL "https://github.com/eosswedenorg/libeoskeygen.git" )
set( LIBEOSKEYGEN_WANTED_VERSION 0.1.0 )
# --------------------------------
# Macros
# --------------------------------
macro(fromGit tag)
message ("Using libeoskeygen from: ${LIBEOSKEYGEN_GIT_URL}@${tag}")
include(FetchContent)
FetchContent_Declare(libeoskeygen
GIT_REPOSITORY ${LIBEOSKEYGEN_GIT_URL}
GIT_TAG ${tag}
)
FetchContent_MakeAvailable(libeoskeygen)
endmacro()
macro(buildLocal src)
message ("Using local libeoskeygen at: ${src}")
add_subdirectory(${src} ${src}/build)
endmacro()
# If we have a local libeoskeygen
if (LIBEOSKEYGEN_SOURCE_DIR)
buildLocal( ${LIBEOSKEYGEN_SOURCE_DIR} )
else()
# Try finding the package on the system.
find_package(libeoskeygen ${LIBEOSKEYGEN_WANTED_VERSION} QUIET)
if (libeoskeygen_FOUND)
message ("Using libeoskeygen in: ${libeoskeygen_DIR}")
# Not found, download from git.
else()
fromGit( v${LIBEOSKEYGEN_WANTED_VERSION} )
endif()
endif()