mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-05 12:29:08 +08:00
91dd9ae821
* [loguru] Add loguru[fmt] feature Add fmt feature, with if checks to require and link fmt if it is specified * [loguru] Replace deprecated functions Remove deprecated functions vcpkg_install_cmake, vcpkg_fixup_cmake_targets, vcpkg_configure_cmake and replace them with vcpkg_cmake_install, vcpkg_cmake_config_fixup and vcpkg_cmake_configure respectively. Also add vcpkg-cmake and vcpkg-cmake-config to vcpkg.json to provide the replacements * [loguru] Update versioning files * [loguru] Add CONFIG flag to find_package(fmt) * Make suggested changes * Update version database * Make requested changes * [loguru] Update version database
56 lines
1.7 KiB
CMake
56 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.12)
|
|
|
|
project(loguru CXX)
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
option(INSTALL_HEADERS "Install header files" ON)
|
|
option(BUILD_WITH_FMT "Build with fmt support" OFF)
|
|
|
|
set(loguru_headers
|
|
loguru.hpp
|
|
)
|
|
set(loguru_sources
|
|
loguru.cpp
|
|
)
|
|
|
|
add_library(loguru ${loguru_sources})
|
|
target_include_directories(loguru PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
$<INSTALL_INTERFACE:include/loguru>)
|
|
|
|
if(BUILD_WITH_FMT)
|
|
target_compile_definitions(loguru PRIVATE LOGURU_USE_FMTLIB=1)
|
|
find_package(fmt CONFIG REQUIRED)
|
|
target_link_libraries(loguru PUBLIC fmt::fmt)
|
|
endif()
|
|
|
|
if(UNIX)
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
find_package(Threads REQUIRED)
|
|
target_link_libraries(loguru PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
|
|
endif()
|
|
|
|
set(LOGURU_INCLUDE_INSTALL_DIR include/loguru CACHE PATH "Install directory for headers")
|
|
if(INSTALL_HEADERS)
|
|
install(FILES ${loguru_headers} DESTINATION ${LOGURU_INCLUDE_INSTALL_DIR})
|
|
endif()
|
|
|
|
set(INCLUDE_INSTALL_DIR ${LOGURU_INCLUDE_INSTALL_DIR})
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
configure_package_config_file(loguruConfig.cmake.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/loguruConfig.cmake
|
|
INSTALL_DESTINATION share/loguru
|
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
|
PATH_VARS INCLUDE_INSTALL_DIR)
|
|
|
|
install(TARGETS loguru
|
|
EXPORT loguruTargets
|
|
RUNTIME DESTINATION bin
|
|
LIBRARY DESTINATION lib
|
|
ARCHIVE DESTINATION lib
|
|
)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/loguruConfig.cmake DESTINATION share/loguru)
|
|
install(EXPORT loguruTargets DESTINATION share/loguru)
|