@ -53,7 +53,11 @@ endif()
option ( SPDLOG_BUILD_EXAMPLES "Build examples" ${ SPDLOG_MASTER_PROJECT } )
option ( SPDLOG_BUILD_BENCH "Build benchmarks" ${ SPDLOG_MASTER_PROJECT } )
option ( SPDLOG_BUILD_TESTS "Build tests" ${ SPDLOG_MASTER_PROJECT } )
option ( SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" OFF )
if ( SPDLOG_FMT_EXTERNAL )
find_package ( fmt REQUIRED CONFIG )
endif ( )
target_include_directories (
s p d l o g
@ -62,6 +66,11 @@ target_include_directories(
" $ < I N S T A L L _ I N T E R F A C E : $ { C M A K E _ I N S T A L L _ I N C L U D E D I R } > "
)
if ( SPDLOG_FMT_EXTERNAL )
target_compile_definitions ( spdlog INTERFACE SPDLOG_FMT_EXTERNAL )
target_link_libraries ( spdlog INTERFACE fmt::fmt )
endif ( )
set ( HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include" )
if ( SPDLOG_BUILD_EXAMPLES )
@ -85,7 +94,8 @@ set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set ( include_install_dir "${CMAKE_INSTALL_INCLUDEDIR}" )
set ( pkgconfig_install_dir "${CMAKE_INSTALL_LIBDIR}/pkgconfig" )
set ( version_config "${CMAKE_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" )
set ( project_config "${PROJECT_NAME}Config.cmake" )
set ( project_config "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" )
set ( targets_config "${PROJECT_NAME}Targets.cmake" )
set ( pkg_config "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc" )
set ( targets_export_name "${PROJECT_NAME}Targets" )
set ( namespace "${PROJECT_NAME}::" )
@ -98,6 +108,8 @@ write_basic_package_version_file(
# c o n f i g u r e p k g c o n f i g f i l e
configure_file ( "cmake/spdlog.pc.in" "${pkg_config}" @ONLY )
# c o n f i g u r e s p d l o g C o n f i g . c m a k e f i l e
configure_file ( "cmake/Config.cmake.in" "${project_config}" @ONLY )
# i n s t a l l t a r g e t s
install (
@ -111,9 +123,9 @@ install(
D E S T I N A T I O N " $ { i n c l u d e _ i n s t a l l _ d i r } "
)
# i n s t a l l p r o j e c t ve r s i o n f i l e
# i n s t a l l p r o j e c t co n f i g a n d ve r s i o n f i l e
install (
F I L E S " $ { ve r s i o n _ c o n f i g } "
F I L E S " $ { pr o j e c t _ c o n f i g } " " $ { ve r s i o n _ c o n f i g } "
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
@ -123,19 +135,19 @@ install(
D E S T I N A T I O N " $ { p k g c o n f i g _ i n s t a l l _ d i r } "
)
# i n s t a l l pr o j e c t c o n f i g f i l e
# i n s t a l l ta r g e t s c o n f i g f i l e
install (
E X P O R T " $ { t a r g e t s _ e x p o r t _ n a m e } "
N A M E S P A C E " $ { n a m e s p a c e } "
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
F I L E $ { pr o j e c t _ c o n f i g }
F I L E $ { ta r g e t s _ c o n f i g }
)
# e x p o r t b u i l d d i r e c t o r y co n f i g f i l e
# e x p o r t b u i l d d i r e c t o r y ta r g e t s f i l e
export (
E X P O R T $ { t a r g e t s _ e x p o r t _ n a m e }
N A M E S P A C E " $ { n a m e s p a c e } "
F I L E $ { pr o j e c t _ c o n f i g }
F I L E $ { ta r g e t s _ c o n f i g }
)
# r e g i s t e r p r o j e c t i n C M a k e u s e r r e g i s t r y