Add support for examples.
This commit is contained in:
parent
a2e084eda0
commit
b1b03bfa3e
|
@ -20,7 +20,7 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|||
# Project build options.
|
||||
option(WITH_TESTS "Compile tests." NO)
|
||||
# option(WITH_DOC "Generate HTML documentation." YES)
|
||||
# option(WITH_EXAMPLES "Compile examples." NO)
|
||||
option(WITH_EXAMPLES "Compile examples." NO)
|
||||
# option(WITH_DEB "Prepare for the building of .deb packages." NO)
|
||||
# option(WITH_RPM "Prepare for the building of .rpm packages." NO)
|
||||
|
||||
|
@ -36,4 +36,8 @@ if(WITH_TESTS)
|
|||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
if(WITH_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
# include(cmake/packages.cmake)
|
||||
|
|
13
examples/CMakeLists.txt
Normal file
13
examples/CMakeLists.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
include(GNUInstallDirs)
|
||||
|
||||
file(GLOB sources_examples *.cpp)
|
||||
foreach(src ${sources_examples})
|
||||
get_filename_component(bin ${src} NAME_WE)
|
||||
add_executable(${bin} ${src})
|
||||
target_link_libraries(${bin} PRIVATE ${PROJECT_NAME})
|
||||
endforeach()
|
||||
|
||||
if(WITH_DOC)
|
||||
install(FILES ${sources_examples}
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME}/examples")
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user