diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7779078842a0e..af07569cda9ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,9 +108,9 @@ set(SHAREDIR ${DATADIR})
# BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX
if(APPLE AND (NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE))
set(BUILD_OWNCLOUD_OSX_BUNDLE ON)
- set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app")
- set(LIB_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
- set(BIN_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
+ set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_NAME}.app")
+ set(LIB_INSTALL_DIR "${APPLICATION_NAME}.app/Contents/MacOS")
+ set(BIN_INSTALL_DIR "${APPLICATION_NAME}.app/Contents/MacOS")
# BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX
elseif(APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE)
diff --git a/admin/osx/macosx.pkgproj.cmake b/admin/osx/macosx.pkgproj.cmake
index 0552e1c3235fa..50d33831023b1 100644
--- a/admin/osx/macosx.pkgproj.cmake
+++ b/admin/osx/macosx.pkgproj.cmake
@@ -22,7 +22,7 @@
GID
80
PATH
- @APPLICATION_EXECUTABLE@.app
+ @APPLICATION_NAME@.app
PATH_TYPE
3
PERMISSIONS
diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt
index cea2066006c19..81c2460e0107e 100644
--- a/src/cmd/CMakeLists.txt
+++ b/src/cmd/CMakeLists.txt
@@ -27,24 +27,20 @@ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
endif()
if(NOT BUILD_LIBRARIES_ONLY)
- add_executable(${cmd_NAME} cmd.cpp)
- set_target_properties(${cmd_NAME} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} )
+ add_executable(${cmd_NAME} cmd.cpp)
- target_link_libraries(${cmd_NAME} cmdCore)
-endif()
+ if(BUILD_OWNCLOUD_OSX_BUNDLE)
+ set_target_properties(${cmd_NAME} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS")
+ else()
+ set_target_properties(${cmd_NAME} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
-# 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"
- "$"
- "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS"
- COMMENT "Copying nextcloudcmd..."
- )
-elseif(NOT BUILD_LIBRARIES_ONLY)
install(TARGETS ${cmd_NAME}
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif()
+
+ target_link_libraries(${cmd_NAME} cmdCore)
endif()
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 671b19d6b52f1..e96e539dd4371 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -311,6 +311,11 @@ else()
# we must add MACOSX_BUNDLE only if building a bundle
add_executable(${APPLICATION_EXECUTABLE} WIN32 MACOSX_BUNDLE main.cpp ${APP_ICON})
+ if (BUILD_OWNCLOUD_OSX_BUNDLE)
+ set_target_properties(${APPLICATION_EXECUTABLE} PROPERTIES
+ OUTPUT_NAME "${APPLICATION_NAME}")
+ endif()
+
set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations)
install(FILES ${client_I18N} DESTINATION ${QM_DIR})
get_target_property(_qmake Qt5::qmake LOCATION)