Skip to content

Commit e86a17b

Browse files
committed
Don't use clip_none as fallback to avoid silent errors
This might result in an unexpected behavior (using the clip_none impl) in platforms which clip supports.
1 parent 8b1e104 commit e86a17b

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

CMakeLists.txt

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,34 @@ elseif(APPLE)
6464
target_compile_options(clip PRIVATE -fobjc-arc)
6565
endif()
6666

67-
find_library(COCOA_LIBRARY Cocoa)
68-
if(COCOA_LIBRARY)
69-
target_sources(clip PRIVATE clip_osx.mm)
70-
target_link_libraries(clip ${COCOA_LIBRARY})
71-
else()
72-
target_sources(clip PRIVATE clip_none.cpp)
73-
endif()
67+
find_library(COCOA_LIBRARY REQUIRED Cocoa)
68+
69+
target_sources(clip PRIVATE clip_osx.mm)
70+
target_link_libraries(clip ${COCOA_LIBRARY})
7471
elseif(UNIX)
7572
include(CheckIncludeFiles)
7673
check_include_files(xcb/xcb.h HAVE_XCB_XLIB_H)
7774

78-
if(HAVE_XCB_XLIB_H)
79-
target_compile_definitions(clip PRIVATE -DHAVE_XCB_XLIB_H)
80-
target_link_libraries(clip xcb pthread)
81-
82-
if(CLIP_ENABLE_IMAGE AND CLIP_X11_WITH_PNG)
83-
check_include_files(png.h HAVE_PNG_H)
84-
if(CLIP_X11_PNG_LIBRARY)
85-
set(PNG_LIBRARY ${CLIP_X11_PNG_LIBRARY})
86-
else()
87-
find_library(PNG_LIBRARY png)
88-
endif()
89-
if(HAVE_PNG_H AND PNG_LIBRARY)
90-
target_compile_definitions(clip PRIVATE -DHAVE_PNG_H)
91-
endif()
92-
target_link_libraries(clip ${PNG_LIBRARY})
75+
if(NOT HAVE_XCB_XLIB_H)
76+
message(FATAL_ERROR "xcb/xcb.h not found, install libxcb-dev package")
77+
endif()
78+
79+
target_compile_definitions(clip PRIVATE -DHAVE_XCB_XLIB_H)
80+
target_link_libraries(clip xcb pthread)
81+
82+
if(CLIP_ENABLE_IMAGE AND CLIP_X11_WITH_PNG)
83+
check_include_files(png.h HAVE_PNG_H)
84+
if(CLIP_X11_PNG_LIBRARY)
85+
set(PNG_LIBRARY ${CLIP_X11_PNG_LIBRARY})
86+
else()
87+
find_library(PNG_LIBRARY png)
88+
endif()
89+
if(HAVE_PNG_H AND PNG_LIBRARY)
90+
target_compile_definitions(clip PRIVATE -DHAVE_PNG_H)
9391
endif()
94-
target_sources(clip PRIVATE clip_x11.cpp)
95-
else()
96-
target_sources(clip PRIVATE clip_none.cpp)
92+
target_link_libraries(clip ${PNG_LIBRARY})
9793
endif()
94+
target_sources(clip PRIVATE clip_x11.cpp)
9895
else()
9996
target_sources(clip PRIVATE clip_none.cpp)
10097
endif()

0 commit comments

Comments
 (0)