vcpkg/ports/murmurhash/CMakeLists.txt
2020-03-09 08:33:45 -07:00

61 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.14)
set(VERSION "1.0.0")
project(murmurhash LANGUAGES CXX VERSION ${VERSION})
set(CMAKE_CXX_STANDARD 17)
add_library(murmurhash
src/MurmurHash2.cpp
src/MurmurHash3.cpp
)
target_include_directories(murmurhash SYSTEM PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/src)
set(MURMUR_HEADERS
src/MurmurHash2.h
src/MurmurHash3.h
)
set_target_properties(murmurhash PROPERTIES
PUBLIC_HEADER "${MURMUR_HEADERS}"
)
#Configuration
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")
include(CMakePackageConfigHelpers)
# Configure '<PROJECT-NAME>ConfigVersion.cmake'
# Use:
# * PROJECT_VERSION
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion
)
# Configure '<PROJECT-NAME>Config.cmake'
# Use variables:
# * TARGETS_EXPORT_NAME
# * PROJECT_NAME
configure_package_config_file(
"${CMAKE_SOURCE_DIR}/Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)
#Installation
install(TARGETS murmurhash
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
INCLUDES DESTINATION "include")
install(FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)
install(EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)