Browse Source

CMake: Allow rlottie to a be added using the target rlottie::rlottie, disable export when rmlui is a submodule (#397)

Signed-off-by: Longtao Zhang <[email protected]>
DragonBillow 2 years ago
parent
commit
73a15bf186
2 changed files with 11 additions and 1 deletions
  1. 5 0
      .editorconfig
  2. 6 1
      CMakeLists.txt

+ 5 - 0
.editorconfig

@@ -0,0 +1,5 @@
+root = true
+
+[CMakeLists.txt]
+indent_style = tab
+indent_size = 4

+ 6 - 1
CMakeLists.txt

@@ -372,7 +372,10 @@ if(BUILD_LUA_BINDINGS)
 endif()
 endif()
 
 
 # rlottie
 # rlottie
-if( ENABLE_LOTTIE_PLUGIN )
+if( ENABLE_LOTTIE_PLUGIN AND TARGET rlottie::rlottie )
+	list(APPEND CORE_LINK_LIBS rlottie::rlottie)
+	list(APPEND CORE_INCLUDE_DIRS rlottie::rlottie)
+elseif( ENABLE_LOTTIE_PLUGIN )
 	# Try to find the rlottie library.
 	# Try to find the rlottie library.
 	if(NOT DEFINED rlottie_DIR)
 	if(NOT DEFINED rlottie_DIR)
 		set(rlottie_DIR $ENV{RLOTTIE_DIR})
 		set(rlottie_DIR $ENV{RLOTTIE_DIR})
@@ -1000,6 +1003,7 @@ endif()
 include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE)
 include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE)
 
 
 # guard against older versions of cmake which do not provide it
 # guard against older versions of cmake which do not provide it
+if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
 if(PkgHelpers_AVAILABLE)
 if(PkgHelpers_AVAILABLE)
 	set (INCLUDE_INSTALL_DIR "include")
 	set (INCLUDE_INSTALL_DIR "include")
 	set (LIB_INSTALL_DIR "lib")
 	set (LIB_INSTALL_DIR "lib")
@@ -1039,4 +1043,5 @@ else()
 		" please update cmake to version which provides CMakePackageConfighelpers module"
 		" please update cmake to version which provides CMakePackageConfighelpers module"
 		" or write generators for RmlUiConfig.cmake by yourself.")
 		" or write generators for RmlUiConfig.cmake by yourself.")
 endif()
 endif()
+endif()