Swiftgram/CMakeLists.txt
subhransu mohanty 23557dff62 lottie: treat undefined symbol as error while building library and enable assembly building.
Change-Id: I034d8bb84e61ecc56da6a66c18e620e8611dcb0b
2018-07-31 17:03:11 +09:00

99 lines
2.9 KiB
CMake

cmake_minimum_required( VERSION 3.2 )
#declare project
project( lottie-player VERSION 0.0.1 LANGUAGES C CXX ASM)
#declare target
add_library( lottie-player SHARED "" )
#declare version of the target
set(player_version_major 0)
set(player_version_minor 0)
set(player_version_patch 1)
set(player_version ${player_version_major}.${player_version_minor}.${player_version_patch} )
set_target_properties(lottie-player PROPERTIES
VERSION ${player_version}
SOVERSION ${player_version_major}
)
#declare alias so that library can be used inside the build tree, e.g. when testing
add_library(lottie-player::lottie-player ALIAS lottie-player)
#declare target compilation options
target_compile_options(lottie-player
PUBLIC
-std=c++14
PRIVATE
-Wall -fvisibility=hidden -O2)
#declare dependancy
set( CMAKE_THREAD_PREFER_PTHREAD TRUE )
find_package( Threads )
target_link_libraries(lottie-player
PUBLIC
"${CMAKE_THREAD_LIBS_INIT}"
)
target_link_libraries(lottie-player
PUBLIC
"-Wl,--no-undefined"
)
#declare source and include files
add_subdirectory(inc)
add_subdirectory(src)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_DIR ${PREFIX})
SET(LIBDIR ${LIB_INSTALL_DIR})
SET(INCDIR ${PREFIX}/include)
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
#install header
install(FILES inc/lottieplayer.h DESTINATION include)
#install lib
install( TARGETS lottie-player EXPORT lottie-player-targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
)
#install config file.
install( EXPORT lottie-player-targets
FILE lottie-playerTargets.cmake
NAMESPACE lottie-player::
DESTINATION lib/cmake/lottie-player
)
#Create a ConfigVersion.cmake file
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/lottie-playerConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfig.cmake
INSTALL_DESTINATION lib/cmake/lottie-player
)
#Install the config, configversion and custom find modules
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfigVersion.cmake
DESTINATION lib/cmake/lottie-player
)
export(EXPORT lottie-player-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerTargets.cmake NAMESPACE lottie-player::)
#Register package in user's package registry
export(PACKAGE lottie-player)