mdbx-cmake: refine installation.

Change-Id: I085aba06b957eb1a0e9ce24791bcb5bcc496a609
This commit is contained in:
Leo Yuriev 2019-12-04 16:23:51 +03:00 committed by Leonid Yuriev
parent 84323a8a4c
commit df4057db6f
3 changed files with 170 additions and 31 deletions

View File

@ -167,7 +167,7 @@ if(MDBX_BUILD_SHARED_LIBRARY)
endif()
# static library used for tools, to avoid rpath/dll-path troubles
add_library(mdbx-static STATIC EXCLUDE_FROM_ALL mdbx.c mdbx.h)
add_library(mdbx-static STATIC mdbx.c mdbx.h)
set_target_properties(mdbx-static PROPERTIES
C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON
PUBLIC_HEADER mdbx.h)
@ -197,20 +197,112 @@ endforeach()
# installation
if(MDBX_BUILD_SHARED_LIBRARY)
install(TARGETS mdbx EXPORT libmdbx
LIBRARY DESTINATION lib COMPONENT runtime
PUBLIC_HEADER DESTINATION include
INCLUDES DESTINATION include COMPONENT devel)
if(CMAKE_VERSION VERSION_LESS 3.12)
install(TARGETS mdbx EXPORT libmdbx
RUNTIME
DESTINATION bin
COMPONENT runtime
LIBRARY
DESTINATION lib
COMPONENT runtime
OBJECTS
DESTINATION lib
COMPONENT devel
ARCHIVE
DESTINATION lib
COMPONENT devel
PUBLIC_HEADER
DESTINATION include
COMPONENT devel
INCLUDES
DESTINATION include
COMPONENT devel)
else()
install(TARGETS mdbx EXPORT libmdbx
RUNTIME
DESTINATION bin
COMPONENT runtime
LIBRARY
DESTINATION lib
COMPONENT runtime
NAMELINK_COMPONENT devel
OBJECTS
DESTINATION lib
COMPONENT devel
ARCHIVE
DESTINATION lib
COMPONENT devel
PUBLIC_HEADER
DESTINATION include
COMPONENT devel
INCLUDES
DESTINATION include
COMPONENT devel)
endif()
endif()
install(TARGETS mdbx-static EXPORT libmdbx
LIBRARY DESTINATION lib COMPONENT runtime
OBJECTS DESTINATION lib/static COMPONENT devel
ARCHIVE DESTINATION lib/static COMPONENT devel
PUBLIC_HEADER DESTINATION include
INCLUDES DESTINATION include COMPONENT devel)
if(CMAKE_VERSION VERSION_LESS 3.12)
install(TARGETS mdbx-static EXPORT libmdbx EXCLUDE_FROM_ALL
RUNTIME
DESTINATION bin
COMPONENT runtime
LIBRARY
DESTINATION lib
COMPONENT runtime
OBJECTS
DESTINATION lib
COMPONENT devel
ARCHIVE
DESTINATION lib
COMPONENT devel
PUBLIC_HEADER
DESTINATION include
COMPONENT devel
INCLUDES
DESTINATION include
COMPONENT devel)
else()
install(TARGETS mdbx-static EXPORT libmdbx EXCLUDE_FROM_ALL
RUNTIME
DESTINATION bin
COMPONENT runtime
LIBRARY
DESTINATION lib
COMPONENT runtime
NAMELINK_COMPONENT devel
OBJECTS
DESTINATION lib
COMPONENT devel
ARCHIVE
DESTINATION lib
COMPONENT devel
PUBLIC_HEADER
DESTINATION include
COMPONENT devel
INCLUDES
DESTINATION include
COMPONENT devel)
endif()
install(TARGETS mdbx_chk mdbx_stat mdbx_copy mdbx_dump mdbx_load
RUNTIME DESTINATION bin COMPONENT runtime)
install(
TARGETS
mdbx_chk
mdbx_stat
mdbx_copy
mdbx_dump
mdbx_load
RUNTIME
DESTINATION bin
COMPONENT runtime)
install(
FILES
man1/mdbx_chk.1
man1/mdbx_stat.1
man1/mdbx_copy.1
man1/mdbx_dump.1
man1/mdbx_load.1
DESTINATION man/man1
COMPONENT doc)
cmake_policy(POP)

View File

@ -120,13 +120,6 @@ if(CC_HAS_VISIBILITY)
target_compile_options(mdbx PRIVATE "-fvisibility=hidden")
endif()
install(TARGETS mdbx
LIBRARY DESTINATION lib COMPONENT runtime
RUNTIME DESTINATION bin COMPONENT runtime
ARCHIVE DESTINATION lib/static COMPONENT devel
PUBLIC_HEADER DESTINATION include
INCLUDES DESTINATION include COMPONENT devel)
################################################################################
#
# library build info (used in library version output)
@ -226,11 +219,50 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/elements/config.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/elements/config.h" ESCAPE_QUOTES)
add_definitions(-DMDBX_CONFIG_H="config.h")
install(TARGETS mdbx EXPORT libmdbx
LIBRARY DESTINATION lib COMPONENT runtime
OBJECTS DESTINATION lib/static COMPONENT devel
ARCHIVE DESTINATION lib/static COMPONENT devel
PUBLIC_HEADER DESTINATION include
INCLUDES DESTINATION include COMPONENT devel)
# installation
if(MDBX_BUILD_SHARED_LIBRARY)
if(CMAKE_VERSION VERSION_LESS 3.12)
install(TARGETS mdbx EXPORT libmdbx
RUNTIME
DESTINATION bin
COMPONENT runtime
LIBRARY
DESTINATION lib
COMPONENT runtime
OBJECTS
DESTINATION lib
COMPONENT devel
ARCHIVE
DESTINATION lib
COMPONENT devel
PUBLIC_HEADER
DESTINATION include
COMPONENT devel
INCLUDES
DESTINATION include
COMPONENT devel)
else()
install(TARGETS mdbx EXPORT libmdbx
RUNTIME
DESTINATION bin
COMPONENT runtime
LIBRARY
DESTINATION lib
COMPONENT runtime
NAMELINK_COMPONENT devel
OBJECTS
DESTINATION lib
COMPONENT devel
ARCHIVE
DESTINATION lib
COMPONENT devel
PUBLIC_HEADER
DESTINATION include
COMPONENT devel
INCLUDES
DESTINATION include
COMPONENT devel)
endif()
endif()
add_subdirectory(tools)

View File

@ -31,9 +31,6 @@ foreach(TOOL ${MDBX_TOOLS})
set_target_properties(${TOOL} PROPERTIES
C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT mdbx)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../man1/${TOOL}.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1 COMPONENT mdbx)
endforeach()
if(LIB_MATH)
@ -41,5 +38,23 @@ if(LIB_MATH)
target_link_libraries(mdbx_stat ${LIB_MATH})
endif()
install(TARGETS mdbx_chk mdbx_stat mdbx_copy mdbx_dump mdbx_load
RUNTIME DESTINATION bin COMPONENT runtime)
install(
TARGETS
mdbx_chk
mdbx_stat
mdbx_copy
mdbx_dump
mdbx_load
RUNTIME
DESTINATION bin
COMPONENT runtime)
install(
FILES
../man1/mdbx_chk.1
../man1/mdbx_stat.1
../man1/mdbx_copy.1
../man1/mdbx_dump.1
../man1/mdbx_load.1
DESTINATION man/man1
COMPONENT doc)