Skip to content

Commit 0c88457

Browse files
chris-seChristian Seiler
andauthored
Fix CMake build on macOS (don't try to link against Qt's X11Extras) (#267)
macOS is identified as UNIX by CMake, but Qt doesn't actually use X11 there (and X11 support is not available by default anyway). Change the condition that includes X11Extras to if (UNIX AND NOT APPLE) instead of just if (UNIX) to mitigate that. This makes the build on macOS work with CMake. Co-authored-by: Christian Seiler <c.seiler@luxflux.de>
1 parent 46fa22d commit 0c88457

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

adsConfig.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ include(CMakeFindDependencyMacro)
22
find_dependency(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
33
find_dependency(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
44
find_dependency(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
5-
find_dependency(Qt5X11Extras ${REQUIRED_QT_VERSION} REQUIRED)
5+
if(UNIX AND NOT APPLE)
6+
find_dependency(Qt5X11Extras ${REQUIRED_QT_VERSION} REQUIRED)
7+
endif()
68
include("${CMAKE_CURRENT_LIST_DIR}/adsTargets.cmake")

src/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.5)
22
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
33
find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED)
4-
if (UNIX)
4+
if (UNIX AND NOT APPLE)
55
find_package(Qt5 5.5 COMPONENTS X11Extras REQUIRED)
66
endif()
77
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -48,7 +48,7 @@ set(ads_HEADERS
4848
IconProvider.h
4949
DockComponentsFactory.h
5050
)
51-
if (UNIX)
51+
if (UNIX AND NOT APPLE)
5252
set(ads_SRCS linux/FloatingWidgetTitleBar.cpp ${ads_SRCS})
5353
set(ads_HEADERS linux/FloatingWidgetTitleBar.h ${ads_HEADERS})
5454
endif()
@@ -60,7 +60,7 @@ else()
6060
target_compile_definitions(qtadvanceddocking PRIVATE ADS_SHARED_EXPORT)
6161
endif()
6262
target_link_libraries(qtadvanceddocking PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets)
63-
if (UNIX)
63+
if (UNIX AND NOT APPLE)
6464
target_link_libraries(qtadvanceddocking PUBLIC Qt5::X11Extras)
6565
endif()
6666
set_target_properties(qtadvanceddocking PROPERTIES

0 commit comments

Comments
 (0)