CMakeLists.txt (1735B)
1 cmake_minimum_required(VERSION 3.14) 2 3 include(cmake/prelude.cmake) 4 5 project( 6 hemplate 7 VERSION 0.1.10 8 DESCRIPTION "Simple HTML template engine" 9 HOMEPAGE_URL "https://git.dimitrijedobrota.com/hemplate.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 hemplate_hemplate 20 source/element.cpp 21 source/attribute.cpp 22 ) 23 add_library(hemplate::hemplate ALIAS hemplate_hemplate) 24 25 include(GenerateExportHeader) 26 generate_export_header( 27 hemplate_hemplate 28 BASE_NAME hemplate 29 EXPORT_FILE_NAME export/hemplate/hemplate_export.hpp 30 CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251 31 ) 32 33 if(NOT BUILD_SHARED_LIBS) 34 target_compile_definitions(hemplate_hemplate PUBLIC HEMPLATE_STATIC_DEFINE) 35 endif() 36 37 set_target_properties( 38 hemplate_hemplate PROPERTIES 39 CXX_VISIBILITY_PRESET hidden 40 VISIBILITY_INLINES_HIDDEN YES 41 VERSION "${PROJECT_VERSION}" 42 SOVERSION "${PROJECT_VERSION_MAJOR}" 43 EXPORT_NAME hemplate 44 OUTPUT_NAME hemplate 45 ) 46 47 target_include_directories( 48 hemplate_hemplate ${warning_guard} 49 PUBLIC 50 "\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>" 51 ) 52 53 target_include_directories( 54 hemplate_hemplate SYSTEM 55 PUBLIC 56 "\$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/export>" 57 ) 58 59 target_compile_features(hemplate_hemplate PUBLIC cxx_std_20) 60 61 # ---- Install rules ---- 62 63 if(NOT CMAKE_SKIP_INSTALL_RULES) 64 include(cmake/install-rules.cmake) 65 endif() 66 67 # ---- Developer mode ---- 68 69 if(NOT hemplate_DEVELOPER_MODE) 70 return() 71 elseif(NOT PROJECT_IS_TOP_LEVEL) 72 message( 73 AUTHOR_WARNING 74 "Developer mode is intended for developers of hemplate" 75 ) 76 endif() 77 78 include(cmake/dev-mode.cmake)