evmc/CMakeLists.txt

111 lines
2.7 KiB
CMake
Raw Normal View History

2018-04-23 21:22:39 +00:00
# EVMC: Ethereum Client-VM Connector API.
# Copyright 2016-2019 The EVMC Authors.
2019-01-18 12:49:54 +00:00
# Licensed under the Apache License, Version 2.0.
2018-04-12 09:01:01 +00:00
cmake_minimum_required(VERSION 3.10)
2019-12-13 12:20:35 +00:00
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
2018-03-28 13:19:41 +00:00
if(TARGET evmc)
# The evmc library has been already created (probably by other submodule).
return()
endif()
2018-04-12 09:01:01 +00:00
include(cmake/cable/bootstrap.cmake)
2018-06-19 09:25:19 +00:00
include(CableBuildType)
include(CableCompilerSettings)
include(CablePackage)
include(CMakeDependentOption)
2018-06-19 09:25:19 +00:00
include(CMakePackageConfigHelpers)
2018-04-18 14:23:07 +00:00
include(GNUInstallDirs)
2018-04-12 09:01:01 +00:00
option(EVMC_INSTALL "Enable EVMC installation (e.g. make install)" ON)
option(EVMC_TESTING "Build everything (libraries, tools, examples, internal tests)" OFF)
cmake_dependent_option(EVMC_TOOLS "Build EVMC tools" OFF
"NOT EVMC_TESTING" ON)
cmake_dependent_option(EVMC_EXAMPLES "Build EVMC examples" OFF
"NOT EVMC_TESTING" ON)
option(HUNTER_ENABLED "Enable Hunter package manager support" ${EVMC_TOOLS})
if(HUNTER_ENABLED)
2019-03-11 20:58:21 +00:00
set(HUNTER_CONFIGURATION_TYPES Release CACHE STRING "Build type of Hunter packages")
2019-01-18 12:49:54 +00:00
include(HunterGate)
2019-05-06 09:23:12 +00:00
include(Hunter/init)
2019-01-18 12:49:54 +00:00
include(defaults/HunterCacheServers)
endif()
2018-04-12 09:01:01 +00:00
2019-05-15 09:59:36 +00:00
cable_set_build_type(DEFAULT Release CONFIGURATION_TYPES Debug Release)
2019-01-15 13:08:54 +00:00
2018-03-28 13:19:41 +00:00
project(evmc)
set(PROJECT_VERSION 7.2.0-alpha.0)
2018-03-28 13:19:41 +00:00
2018-04-19 08:26:46 +00:00
cable_configure_compiler(NO_STACK_PROTECTION)
2019-12-06 21:10:00 +00:00
if(CABLE_COMPILER_CLANG)
set(CMAKE_C_FLAGS_COVERAGE "-fprofile-instr-generate -fcoverage-mapping")
set(CMAKE_CXX_FLAGS_COVERAGE "-fprofile-instr-generate -fcoverage-mapping")
elseif(CABLE_COMPILER_GNU)
set(CMAKE_C_FLAGS_COVERAGE "--coverage")
set(CMAKE_CXX_FLAGS_COVERAGE "--coverage")
endif()
set(include_dir ${PROJECT_SOURCE_DIR}/include)
add_subdirectory(lib)
if(EVMC_TOOLS)
add_subdirectory(tools)
endif()
if(EVMC_EXAMPLES)
add_subdirectory(examples)
2018-04-12 09:01:24 +00:00
endif()
if(EVMC_TESTING)
enable_testing()
add_subdirectory(test)
2018-03-28 13:19:41 +00:00
endif()
2018-04-18 14:32:24 +00:00
2018-06-19 09:25:19 +00: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
)
2019-07-23 09:57:21 +00:00
if(EVMC_INSTALL)
install(DIRECTORY include/evmc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
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
cmake/EVMC.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc
)
endif()
2018-04-18 14:32:24 +00:00
2019-08-05 20:58:54 +00:00
set(
CPACK_SOURCE_IGNORE_FILES
/\\\\.git/
/\\\\.idea/
/build/
/cmake-build-.*/
/bindings/
/Cargo.lock
/Cargo.toml
/target/
)
cable_add_archive_package()