Skip to content

Commit

Permalink
Examples: Create CMakeLists.txt, enable building
Browse files Browse the repository at this point in the history
  • Loading branch information
jrohel authored and jan-kolarik committed Jun 10, 2024
1 parent f52b14f commit 5a6a665
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PROJECT (librepo C)

OPTION (ENABLE_TESTS "Build test?" ON)
OPTION (ENABLE_DOCS "Build docs?" ON)
OPTION (ENABLE_EXAMPLES "Build examples?" ON)
OPTION (WITH_ZCHUNK "Build with zchunk support" ON)
OPTION (ENABLE_PYTHON "Build Python bindings" ON)
OPTION (USE_GPGME "Use GpgMe (instead of rpm library) for OpenPGP key support" ON)
Expand Down Expand Up @@ -132,3 +133,7 @@ ENDIF (ENABLE_TESTS)
IF (ENABLE_DOCS)
ADD_SUBDIRECTORY (doc)
ENDIF (ENABLE_DOCS)

IF (ENABLE_EXAMPLES)
ADD_SUBDIRECTORY (examples/c)
ENDIF (ENABLE_EXAMPLES)
7 changes: 7 additions & 0 deletions examples/c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FILE(GLOB one_file_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")

FOREACH(file_path ${one_file_sources})
GET_FILENAME_COMPONENT(filename "${file_path}" NAME_WLE)
ADD_EXECUTABLE("${filename}" "${file_path}")
TARGET_LINK_LIBRARIES("${filename}" librepo)
ENDFOREACH()

0 comments on commit 5a6a665

Please sign in to comment.