based

Opinionated utility library
git clone git://git.dimitrijedobrota.com/based.git
Log | Files | Refs | README | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |

CMakeLists.txt (1904B)


1 cmake_minimum_required(VERSION 3.14) 2 3 include(cmake/prelude.cmake) 4 5 project( 6 based 7 VERSION 0.1.0 8 DESCRIPTION "Opinionated utility library" 9 HOMEPAGE_URL "https://git.dimitrijedobrota.com/based.git" 10 LANGUAGES 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 based_based 20 source/instrumentation.cpp 21 ) 22 add_library(based::based ALIAS based_based) 23 24 include(GenerateExportHeader) 25 generate_export_header( 26 based_based 27 BASE_NAME based 28 EXPORT_FILE_NAME export/based/based_export.hpp 29 CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251 30 ) 31 32 if(NOT BUILD_SHARED_LIBS) 33 target_compile_definitions(based_based PUBLIC BASED_STATIC_DEFINE) 34 endif() 35 36 set_target_properties( 37 based_based PROPERTIES 38 CXX_VISIBILITY_PRESET hidden 39 VISIBILITY_INLINES_HIDDEN YES 40 VERSION "${PROJECT_VERSION}" 41 SOVERSION "${PROJECT_VERSION_MAJOR}" 42 EXPORT_NAME based 43 OUTPUT_NAME based 44 ) 45 46 target_include_directories( 47 based_based ${warning_guard} 48 PUBLIC 49 "\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>" 50 ) 51 52 target_include_directories( 53 based_based SYSTEM 54 PUBLIC 55 "\$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/export>" 56 ) 57 58 target_compile_features(based_based PUBLIC cxx_std_20) 59 60 find_package(fmt REQUIRED) 61 target_link_libraries(based_based PRIVATE fmt::fmt) 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." "${based_DEVELOPER_MODE}") 73 if(BUILD_EXAMPLES) 74 add_subdirectory(example) 75 endif() 76 endif() 77 78 # ---- Developer mode ---- 79 80 if(NOT based_DEVELOPER_MODE) 81 return() 82 elseif(NOT PROJECT_IS_TOP_LEVEL) 83 message( 84 AUTHOR_WARNING 85 "Developer mode is intended for developers of based" 86 ) 87 endif() 88 89 include(cmake/dev-mode.cmake)