poafloc

poafloc - Parser Of Arguments For Lines Of Commands
git clone git://git.dimitrijedobrota.com/poafloc.git
Log | Files | Refs | README | LICENSE

CMakeLists.txt (1956B)


      1 cmake_minimum_required(VERSION 3.14)
      2 
      3 include(cmake/prelude.cmake)
      4 
      5 project(
      6     poafloc
      7     VERSION 1.1.0
      8     DESCRIPTION "Parser Of Arguments For Lines Of Commands"
      9     HOMEPAGE_URL "https://git.dimitrijedobrota.com/poafloc.git"
     10     LANGUAGES C CXX
     11 )
     12 
     13 include(cmake/project-is-top-level.cmake)
     14 include(cmake/variables.cmake)
     15 
     16 # ---- Declare library ----
     17 
     18 add_library(
     19     poafloc_poafloc
     20     source/poafloc.cpp
     21     source/c_bindings.cpp
     22     source/help.cpp
     23     source/trie.cpp
     24 )
     25 add_library(poafloc::poafloc ALIAS poafloc_poafloc)
     26 
     27 include(GenerateExportHeader)
     28 generate_export_header(
     29     poafloc_poafloc
     30     BASE_NAME poafloc
     31     EXPORT_FILE_NAME export/poafloc/poafloc_export.hpp
     32     CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251
     33 )
     34 
     35 if(NOT BUILD_SHARED_LIBS)
     36   target_compile_definitions(poafloc_poafloc PUBLIC POAFLOC_STATIC_DEFINE)
     37 endif()
     38 
     39 set_target_properties(
     40     poafloc_poafloc PROPERTIES
     41     CXX_VISIBILITY_PRESET hidden
     42     VISIBILITY_INLINES_HIDDEN YES
     43     VERSION "${PROJECT_VERSION}"
     44     SOVERSION "${PROJECT_VERSION_MAJOR}"
     45     EXPORT_NAME poafloc
     46     OUTPUT_NAME poafloc
     47 )
     48 
     49 target_include_directories(
     50     poafloc_poafloc ${warning_guard}
     51     PUBLIC
     52     "\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
     53 )
     54 
     55 target_include_directories(
     56     poafloc_poafloc SYSTEM
     57     PUBLIC
     58     "\$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/export>"
     59 )
     60 
     61 target_compile_features(poafloc_poafloc PUBLIC cxx_std_20)
     62 
     63 # ---- Install rules ----
     64 
     65 if(NOT CMAKE_SKIP_INSTALL_RULES)
     66   include(cmake/install-rules.cmake)
     67 endif()
     68 
     69 # ---- Examples ----
     70 
     71 if(PROJECT_IS_TOP_LEVEL)
     72   option(BUILD_EXAMPLES "Build examples tree." "${poafloc_DEVELOPER_MODE}")
     73   if(BUILD_EXAMPLES)
     74     add_subdirectory(example)
     75   endif()
     76 endif()
     77 
     78 # ---- Developer mode ----
     79 
     80 if(NOT poafloc_DEVELOPER_MODE)
     81   return()
     82 elseif(NOT PROJECT_IS_TOP_LEVEL)
     83   message(
     84       AUTHOR_WARNING
     85       "Developer mode is intended for developers of poafloc"
     86   )
     87 endif()
     88 
     89 include(cmake/dev-mode.cmake)