Commit d1aa8d10 authored by jehan's avatar jehan

add minimal rpm generation

parent 069d93da
......@@ -23,18 +23,20 @@
cmake_minimum_required(VERSION 3.0)
project(BCTOOLBOX C CXX)
set(PACKAGE "bctoolbox")
set(PACKAGE_NAME "${PACKAGE}")
set(PACKAGE_VERSION "0.0.1")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_NAME ${PACKAGE})
set(PACKAGE_VERSION_MAJOR "0")
set(PACKAGE_VERSION_MINOR "0")
set(PACKAGE_VERSION_PATCH "1")
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
set(PACKAGE_STRING "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "jehan.monnier@linphone.org")
set(PACKAGE_TARNAME "bctoolbox")
set(PACKAGE_URL "")
set(VERSION "${PACKAGE_VERSION}")
option(ENABLE_POLARSSL "Enable polarssl support" ON)
option(ENABLE_MBEDTLS "Enable mabedtls support" OFF)
option(ENABLE_MBEDTLS "Enable mabedtls support" ON)
include(CheckLibraryExists)
include(CheckSymbolExists)
......@@ -74,12 +76,10 @@ set(exec_prefix ${prefix}/bin)
set(libdir ${prefix}/lib)
set(includedir ${prefix}/include)
if (MBEDTLS_FOUND)
if (ENABLE_MBEDTLS AND MBEDTLS_FOUND)
get_filename_component(mbedtls_library_path "${MBEDTLS_LIBRARIES}" PATH)
set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${mbedlts_library_path}")
endif()
if (POLARSSL_FOUND)
elseif(ENABLE_POLARSSL AND POLARSSL_FOUND)
get_filename_component(polarssl_library_path "${POLARSSL_LIBRARIES}" PATH)
set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${polarssl_library_path} -lpolarssl")
endif()
......@@ -94,11 +94,9 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
if (MBEDTLS_FOUND)
if (ENABLE_MBEDTLS AND MBEDTLS_FOUND)
include_directories(${MBEDTLS_INCLUDE_DIRS})
endif()
if (POLARSSL_FOUND)
elseif(ENABLE_POLARSSL AND POLARSSL_FOUND)
include_directories(${POLARSSL_INCLUDE_DIRS})
endif()
......@@ -165,6 +163,7 @@ add_compile_options(${STRICT_OPTIONS_CPP} ${STRICT_OPTIONS_C})
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(build)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
......
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Toolbox package used by Belldonne Communications projects")
set(CPACK_PACKAGE_VENDOR "Belledonne Communications")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../COPYING")
set(CPACK_PACKAGE_NAME ${PACKAGE})
set(CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION_PATCH})
set(CPACK_RPM_COMPONENT_INSTALL OFF)
set(CPACK_COMPONENTS_ALL runtime devel)
set(CPACK_COMPONENT_DEVEL_DEPENDS runtime)
set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME ${PACKAGE})
set(CPACK_COMPONENT_DEVEL_DISPLAY_NAME ${PACKAGE}-devel)
if ("${CPACK_GENERATOR}" STREQUAL "RPM")
set (CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PACKAGE_VERSION})
endif ()
INCLUDE(CPack)
......@@ -32,4 +32,5 @@ set(BCTOOLBOX_HEADER_FILES ${BCTOOLBOX_HEADER_FILES} PARENT_SCOPE)
install(FILES ${BCTOOLBOX_HEADER_FILES}
DESTINATION include/bctoolbox
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT devel)
......@@ -66,8 +66,19 @@ target_include_directories(bctoolbox PUBLIC ${INCLUDES})
target_link_libraries(bctoolbox ${LIBS})
install(TARGETS bctoolbox EXPORT ${EXPORT_TARGETS_NAME}Targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT runtime NAMELINK_SKIP
)
if(ENABLE_STATIC)
install(TARGETS bctoolbox EXPORT ${EXPORT_TARGETS_NAME}Targets
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT devel
)
endif()
install(TARGETS bctoolbox EXPORT ${EXPORT_TARGETS_NAME}Targets
LIBRARY DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT devel NAMELINK_ONLY
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment