Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 57 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
# Copyright (c) 2016-2020 Alexey Gruzdev
#

cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.15)

if(NOT YATO_NO_PROJECT_FOLDERS)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()

set(YATO_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

project(Yato)
project(Yato VERSION 1.2.0 LANGUAGES CXX)

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

#==========================================
# Output
Expand Down Expand Up @@ -48,11 +51,6 @@ if(MSVC)
list(APPEND yato_extra_sources ${YATO_SOURCE_DIR}/extras/yato.natvis)
endif()

add_custom_target(Yato SOURCES ${yato_sources}
${yato_extra_sources}
)
set_property(TARGET Yato PROPERTY FOLDER "Modules")

#==========================================
# Targets

Expand All @@ -78,6 +76,57 @@ if(YATO_BUILD_ACTORS)
list(APPEND YATO_INCLUDE_DIRS "${YATO_SOURCE_DIR}/modules/actors")
endif()


add_library(Yato INTERFACE)

set_property(TARGET Yato PROPERTY FOLDER "Modules")

target_sources(Yato INTERFACE
FILE_SET HEADERS
BASE_DIRS ${YATO_SOURCE_DIR}/include
FILES ${yato_sources}
)

target_include_directories(Yato INTERFACE
$<BUILD_INTERFACE:${YATO_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

#==========================================
# Installation

# Generate and install CMake config files.
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/YatoConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)


configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/YatoConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/YatoConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Yato
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/YatoConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/YatoConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Yato
)

# Install header-only library.
install(TARGETS Yato
EXPORT YatoTargets
FILE_SET HEADERS
)

install(EXPORT YatoTargets
FILE YatoTargets.cmake
NAMESPACE Yato::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Yato
)

#==========================================
# Tests

Expand All @@ -86,7 +135,7 @@ if(YATO_BUILD_TESTS)
add_subdirectory(./tests)
endif()

option(YATO_BUILD_PERFORMANCE_TESTS "Buidl performance tests" OFF)
option(YATO_BUILD_PERFORMANCE_TESTS "Build performance tests" OFF)
if(YATO_BUILD_PERFORMANCE_TESTS)
add_subdirectory(./perf_tests)
endif()
Expand Down
3 changes: 3 additions & 0 deletions cmake/YatoConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/YatoTargets.cmake")
1 change: 1 addition & 0 deletions cmake/dependency.gbenchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if(NOT TARGET benchmark)
set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR})

set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
set(HAVE_LIB_RT OFF)
#set(HAVE_STD_REGEX ON)

Expand Down
1 change: 1 addition & 0 deletions cmake/dependency.gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if(NOT TARGET gtest)
set(BUILD_GTEST ON CACHE BOOL "gtest setup" FORCE)
set(BUILD_GMOCK OFF CACHE BOOL "gtest setup" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "gtest setup" FORCE)
set(INSTALL_GTEST OFF CACHE BOOL "gtest setup" FORCE)
set(gtest_disable_pthreads ON CACHE BOOL "gtest setup" FORCE)
set(gtest_force_shared_crt ON CACHE BOOL "gtest setup" FORCE)

Expand Down