add library packaging
This commit is contained in:
parent
11eeafac16
commit
85ff28360b
|
@ -1,7 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
project(klib CXX)
|
||||
project(klib LANGUAGES CXX VERSION 0.0.1)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
if(MSVC)
|
||||
add_compile_options("/W4" "$<$<CONFIG:RELEASE>:/O2>")
|
||||
else()
|
||||
|
@ -29,12 +30,26 @@ install(TARGETS klib LIBRARY DESTINATION ${PREFIX}/lib)
|
|||
install(FILES ${HEADER_FILES} DESTINATION include/klib)
|
||||
install(FILES klibConfig.cmake DESTINATION share/klib/cmake)
|
||||
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
|
||||
add_executable(tlv_test tlvTest.cc)
|
||||
target_link_libraries(tlv_test klib)
|
||||
add_test(tlvTest tlv_test)
|
||||
|
||||
add_executable(dictionary_test dictionaryTest.cc)
|
||||
target_link_libraries(dictionary_test klib)
|
||||
add_test(dictionaryTest dictionary_test)
|
||||
|
||||
add_executable(buffer_test bufferTest.cc)
|
||||
target_link_libraries(buffer_test klib)
|
||||
add_test(bufferTest buffer_test)
|
||||
|
||||
include(CMakePack.txt)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
klibConfig.cmake
|
||||
VERSION ${PACKAGE_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
|
@ -0,0 +1,35 @@
|
|||
# Packaging support
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
set(CPACK_PACKAGE_VENDOR "Shimmering Clarity")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Common C++ functionality.")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||
|
||||
|
||||
# Debian settings
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "K. Isom")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Shimmering Clarity C++ library")
|
||||
set(CPACK_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc++1 (>= 3.7.0-1)")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION devel)
|
||||
|
||||
if(LINUX)
|
||||
set(CPACK_GENERATOR "DEB;STGZ;TGZ")
|
||||
elseif(APPLE)
|
||||
set(CPACK_GENERATOR "PACKAGEMAKER")
|
||||
elseif(MSVC OR MSYS OR MINGW)
|
||||
set(CPACK_GENERATOR "NSIS;ZIP")
|
||||
else()
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
endif()
|
||||
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
|
||||
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
/.git
|
||||
/dist
|
||||
/.*build.*)
|
||||
|
||||
include (CPack)
|
Loading…
Reference in New Issue