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