Hello everyone,

I try to install a bundle application on macOS.

I successfully create the bundle and add all dependencies to Qt event the
plugin platform libqcocoa.dylib.

Unfortunately, when I launch the installed app, the window style is not the
same as the build app style (macOS) as you can see on the joined
screenshots.

The CMakeLists.txt script is (too?) simple:

cmake_minimum_required(VERSION 3.2 FATAL_ERROR)

project(testProj)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)

get_target_property(QtCore_location Qt5::Core LOCATION)
get_target_property(QtWidgets_location Qt5::Widgets LOCATION)

include_directories(${QtCore_location} ${QtWidgets_location})

add_executable(${PROJECT_NAME} MACOSX_BUNDLE main.cpp MainWindow.cpp
MainWindow.hpp MainWindow.ui)
set_target_properties(${PROJECT_NAME} PROPERTIES
        CXX_STANDARD 14
        CXX_STANDARD_REQUIRED YES
        CXX_EXTENSIONS NO)

install(TARGETS ${PROJECT_NAME} DESTINATION ".")

target_link_libraries(${PROJECT_NAME} Qt5::Widgets)

set_target_properties(${PROJECT_NAME}
PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}"
)

include(InstallRequiredSystemLibraries)
include(DeployQt5)

get_target_property(build_dir ${PROJECT_NAME} BINARY_DIR)
get_target_property(target_name ${PROJECT_NAME} NAME)
get_target_property(isbundle ${PROJECT_NAME} MACOSX_BUNDLE)

get_filename_component(qt_dlls_dir "${QtWidgets_location}" PATH)
get_filename_component(qt_dlls_dir "${qt_dlls_dir}" PATH)
set(dirs "${qt_dlls_dir}")

if(WIN32)
    set(suffix ".exe")
endif()

if (${isbundle})
    set(exe ${target_name}.app)
else()
    set(exe ${target_name}${suffix})
endif()

install_qt5_executable(${exe} "" "" "${dirs}" "" "")

I don't understand why the plugin libqcocoa.dylib is not used for the
installed app.

I try to read the CMake script available (such as Paraview or Slicer3D),
but it's a little too much time consuming.

Is there some simple example available?

Thank you,

Romain

<<attachment: SimpleProject.zip>>

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to