2021-01-09 03:37:41 +03:00
|
|
|
cmake_minimum_required(VERSION 3.4)
|
2021-05-22 16:09:56 +03:00
|
|
|
project(coz VERSION 0.2.2 LANGUAGES C CXX)
|
2021-01-08 18:27:17 +03:00
|
|
|
|
2021-01-08 20:59:15 +03:00
|
|
|
enable_testing()
|
|
|
|
|
2021-01-08 18:27:17 +03:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2021-01-22 00:17:26 +03:00
|
|
|
set(CONAN_CMAKE_SILENT_OUTPUT ON)
|
2021-01-08 18:27:17 +03:00
|
|
|
|
2021-01-22 00:17:26 +03:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake)
|
2021-01-08 18:27:17 +03:00
|
|
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
find_package(libelfin REQUIRED)
|
|
|
|
|
2021-01-21 21:53:30 +03:00
|
|
|
add_compile_options(-gdwarf-3)
|
|
|
|
|
2021-03-23 06:23:46 +03:00
|
|
|
option(INSTALL_COZ "Enable installation of coz. (Projects embedding coz may want to turn this OFF.)" ON)
|
|
|
|
|
2021-05-22 15:03:46 +03:00
|
|
|
if(INSTALL_COZ)
|
|
|
|
include(GNUInstallDirs)
|
2021-05-22 16:09:56 +03:00
|
|
|
include(CMakePackageConfigHelpers)
|
2021-05-22 15:03:46 +03:00
|
|
|
install(PROGRAMS coz DESTINATION bin)
|
|
|
|
install(FILES LICENSE.md DESTINATION licenses)
|
2021-05-22 16:09:56 +03:00
|
|
|
configure_package_config_file(
|
|
|
|
cmake/coz-profilerConfig.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/coz-profilerConfig.cmake
|
|
|
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
|
|
|
write_basic_package_version_file(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/coz-profilerConfigVersion.cmake
|
|
|
|
COMPATIBILITY ExactVersion) # SameMajor only applies to versions >= 1.0. Versions 0.x have to match exactly according to semver.org
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/coz-profilerConfig.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/coz-profilerConfigVersion.cmake
|
|
|
|
DESTINATION
|
|
|
|
${CMAKE_INSTALL_LIBDIR}/cmake)
|
|
|
|
install(
|
|
|
|
EXPORT coz-profilerTargets
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
|
|
|
|
NAMESPACE coz::)
|
2021-05-22 15:03:46 +03:00
|
|
|
endif()
|
|
|
|
|
2021-01-08 18:27:17 +03:00
|
|
|
add_subdirectory(libcoz)
|
|
|
|
|
|
|
|
option(BUILD_BENCHMARKS "Build benchmarks" OFF)
|
|
|
|
if(BUILD_BENCHMARKS)
|
2021-01-08 20:59:15 +03:00
|
|
|
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
|
|
|
message(FATAL_ERROR "Build benchmarks with debug information - use Debug or RelWithDebInfo")
|
|
|
|
endif()
|
2021-01-08 18:27:17 +03:00
|
|
|
find_package(SQLite3 REQUIRED)
|
|
|
|
find_package(BZip2 REQUIRED)
|
|
|
|
add_subdirectory(benchmarks)
|
|
|
|
endif()
|
|
|
|
|