cmake_minimum_required( VERSION 3.2 )
#declare project
-project( lottie-player LANGUAGES C CXX )
+project( lottie-player VERSION 0.0.1 LANGUAGES C CXX )
#declare target
add_library( lottie-player SHARED "" )
)
#install config file.
+
install( EXPORT lottie-player-targets
- FILE lottie-player.cmake
+ 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)
+
--- /dev/null
+get_filename_component(lottie-player_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+include(CMakeFindDependencyMacro)
+
+list(APPEND CMAKE_MODULE_PATH ${lottie-player_CMAKE_DIR})
+
+# NOTE Had to use find_package because find_dependency does not support COMPONENTS or MODULE until 3.8.0
+
+#find_dependency(RapidJSON 1.0 REQUIRED MODULE)
+#find_package(Boost 1.55 REQUIRED COMPONENTS regex)
+list(REMOVE_AT CMAKE_MODULE_PATH -1)
+
+if(NOT TARGET lottie-player::lottie-player)
+ include("${lottie-player_CMAKE_DIR}/lottie-playerTargets.cmake")
+endif()
+
+set(lottie-player_LIBRARIES lottie-player::lottie-player)