Skip to content

Commit

Permalink
Don't use clip_none as fallback to avoid silent errors
Browse files Browse the repository at this point in the history
This might result in an unexpected behavior (using the clip_none impl)
in platforms which clip supports.
  • Loading branch information
dacap committed Jan 26, 2025
1 parent 8b1e104 commit e86a17b
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,37 +64,34 @@ elseif(APPLE)
target_compile_options(clip PRIVATE -fobjc-arc)
endif()

find_library(COCOA_LIBRARY Cocoa)
if(COCOA_LIBRARY)
target_sources(clip PRIVATE clip_osx.mm)
target_link_libraries(clip ${COCOA_LIBRARY})
else()
target_sources(clip PRIVATE clip_none.cpp)
endif()
find_library(COCOA_LIBRARY REQUIRED Cocoa)

target_sources(clip PRIVATE clip_osx.mm)
target_link_libraries(clip ${COCOA_LIBRARY})
elseif(UNIX)
include(CheckIncludeFiles)
check_include_files(xcb/xcb.h HAVE_XCB_XLIB_H)

if(HAVE_XCB_XLIB_H)
target_compile_definitions(clip PRIVATE -DHAVE_XCB_XLIB_H)
target_link_libraries(clip xcb pthread)

if(CLIP_ENABLE_IMAGE AND CLIP_X11_WITH_PNG)
check_include_files(png.h HAVE_PNG_H)
if(CLIP_X11_PNG_LIBRARY)
set(PNG_LIBRARY ${CLIP_X11_PNG_LIBRARY})
else()
find_library(PNG_LIBRARY png)
endif()
if(HAVE_PNG_H AND PNG_LIBRARY)
target_compile_definitions(clip PRIVATE -DHAVE_PNG_H)
endif()
target_link_libraries(clip ${PNG_LIBRARY})
if(NOT HAVE_XCB_XLIB_H)
message(FATAL_ERROR "xcb/xcb.h not found, install libxcb-dev package")
endif()

target_compile_definitions(clip PRIVATE -DHAVE_XCB_XLIB_H)
target_link_libraries(clip xcb pthread)

if(CLIP_ENABLE_IMAGE AND CLIP_X11_WITH_PNG)
check_include_files(png.h HAVE_PNG_H)
if(CLIP_X11_PNG_LIBRARY)
set(PNG_LIBRARY ${CLIP_X11_PNG_LIBRARY})
else()
find_library(PNG_LIBRARY png)
endif()
if(HAVE_PNG_H AND PNG_LIBRARY)
target_compile_definitions(clip PRIVATE -DHAVE_PNG_H)
endif()
target_sources(clip PRIVATE clip_x11.cpp)
else()
target_sources(clip PRIVATE clip_none.cpp)
target_link_libraries(clip ${PNG_LIBRARY})
endif()
target_sources(clip PRIVATE clip_x11.cpp)
else()
target_sources(clip PRIVATE clip_none.cpp)
endif()
Expand Down

0 comments on commit e86a17b

Please sign in to comment.