SEAL/cmake/SEALConfig.cmake.in

133 строки
4.3 KiB
CMake

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
# Exports target SEAL::seal
#
# Creates variables:
# SEAL_FOUND : If either a static or a shared Microsoft SEAL was found
# SEAL_STATIC_FOUND : If a static Microsoft SEAL library was found
# SEAL_SHARED_FOUND : If a shared Microsoft SEAL library was found
# SEAL_C_FOUND : If a Microsoft SEAL C export library was found
# SEAL_VERSION : The full version number
# SEAL_VERSION_MAJOR : The major version number
# SEAL_VERSION_MINOR : The minor version number
# SEAL_VERSION_PATCH : The patch version number
# SEAL_DEBUG : Set to non-zero value if library is compiled with extra debugging code (very slow!)
# SEAL_BUILD_TYPE : The build type (e.g., "Release" or "Debug")
# SEAL_USE_CXX17 : Set to non-zero value if library is compiled as C++17 instead of C++14
# SEAL_ENFORCE_HE_STD_SECURITY : Set to non-zero value if library is compiled to enforce at least
# a 128-bit security level based on HomomorphicEncryption.org security estimates
# SEAL_USE_INTEL_HEXL: Set to non-zero value if library is compiled with Intel HEXL support
# SEAL_USE_MSGSL : Set to non-zero value if library is compiled with Microsoft GSL support
# SEAL_USE_ZLIB : Set to non-zero value if library is compiled with ZLIB support
# SEAL_USE_ZSTD : Set to non-zero value if library is compiled with Zstandard support
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
macro(seal_find_dependency dep)
find_dependency(${dep})
if(NOT ${dep}_FOUND)
if(NOT SEAL_FIND_QUIETLY)
message(WARNING "Could not find dependency `${dep}` required by this configuration")
endif()
set(SEAL_FOUND FALSE)
return()
endif()
endmacro()
set(SEAL_FOUND FALSE)
set(SEAL_STATIC_FOUND FALSE)
set(SEAL_SHARED_FOUND FALSE)
set(SEAL_C_FOUND FALSE)
set(SEAL_VERSION @SEAL_VERSION@)
set(SEAL_VERSION_MAJOR @SEAL_VERSION_MAJOR@)
set(SEAL_VERSION_MINOR @SEAL_VERSION_MINOR@)
set(SEAL_VERSION_PATCH @SEAL_VERSION_PATCH@)
set(SEAL_BUILD_TYPE @CMAKE_BUILD_TYPE@)
set(SEAL_DEBUG @SEAL_DEBUG@)
set(SEAL_USE_CXX17 @SEAL_USE_CXX17@)
set(SEAL_ENFORCE_HE_STD_SECURITY @SEAL_ENFORCE_HE_STD_SECURITY@)
set(SEAL_USE_INTEL_HEXL @SEAL_USE_INTEL_HEXL@)
set(SEAL_USE_MSGSL @SEAL_USE_MSGSL@)
set(SEAL_USE_ZLIB @SEAL_USE_ZLIB@)
set(SEAL_USE_ZSTD @SEAL_USE_ZSTD@)
set(SEAL_BUILD_DEPS @SEAL_BUILD_DEPS@)
if(SEAL_USE_MSGSL AND NOT SEAL_BUILD_DEPS)
seal_find_dependency(Microsoft.GSL)
endif()
if(SEAL_USE_ZLIB AND NOT SEAL_BUILD_DEPS)
seal_find_dependency(ZLIB)
endif()
if(SEAL_USE_ZSTD AND NOT SEAL_BUILD_DEPS)
seal_find_dependency(zstd)
if(NOT TARGET zstd::libzstd_static)
if(TARGET libzstd)
get_target_property(libzstd_type libzstd TYPE)
if(libzstd_type STREQUAL "SHARED")
set(zstd_static "libzstd")
else()
message(FATAL_ERROR "ZSTD must be static")
endif()
endif()
endif()
endif()
# Add the current directory to the module search path
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
seal_find_dependency(Threads)
include(${CMAKE_CURRENT_LIST_DIR}/SEALTargets.cmake)
if(TARGET SEAL::seal)
set(SEAL_FOUND TRUE)
set(SEAL_STATIC_FOUND TRUE)
endif()
if(TARGET SEAL::seal_shared)
set(SEAL_FOUND TRUE)
set(SEAL_SHARED_FOUND TRUE)
endif()
if(TARGET SEAL::sealc)
set(SEAL_FOUND TRUE)
set(SEAL_C_FOUND TRUE)
endif()
if(SEAL_FOUND)
if(NOT SEAL_FIND_QUIETLY)
message(STATUS "Microsoft SEAL -> Version ${SEAL_VERSION} detected")
endif()
if(SEAL_DEBUG AND NOT SEAL_FIND_QUIETLY)
message(STATUS "Performance warning: Microsoft SEAL compiled in debug mode")
endif()
set(SEAL_TARGETS_AVAILABLE "Microsoft SEAL -> Targets available:")
if(SEAL_STATIC_FOUND)
string(APPEND SEAL_TARGETS_AVAILABLE " SEAL::seal")
endif()
if(SEAL_SHARED_FOUND)
string(APPEND SEAL_TARGETS_AVAILABLE " SEAL::seal_shared")
endif()
if(SEAL_C_FOUND)
string(APPEND SEAL_TARGETS_AVAILABLE " SEAL::sealc")
endif()
if(NOT SEAL_FIND_QUIETLY)
message(STATUS ${SEAL_TARGETS_AVAILABLE})
endif()
else()
if(NOT SEAL_FIND_QUIETLY)
message(STATUS "Microsoft SEAL -> NOT FOUND")
endif()
endif()