Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Add option enable/disable the build of examples #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
22 changes: 13 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ endif()

message(STATUS "Build mode: ${CMAKE_BUILD_TYPE}")

option(BUILD_EXAMPLES "Enable examples" ON)

# INFO
set(LINENOISE_VERSION "1.0.0" CACHE path "Linenoise version")
set(LINENOISE_DISPLAY_NAME "Linenoise-NG")
Expand Down Expand Up @@ -90,15 +92,17 @@ install(TARGETS linenoise DESTINATION lib)
install(FILES include/linenoise.h DESTINATION include)

# build example
add_executable(
example
tst/example.c
)

target_link_libraries(
example
linenoise
)
if(BUILD_EXAMPLES)
add_executable(
example
tst/example.c
)

target_link_libraries(
example
linenoise
)
endif(BUILD_EXAMPLES)

# packaging
include(CPack)
Expand Down