Fix macdeployqt finding with Qt5 on macos
authorAnton Malmygin <antonc27@mail.ru>
Mon, 13 May 2019 14:23:25 +0200
changeset 14928 d6e21765912e
parent 14927 b3890f4311f7
child 14929 58070c3dd043
Fix macdeployqt finding with Qt5 on macos
tools/CMakeLists.txt
--- a/tools/CMakeLists.txt	Sun May 12 17:00:01 2019 +0200
+++ b/tools/CMakeLists.txt	Mon May 13 14:23:25 2019 +0200
@@ -26,8 +26,8 @@
         endif()
     endif()
 
-    #use the associated tool from the libraries we've selected
-    string(REGEX REPLACE "(.*)/include.*" "\\1" qt_base_dir "${QT_INCLUDE_DIR}")
+    get_target_property(qmake_executable Qt5::qmake IMPORTED_LOCATION)
+    get_filename_component(qt_bin_dir "${qmake_executable}" DIRECTORY)
 
     #remove the ";-framework Cocoa" from the SDL2_LIBRARY variable
     string(REGEX REPLACE "(.*);-.*" "\\1" sdl_library_only "${SDL2_LIBRARY}")
@@ -45,11 +45,9 @@
         set(engine_full_path "${CMAKE_INSTALL_PREFIX}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
     endif()
 
-    #this tool is present in qt 4.5 but only if you compile from sources
-    #from qt 4.6 is present also in the binary version
-    find_program(macdeployqt_executable NAMES macdeployqt macdeployqt-mac PATHS ${qt_base_dir}/bin)
+    find_program(macdeployqt_executable NAMES macdeployqt PATHS ${qt_bin_dir})
     if(NOT macdeployqt_executable)
-        message(FATAL_ERROR "The utility macdeployqt is required to create the bundle (seached: ${qt_base_dir})")
+        message(FATAL_ERROR "The utility macdeployqt is required to create the bundle (searched: ${qt_bin_dir})")
     endif()
 
     #create the .app bundle