Fix add_cmake_library to use a correct plugin suffix on macOS

Qt plugins on macOS use .dylib, whereas CMake created used
".so" instead.

Change-Id: I3ea73a52a0675a0cfce4997ca413df79e63cfaa7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Alexandru Croitor 2019-11-14 11:24:14 +01:00
parent 7a6c6da2eb
commit dfc583005b

View File

@ -2678,6 +2678,12 @@ function(qt_add_cmake_library target)
add_library("${target}" MODULE)
set_property(TARGET ${name} PROPERTY C_VISIBILITY_PRESET default)
set_property(TARGET ${name} PROPERTY CXX_VISIBILITY_PRESET default)
if(APPLE)
# CMake defaults to using .so extensions for loadable modules, aka plugins,
# but Qt plugins are actually suffixed with .dylib.
set_property(TARGET "${target}" PROPERTY SUFFIX ".dylib")
endif()
else()
add_library("${target}")
endif()