@ -1,3 +1,5 @@
# # # I n s t a l l # # #
# N o t e : u s e ' t a r g e t s _ e x p o r t _ n a m e '
#
# Copyright ( c ) 2 0 1 5 R u s l a n B a r a t o v .
# D i s t r i b u t e d u n d e r t h e M I T License ( http://opensource.org/licenses/MIT )
@ -7,6 +9,7 @@ cmake_minimum_required(VERSION 3.1)
project ( spdlog VERSION 1.0.0 )
include ( CTest )
include ( CMakeDependentOption )
include ( GNUInstallDirs )
set ( CMAKE_CXX_STANDARD 11 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
@ -27,7 +30,7 @@ target_include_directories(
s p d l o g
I N T E R F A C E
" $ < B U I L D _ I N T E R F A C E : $ { C M A K E _ C U R R E N T _ L I S T _ D I R } / i n c l u d e > "
" $ < I N S T A L L _ I N T E R F A C E : in c l u d e > "
" $ < 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 } > "
)
set ( HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include" )
@ -40,17 +43,12 @@ if(SPDLOG_BUILD_TESTING)
add_subdirectory ( tests )
endif ( )
# # # I n s t a l l # # #
# * h t t p s : / / g i t h u b . c o m / f o r e x a m p l e / p a c k a g e - e x a m p l e
set ( generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated" )
set ( config_install_dir "lib/cmake/${PROJECT_NAME}" )
set ( include_install_dir "include" )
set ( pkgconfig_install_dir "lib/pkgconfig" )
set ( version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake" )
set ( project_config "${generated_dir}/${PROJECT_NAME}Config.cmake" )
set ( pkg_config "${generated_dir}/${PROJECT_NAME}.pc" )
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 ( pkg_config "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc" )
set ( targets_export_name "${PROJECT_NAME}Targets" )
set ( namespace "${PROJECT_NAME}::" )
@ -59,8 +57,6 @@ write_basic_package_version_file(
" $ { v e r s i o n _ c o n f i g } " C O M P A T I B I L I T Y S a m e M a j o r V e r s i o n
)
# N o t e : u s e ' t a r g e t s _ e x p o r t _ n a m e '
configure_file ( "cmake/Config.cmake.in" "${project_config}" @ONLY )
configure_file ( "cmake/spdlog.pc.in" "${pkg_config}" @ONLY )
install (
@ -69,10 +65,13 @@ install(
I N C L U D E S 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 } "
)
install ( DIRECTORY "include/spdlog" DESTINATION "${include_install_dir}" )
install (
D I R E C T O R Y " $ { H E A D E R _ B A S E } / $ { P R O J E C T _ N A M E } "
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 } "
)
install (
F I L E S " $ { p r o j e c t _ c o n f i g } " " $ { v e r s i o n _ c o n f i g } "
F I L E S " $ { 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 } "
)
@ -85,7 +84,16 @@ 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 $ { p r o j e c t _ c o n f i g }
)
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 $ { p r o j e c t _ c o n f i g }
)
export ( PACKAGE ${ PROJECT_NAME } )
file ( GLOB_RECURSE spdlog_include_SRCS "${HEADER_BASE}/*.h" )
add_custom_target ( spdlog_headers_for_ide SOURCES ${ spdlog_include_SRCS } )