From 1e5bdca69f7676b2dbcd64f0f44f31b12b337b7c Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 13 Dec 2016 13:45:04 +0100 Subject: sync with upstream --- project/cmake/modules/FindTexturePacker.cmake | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'project/cmake/modules/FindTexturePacker.cmake') diff --git a/project/cmake/modules/FindTexturePacker.cmake b/project/cmake/modules/FindTexturePacker.cmake index 2229ff7..f9e4c75 100644 --- a/project/cmake/modules/FindTexturePacker.cmake +++ b/project/cmake/modules/FindTexturePacker.cmake @@ -3,6 +3,10 @@ # ----------------- # Finds the TexturePacker # +# If WITH_TEXTUREPACKER is defined and points to a directory, +# this path will be used to search for the Texturepacker binary +# +# # This will define the following (imported) targets:: # # TexturePacker::TexturePacker - The TexturePacker executable @@ -17,7 +21,21 @@ if(NOT TARGET TexturePacker::TexturePacker) set_target_properties(TexturePacker::TexturePacker PROPERTIES IMPORTED_LOCATION "${CORE_SOURCE_DIR}/tools/TexturePacker/TexturePacker.exe") else() - add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker) - add_executable(TexturePacker::TexturePacker ALIAS TexturePacker) + if(WITH_TEXTUREPACKER) + get_filename_component(_tppath ${WITH_TEXTUREPACKER} ABSOLUTE) + find_program(TEXTUREPACKER_EXECUTABLE TexturePacker PATHS ${_tppath}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(TexturePacker DEFAULT_MSG TEXTUREPACKER_EXECUTABLE) + if(TEXTUREPACKER_FOUND) + add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL) + set_target_properties(TexturePacker::TexturePacker PROPERTIES + IMPORTED_LOCATION "${TEXTUREPACKER_EXECUTABLE}") + endif() + mark_as_advanced(TEXTUREPACKER) + else() + add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker) + add_executable(TexturePacker::TexturePacker ALIAS TexturePacker) + endif() endif() endif() -- cgit v1.2.3