macOS: Build nextcloudcmd after gui and run macdeployqt with the -executable option
authorMichael Schuster <michael@schuster.ms>
Sat, 6 Jun 2020 17:53:48 +0000 (19:53 +0200)
committerMichael Schuster <michael@schuster.ms>
Sun, 7 Jun 2020 12:39:42 +0000 (14:39 +0200)
- src/CMakeLists.txt: Switch build order to build cmd before gui
- src/gui/CMakeLists.txt: Use the -executable option for a combined run of macdeployqt

Signed-off-by: Michael Schuster <michael@schuster.ms>
src/CMakeLists.txt
src/cmd/CMakeLists.txt
src/gui/CMakeLists.txt

index cb83e784ab07895b32de33f8109e4ffad3c46534..c74c665355ae901cece4eac4ee8691678cb13d04 100644 (file)
@@ -51,8 +51,8 @@ set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/theme CACHE STRING "" FORCE)
 add_subdirectory(csync)
 add_subdirectory(libsync)
 if (NOT BUILD_LIBRARIES_ONLY)
-    add_subdirectory(gui)
     add_subdirectory(cmd)
+    add_subdirectory(gui)
 
     if (WITH_CRASHREPORTER)
         add_subdirectory(3rdparty/libcrashreporter-qt)
index e0655d0c1ea3446af26fbf3990f9fac1b21a3206..abb36205f52f827b1f2c375a86f58038f4d8db46 100644 (file)
@@ -32,6 +32,7 @@ if(NOT BUILD_LIBRARIES_ONLY)
     target_include_directories(${cmd_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer)
 endif()
 
+# OSX: Copy nextcloudcmd to app bundle, src/gui will run macdeployqt
 if(BUILD_OWNCLOUD_OSX_BUNDLE)
     add_custom_command(TARGET ${cmd_NAME} POST_BUILD
         COMMAND "cp"
index ed17270cbd7effbbce6fd5f3fa17d8e1a90e5e6f..cb8738581ea4dbe2b3ae0ff1ba03dd33ecaf52b2 100644 (file)
@@ -388,16 +388,21 @@ install(TARGETS ${APPLICATION_EXECUTABLE}
 #FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unnecessary
 # currently it needs to be done because the code right above needs to be executed no matter
 # if building a bundle or not and the install_qt4_executable needs to be called afterwards
+#
+# OSX: Run macdeployqt for src/gui and for src/cmd using the -executable option
 if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
     get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
     get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
     find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")
 
+    set(cmd_NAME ${APPLICATION_EXECUTABLE}cmd)
+
     add_custom_command(TARGET ${APPLICATION_EXECUTABLE} POST_BUILD
         COMMAND "${MACDEPLOYQT_EXECUTABLE}"
             "$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/../.."
             -qmldir=${CMAKE_SOURCE_DIR}/src/gui
             -always-overwrite
+            -executable="$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/${cmd_NAME}"
         COMMENT "Running macdeployqt..."
     )
 endif()