Fix CMake tinygltf dependencies

This commit is contained in:
JosiahWI 2023-05-17 09:49:42 -05:00 committed by Josiah VanderZee
parent 7e0d57b4fe
commit 2dbe3b866a
1 changed files with 20 additions and 13 deletions

View File

@ -325,6 +325,25 @@ elseif(NOT USE_SDL2)
endif()
endif()
# Only for the glTF loader and dependents; we can't link targets
# to object libraries on cmake<3.12 so usage requirements don't
# propogate to all dependents.
get_property(tinygltf_INCLUDE_DIRS
TARGET tinygltf::tinygltf
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
)
get_property(tinygltf_COMPILE_DEFS
TARGET tinygltf::tinygltf
PROPERTY INTERFACE_COMPILE_DEFINITIONS
)
if(CMAKE_VERSION VERSION_LESS 3.12)
foreach(TINYGLTF_DEF ${tinygltf_COMPILE_DEFS})
add_definitions("-D${TINYGLTF_DEF}")
endforeach(TINYGLTF_DEF)
else()
add_compile_definitions(${tinygltf_COMPILE_DEFS})
endif()
set(link_includes
"${PROJECT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}"
@ -332,6 +351,7 @@ set(link_includes
"${ZLIB_INCLUDE_DIR}"
"${JPEG_INCLUDE_DIR}"
"${PNG_INCLUDE_DIR}"
"${tinygltf_INCLUDE_DIRS}"
"$<$<BOOL:${USE_SDL2}>:${SDL2_INCLUDE_DIRS}>"
${OPENGL_INCLUDE_DIR}
@ -359,19 +379,6 @@ add_library(IRRMESHOBJ OBJECT
${IRRMESHLOADER}
)
get_property(tinygltf_INCLUDE_DIRS
TARGET tinygltf::tinygltf
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
)
get_property(tinygltf_COMPILE_DEFS
TARGET tinygltf::tinygltf
PROPERTY INTERFACE_COMPILE_DEFINITIONS
)
target_include_directories(IRRMESHOBJ PUBLIC ${tinygltf_INCLUDE_DIRS})
target_compile_definitions(IRRMESHOBJ PUBLIC ${tinygltf_COMPILE_DEFS})
add_library(IRROBJ OBJECT
CBillboardSceneNode.cpp
CCameraSceneNode.cpp