|
| 1 | +cmake_minimum_required(VERSION 2.6.4) |
| 2 | + |
| 3 | +option(WITH_TESTS "Build tests." OFF) |
| 4 | +option(WITH_EXAMPLE "Build example." OFF) |
| 5 | +option(WITH_STATIC "Build static libs." ON) |
| 6 | + |
| 7 | +project(docopt.cpp) |
| 8 | +include_directories("${PROJECT_SOURCE_DIR}") |
| 9 | + |
| 10 | +######################################################################## |
| 11 | +# docopt |
| 12 | + |
| 13 | +set(DOCOPT_SRC |
| 14 | + docopt.cpp |
| 15 | + docopt.h |
| 16 | + docopt_private.h |
| 17 | + docopt_util.h |
| 18 | + docopt_value.h |
| 19 | +) |
| 20 | +if(WITH_STATIC) |
| 21 | + add_library(docopt_s STATIC ${DOCOPT_SRC}) |
| 22 | +endif() |
| 23 | +add_library(docopt SHARED ${DOCOPT_SRC}) |
| 24 | + |
| 25 | +add_definitions("-std=c++14") |
| 26 | + |
| 27 | +######################################################################## |
| 28 | +# tests |
| 29 | + |
| 30 | +if (WITH_EXAMPLE) |
| 31 | + add_executable(docopt_example examples/naval_fate.cpp) |
| 32 | + target_link_libraries(docopt_example docopt) |
| 33 | +endif() |
| 34 | + |
| 35 | +######################################################################## |
| 36 | +# example |
| 37 | + |
| 38 | +if (WITH_TESTS) |
| 39 | + add_executable(docopt_testcase run_testcase.cpp) |
| 40 | + target_link_libraries(docopt_testcase docopt) |
| 41 | +endif() |
| 42 | + |
| 43 | +######################################################################## |
| 44 | +# installation |
| 45 | + |
| 46 | +INSTALL(TARGETS |
| 47 | + docopt |
| 48 | + DESTINATION lib) |
| 49 | +if(WITH_STATIC) |
| 50 | + INSTALL(TARGETS |
| 51 | + docopt_s |
| 52 | + DESTINATION lib) |
| 53 | +endif() |
| 54 | +INSTALL(FILES |
| 55 | + docopt.h |
| 56 | + docopt_private.h |
| 57 | + docopt_util.h |
| 58 | + docopt_value.h |
| 59 | + DESTINATION include/docopt) |
| 60 | +SET(CPACK_PACKAGE_NAME "docopt") |
| 61 | +SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") |
| 62 | +SET(CPACK_RPM_PACKAGE_REQUIRES "") |
| 63 | +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Beautiful command line interfaces") |
| 64 | +SET(CPACK_PACKAGE_VENDOR "Jared Grubb") |
| 65 | +SET(CPACK_PACKAGE_CONTACT ${CPACK_PACKAGE_VENDOR}) |
| 66 | +SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.rst") |
| 67 | +SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE-MIT") |
| 68 | +SET(CPACK_PACKAGE_VERSION_MAJOR 0) |
| 69 | +SET(CPACK_PACKAGE_VERSION_MINOR 6) |
| 70 | +SET(CPACK_PACKAGE_VERSION_PATCH 1) |
| 71 | +SET(CPACK_DEBIAN_PACKAGE_SECTION "Development") |
| 72 | +SET(CPACK_RPM_PACKAGE_GROUP "Development/Libraries") |
| 73 | +SET(CPACK_RPM_PACKAGE_LICENSE "MIT") |
| 74 | +SET(CPACK_STRIP_FILES TRUE) |
| 75 | +INCLUDE(CPack) |
0 commit comments