Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if(WIN32)
endif()
option(CLIP_EXAMPLES "Compile clip examples" on)
option(CLIP_TESTS "Compile clip tests" on)
option(CLIP_INSTALL "Enable clip installation" on)
if(UNIX AND NOT APPLE)
option(CLIP_X11_WITH_PNG "Compile with libpng to support copy/paste image in png format" on)
endif()
Expand Down Expand Up @@ -104,3 +105,35 @@ if(CLIP_TESTS)
enable_testing()
add_subdirectory(tests)
endif()

if(CLIP_INSTALL)
include(GNUInstallDirs)

install(
FILES clip.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
TARGETS clip
EXPORT clip-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
EXPORT clip-targets
NAMESPACE clip::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/clip
)

include(CMakePackageConfigHelpers)

configure_package_config_file(
clip-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/clip-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/clip
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/clip-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/clip
)
endif()
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ int main() {
[list_clip_formats](examples/list_clip_formats.cpp) example.
* `CLIP_EXAMPLES`: Compile [examples](examples/).
* `CLIP_TESTS`: Compile [tests](tests/).
* `CLIP_INSTALL`: Generate installation rules for CMake.
* `CLIP_X11_WITH_PNG` (only for Linux/X11): Enables support to
copy/paste images using the `libpng` library on Linux.

Expand Down
4 changes: 4 additions & 0 deletions clip-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake")
check_required_components("@CMAKE_PROJECT_NAME@")