Commit bb516d9a authored by Ghislain MARY's avatar Ghislain MARY

Rename library to bcmatroska2 and handle package source generation with CPack.

parent 0c725091
############################################################################ ############################################################################
# Matroska2Config.cmake # BcMatroska2Config.cmake
# Copyright (C) 2015 Belledonne Communications, Grenoble France # Copyright (C) 2015 Belledonne Communications, Grenoble France
# #
############################################################################ ############################################################################
...@@ -23,17 +23,17 @@ ...@@ -23,17 +23,17 @@
# Config file for the Matroska2 package. # Config file for the Matroska2 package.
# It defines the following variables: # It defines the following variables:
# #
# MATROSKA2_FOUND - system has Matroska2 # BCMATROSKA2_FOUND - system has BcMatroska2
# MATROSKA2_INCLUDE_DIRS - the Matroska2 include directory # BCMATROSKA2_INCLUDE_DIRS - the BcMatroska2 include directory
# MATROSKA2_LIBRARIES - The libraries needed to use Matroska2 # BCMATROSKA2_LIBRARIES - The libraries needed to use BcMatroska2
include("${CMAKE_CURRENT_LIST_DIR}/Matroska2Targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/BcMatroska2Targets.cmake")
if(@ENABLE_SHARED@) if(@ENABLE_SHARED@)
set(MATROSKA2_LIBRARIES matroska2) set(BCMATROSKA2_LIBRARIES matroska2)
else() else()
get_target_property(MATROSKA2_LIBRARIES matroska2-static LOCATION) get_target_property(BCMATROSKA2_LIBRARIES bcmatroska2-static LOCATION)
endif() endif()
set(MATROSKA2_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@") set(BCMATROSKA2_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(MATROSKA2_FOUND 1) set(BCMATROSKA2_FOUND 1)
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(matroska2 project(bcmatroska2
VERSION 0.22.1 VERSION 0.22.1
LANGUAGES C LANGUAGES C
) )
...@@ -78,27 +78,38 @@ install(FILES ${CMAKE_BINARY_DIR}/config.h ...@@ -78,27 +78,38 @@ install(FILES ${CMAKE_BINARY_DIR}/config.h
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
write_basic_package_version_file( write_basic_package_version_file(
${CMAKE_BINARY_DIR}/Matroska2ConfigVersion.cmake ${CMAKE_BINARY_DIR}/BcMatroska2ConfigVersion.cmake
VERSION ${MATROSKA2_VERSION} VERSION ${MATROSKA2_VERSION}
COMPATIBILITY AnyNewerVersion COMPATIBILITY AnyNewerVersion
) )
export(EXPORT Matroska2Targets export(EXPORT BcMatroska2Targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/Matroska2Targets.cmake" FILE "${CMAKE_CURRENT_BINARY_DIR}/BcMatroska2Targets.cmake"
) )
configure_file(Matroska2Config.cmake.in configure_file(BcMatroska2Config.cmake.in
${CMAKE_BINARY_DIR}/Matroska2Config.cmake ${CMAKE_BINARY_DIR}/BcMatroska2Config.cmake
@ONLY @ONLY
) )
set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake") set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake")
install(EXPORT Matroska2Targets install(EXPORT BcMatroska2Targets
FILE Matroska2Targets.cmake FILE BcMatroska2Targets.cmake
DESTINATION ${CONFIG_PACKAGE_LOCATION} DESTINATION ${CONFIG_PACKAGE_LOCATION}
) )
install(FILES install(FILES
${CMAKE_BINARY_DIR}/Matroska2ConfigVersion.cmake ${CMAKE_BINARY_DIR}/BcMatroska2ConfigVersion.cmake
${CMAKE_BINARY_DIR}/Matroska2Config.cmake ${CMAKE_BINARY_DIR}/BcMatroska2Config.cmake
DESTINATION ${CONFIG_PACKAGE_LOCATION} DESTINATION ${CONFIG_PACKAGE_LOCATION}
) )
# CPack settings
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES
"^${CMAKE_BINARY_DIR}"
"/\\\\..+"
)
include(CPack)
...@@ -33,41 +33,41 @@ endif() ...@@ -33,41 +33,41 @@ endif()
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}") string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
if(ENABLE_STATIC) if(ENABLE_STATIC)
add_library(matroska2-static STATIC $<TARGET_OBJECTS:corec-objects> $<TARGET_OBJECTS:ebml2-objects> ${MATROSKA2_SOURCE_FILES}) add_library(bcmatroska2-static STATIC $<TARGET_OBJECTS:corec-objects> $<TARGET_OBJECTS:ebml2-objects> ${MATROSKA2_SOURCE_FILES})
set_target_properties(matroska2-static PROPERTIES OUTPUT_NAME matroska2) set_target_properties(bcmatroska2-static PROPERTIES OUTPUT_NAME bcmatroska2)
set_target_properties(matroska2-static PROPERTIES POSITION_INDEPENDENT_CODE TRUE) set_target_properties(bcmatroska2-static PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
if(NOT "${LINK_FLAGS_STR}" STREQUAL "") if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(matroska2-static PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") set_target_properties(bcmatroska2-static PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif() endif()
target_include_directories(matroska2-static PRIVATE ../libebml2 .) target_include_directories(bcmatroska2-static PRIVATE ../libebml2 .)
if(LIBS) if(LIBS)
target_link_libraries(matroska2-static ${LIBS}) target_link_libraries(bcmatroska2-static ${LIBS})
endif() endif()
install(TARGETS matroska2-static EXPORT Matroska2Targets install(TARGETS bcmatroska2-static EXPORT BcMatroska2Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
endif() endif()
if(ENABLE_SHARED) if(ENABLE_SHARED)
add_library(matroska2 SHARED $<TARGET_OBJECTS:corec-objects> $<TARGET_OBJECTS:ebml2-objects> ${MATROSKA2_SOURCE_FILES}) add_library(bcmatroska2 SHARED $<TARGET_OBJECTS:corec-objects> $<TARGET_OBJECTS:ebml2-objects> ${MATROSKA2_SOURCE_FILES})
set_target_properties(matroska2 PROPERTIES VERSION 0.0.0 SOVERSION 0) set_target_properties(bcmatroska2 PROPERTIES VERSION 0.0.0 SOVERSION 0)
set_target_properties(matroska2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) set_target_properties(bcmatroska2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
if(NOT "${LINK_FLAGS_STR}" STREQUAL "") if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(matroska2 PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") set_target_properties(bcmatroska2 PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif() endif()
target_include_directories(matroska2 PRIVATE ../libebml2 .) target_include_directories(bcmatroska2 PRIVATE ../libebml2 .)
if(LIBS) if(LIBS)
target_link_libraries(matroska2 ${LIBS}) target_link_libraries(bcmatroska2 ${LIBS})
endif() endif()
if(MSVC) if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/matroska2.pdb install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/bcmatroska2.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR} DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
endif() endif()
endif() endif()
install(TARGETS matroska2 EXPORT Matroska2Targets install(TARGETS bcmatroska2 EXPORT BcMatroska2Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......
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