stamen

Stamen - static menu generator
git clone git://git.dimitrijedobrota.com/stamen.git
Log | Files | Refs | README | LICENSE

CMakeLists.txt (2285B)


      1 cmake_minimum_required(VERSION 3.14)
      2 
      3 include(cmake/prelude.cmake)
      4 
      5 project(
      6     stamen
      7     VERSION 1.2.0
      8     DESCRIPTION "Static menu generator"
      9     HOMEPAGE_URL "https://git.dimitrijedobrota.com/stamen"
     10     LANGUAGES C CXX
     11 )
     12 
     13 include(cmake/project-is-top-level.cmake)
     14 include(cmake/variables.cmake)
     15 
     16 find_package(poafloc 1.1 CONFIG REQUIRED)
     17 
     18 # ---- Declare library ----
     19 
     20 add_library(
     21     stamen_stamen
     22     source/stamen.cpp
     23     source/menu.cpp
     24     source/c_bindings.cpp
     25 )
     26 target_link_libraries(stamen_stamen PUBLIC poafloc::poafloc)
     27 add_library(stamen::stamen ALIAS stamen_stamen)
     28 
     29 include(GenerateExportHeader)
     30 generate_export_header(
     31     stamen_stamen
     32     BASE_NAME stamen
     33     EXPORT_FILE_NAME export/stamen/stamen_export.hpp
     34     CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251
     35 )
     36 
     37 if(NOT BUILD_SHARED_LIBS)
     38   target_compile_definitions(stamen_stamen PUBLIC STAMEN_STATIC_DEFINE)
     39 endif()
     40 
     41 set_target_properties(
     42     stamen_stamen PROPERTIES
     43     CXX_VISIBILITY_PRESET hidden
     44     VISIBILITY_INLINES_HIDDEN YES
     45     VERSION "${PROJECT_VERSION}"
     46     SOVERSION "${PROJECT_VERSION_MAJOR}"
     47     EXPORT_NAME stamen
     48     OUTPUT_NAME stamen
     49 )
     50 
     51 target_include_directories(
     52     stamen_stamen ${warning_guard}
     53     PUBLIC
     54     "\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
     55 )
     56 
     57 target_include_directories(
     58     stamen_stamen SYSTEM
     59     PUBLIC
     60     "\$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/export>"
     61 )
     62 
     63 target_compile_features(stamen_stamen PUBLIC cxx_std_20)
     64 
     65 # ---- Declare executable ----
     66 
     67 add_executable(stamen_exe source/generate.cpp)
     68 add_executable(stamen::exe ALIAS stamen_exe)
     69 
     70 target_link_libraries(stamen_exe PRIVATE stamen::stamen)
     71 set_property(TARGET stamen_exe PROPERTY OUTPUT_NAME stamen)
     72 
     73 target_compile_features(stamen_exe PRIVATE cxx_std_20)
     74 
     75 # ---- Install rules ----
     76 
     77 if(NOT CMAKE_SKIP_INSTALL_RULES)
     78   include(cmake/install-rules.cmake)
     79 endif()
     80 
     81 # ---- Examples ----
     82 
     83 if(PROJECT_IS_TOP_LEVEL)
     84   option(BUILD_EXAMPLES "Build examples tree." "${stamen_DEVELOPER_MODE}")
     85   if(BUILD_EXAMPLES)
     86     add_subdirectory(example)
     87   endif()
     88 endif()
     89 
     90 # ---- Developer mode ----
     91 
     92 if(NOT stamen_DEVELOPER_MODE)
     93   return()
     94 elseif(NOT PROJECT_IS_TOP_LEVEL)
     95   message(
     96       AUTHOR_WARNING
     97       "Developer mode is intended for developers of stamen"
     98   )
     99 endif()
    100 
    101 include(cmake/dev-mode.cmake)