evmc/CMakeLists.txt

83 lines
2.1 KiB
CMake
Raw Normal View History

2018-04-23 23:22:39 +02:00
# EVMC: Ethereum Client-VM Connector API.
2018-08-21 09:44:18 +02:00
# Copyright 2018 The EVMC Authors.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.
2018-04-12 11:01:01 +02:00
2018-03-28 15:19:41 +02:00
cmake_minimum_required(VERSION 3.5)
if(TARGET evmc)
# The evmc library has been already created (probably by other submodule).
return()
endif()
2018-06-08 12:31:22 +02:00
option(EVMC_TESTING "Build EVMC tests and test tools" OFF)
option(EVMC_EXAMPLES "Build EVMC examples" OFF)
option(HUNTER_ENABLED "Enable Hunter package manager support" "${EVMC_TESTING}")
2018-04-23 23:22:39 +02:00
2018-04-12 11:01:01 +02:00
include(cmake/cable/bootstrap.cmake)
2018-06-19 11:25:19 +02:00
include(CableBuildType)
include(CableCompilerSettings)
2018-06-19 11:25:19 +02:00
include(CMakePackageConfigHelpers)
2018-04-12 11:01:01 +02:00
include(HunterGate)
2018-04-18 16:23:07 +02:00
include(GNUInstallDirs)
2018-04-12 11:01:01 +02:00
include(defaults/HunterCacheServers)
include(HunterConfig)
2018-04-12 11:01:01 +02:00
2018-03-28 15:19:41 +02:00
project(evmc)
set(PROJECT_VERSION 5.2.0-dev)
2018-03-28 15:19:41 +02:00
2018-06-19 11:25:19 +02:00
cable_set_build_type(DEFAULT Release CONFIGURATION_TYPES Debug Release)
2018-04-19 10:26:46 +02:00
cable_configure_compiler(NO_STACK_PROTECTION)
set(include_dir ${PROJECT_SOURCE_DIR}/include)
2018-03-28 15:19:41 +02:00
add_library(evmc INTERFACE)
2018-06-07 12:07:34 +02:00
add_library(evmc::evmc ALIAS evmc)
2018-06-19 11:25:19 +02:00
target_include_directories(evmc INTERFACE $<BUILD_INTERFACE:${include_dir}>$<INSTALL_INTERFACE:include>)
install(TARGETS evmc EXPORT evmcTargets)
2018-03-28 15:19:41 +02:00
2018-04-18 16:23:07 +02:00
install(DIRECTORY include/evmc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
add_subdirectory(lib)
2018-06-08 12:31:22 +02:00
if(EVMC_TESTING)
2018-04-11 17:36:54 +02:00
enable_testing()
2018-04-12 11:01:24 +02:00
add_subdirectory(test)
endif()
2018-06-08 12:31:22 +02:00
if(EVMC_EXAMPLES)
2018-03-28 15:19:41 +02:00
add_subdirectory(examples)
endif()
2018-04-18 16:32:24 +02:00
2018-06-19 11:25:19 +02:00
write_basic_package_version_file(evmcConfigVersion.cmake COMPATIBILITY ExactVersion)
configure_package_config_file(
cmake/Config.cmake.in
evmcConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc
)
install(
EXPORT evmcTargets
NAMESPACE evmc::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/evmcConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/evmcConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc
)
2018-04-18 16:32:24 +02:00
if(WIN32)
set(CPACK_GENERATOR ZIP)
else()
set(CPACK_GENERATOR TGZ)
endif()
string(TOLOWER ${CMAKE_SYSTEM_NAME} system_name)
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION}-${system_name})
set(CPACK_PACKAGE_CHECKSUM SHA256)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)
include(CPack)