From 41e10832805d43dcccf9ffb11a8e45ef029ec831 Mon Sep 17 00:00:00 2001 From: "Vogel, Rick" Date: Mon, 22 Jan 2024 11:10:18 +0100 Subject: [PATCH] try fix shared library path --- cmake/QSkinnyTools.cmake | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/cmake/QSkinnyTools.cmake b/cmake/QSkinnyTools.cmake index eca835e68..a99ea62da 100644 --- a/cmake/QSkinnyTools.cmake +++ b/cmake/QSkinnyTools.cmake @@ -14,12 +14,31 @@ function(qsk_svg2qvg SVG_FILENAME QVG_FILENAME) elseif(TARGET Qt5::Svg) set(QtSvgTarget Qt5::Svg) endif() + + # find svg2qvg target location + get_target_property(Svg2QvgLocation Qsk::Svg2Qvg LOCATION) + get_filename_component(Svg2QvgDirectory ${Svg2QvgLocation} DIRECTORY) + # find svg2qvg target location + get_target_property(QtSvgTargetLocation ${QtSvgTarget} LOCATION) + get_filename_component(QtSvgTargetDirectory ${QtSvgTargetLocation} DIRECTORY) + + # construct a platform specific command + set(cmd "${Svg2QvgBinary} ${SVG_FILENAME} ${QVG_FILENAME}") + if (CMAKE_SYSTEM_NAME MATCHES "Windows") + set(cmd "set PATH=\%PATH\%;${QtSvgTargetDirectory} && ${cmd}") + elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(cmd "DYLD_LIBRARY_PATH=\$DYLD_LIBRARY_PATH:${QtSvgTargetDirectory} ${cmd}") + elseif (CMAKE_SYSTEM_NAME MATCHES "Linux") + set(cmd "LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${QtSvgTargetDirectory} ${cmd}") + else() + message(FATAL "Unsupported operating system") + endif() + add_custom_command( - COMMAND Qsk::Svg2Qvg ${SVG_FILENAME} ${QVG_FILENAME} + COMMAND ${cmd} OUTPUT ${QVG_FILENAME} DEPENDS ${SVG_FILENAME} - WORKING_DIRECTORY $ COMMENT "Compiling ${SVG_FILENAME} to ${QVG_FILENAME}") endfunction()