Compare commits
	
		
			82 Commits
		
	
	
		
			b513e9b15b
			...
			061327890c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 061327890c | |||
| ffa6262670 | |||
| 7a6c8e4a30 | |||
| baa57922b4 | |||
| f512c6d5d2 | |||
| 0ed93acecd | |||
| 46e429bf6b | |||
| dbb57044b4 | |||
| ff55360937 | |||
| d8c4257a0c | |||
| 5651a4767e | |||
| 839d3858c1 | |||
| 6c6f48c468 | |||
| 63d5a966d7 | |||
| 549df845a4 | |||
| 9b8b4fa98e | |||
| f1ebe75238 | |||
| b89987fa82 | |||
| a3cfaf458a | |||
| 87572438e4 | |||
| e4ec257b11 | |||
| 9ff6a41c5a | |||
| b3ad740ab8 | |||
| cfad412b21 | |||
| 8b2fa4fd64 | |||
| 5e600ab490 | |||
| ca7cf2dbfe | |||
| bef7660836 | |||
| dbc0b76a76 | |||
| ab6d9dab66 | |||
| 956a94800f | |||
| 8fbf0a3b3d | |||
| 63c433a82e | |||
| ec1d917195 | |||
| 28cf80381e | |||
| c6414bbc03 | |||
| 894a63237a | |||
| 1bff4d2a0d | |||
| b725122c89 | |||
| 6748c65058 | |||
| 0f5a90952b | |||
| a0cc72077c | |||
| 81bed8b385 | |||
| 6020cb02c0 | |||
| f5151f5a2b | |||
| 5ffcde34e2 | |||
| 0e96514413 | |||
| 39111c890a | |||
| 67cbb07e51 | |||
| eeae991b4c | |||
| e3957adb47 | |||
| 41e27fb251 | |||
| 2be896c4a8 | |||
| e3600e96ce | |||
| 5c90828e4e | |||
| 186d67c4bb | |||
| 2e18f5981b | |||
| ef788f6cc5 | |||
| 954b27fa27 | |||
| a8e546734a | |||
| f2ee747a38 | |||
| a6bb734f49 | |||
| 23be253a8d | |||
| 9df188963e | |||
| aee649f061 | |||
| 4821f16044 | |||
| 2ea38c32c8 | |||
| a4c2efa3d2 | |||
| 1eaded9031 | |||
| d6c1e11d49 | |||
| bc44f42f89 | |||
| ea2b322df6 | |||
| c73c31b380 | |||
| 197e5b3939 | |||
| 8ca93d3115 | |||
| a52a9e7b8a | |||
| 83a9e94e31 | |||
| 4bd8ab0ced | |||
| e5fbb90235 | |||
| 2909f5a9d4 | |||
| 6449929719 | |||
| d1685694ed | 
@@ -175,7 +175,7 @@ with section("markup"):
 | 
			
		||||
with section("lint"):
 | 
			
		||||
 | 
			
		||||
  # a list of lint codes to disable
 | 
			
		||||
  disabled_codes = []
 | 
			
		||||
  disabled_codes = ['C0111','C0113']
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid function names
 | 
			
		||||
  function_pattern = '[0-9a-z_]+'
 | 
			
		||||
							
								
								
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +0,0 @@
 | 
			
		||||
[submodule "thirdparty/sanitizers"]
 | 
			
		||||
	path = thirdparty/sanitizers
 | 
			
		||||
	url = ../../f1x1t/cmake-sanitizers
 | 
			
		||||
@@ -1,19 +1,21 @@
 | 
			
		||||
# cmake-format: off
 | 
			
		||||
if(NOT TARGET create_auxilary_symlinks)
 | 
			
		||||
  if(UNIX)
 | 
			
		||||
    add_custom_target(
 | 
			
		||||
      create_auxilary_symlinks
 | 
			
		||||
      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/files
 | 
			
		||||
      # Ссылка на каталог с журналами
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/log ${CMAKE_BINARY_DIR}/files/log
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink
 | 
			
		||||
              ${CMAKE_SOURCE_DIR}/files/log ${CMAKE_BINARY_DIR}/log
 | 
			
		||||
      # Ссылка на каталог с обрабатываемыми данными
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/lib ${CMAKE_BINARY_DIR}/files/lib
 | 
			
		||||
      # Ссылка на каталог с временными данными
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/cache
 | 
			
		||||
              ${CMAKE_BINARY_DIR}/files/cache
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink
 | 
			
		||||
              ${CMAKE_SOURCE_DIR}/files/var ${CMAKE_BINARY_DIR}/var
 | 
			
		||||
      # Ссылка на каталог с постоянными данными
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/data ${CMAKE_BINARY_DIR}/files/data
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink
 | 
			
		||||
              ${CMAKE_SOURCE_DIR}/files/share ${CMAKE_BINARY_DIR}/share
 | 
			
		||||
      # Ссылка на каталог настроек
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/etc ${CMAKE_BINARY_DIR}/etc)
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E create_symlink
 | 
			
		||||
              ${CMAKE_SOURCE_DIR}/files/etc ${CMAKE_BINARY_DIR}/etc)
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
# cmake-format: on
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,8 @@
 | 
			
		||||
cmake_policy(SET CMP0057 NEW)
 | 
			
		||||
 | 
			
		||||
option(CMLIB_ENABLE_WARNING_FLAGS "Enable autodetected warning flags" ON)
 | 
			
		||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable generation of compile_commands.json." FORCE)
 | 
			
		||||
 | 
			
		||||
# Добавление конфигурации для профилирования
 | 
			
		||||
if(CMAKE_CONFIGURATION_TYPES)
 | 
			
		||||
  if(NOT "Profile" IN_LIST CMAKE_CONFIGURATION_TYPES)
 | 
			
		||||
@@ -21,39 +24,56 @@ else()
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
set(_gcc_debug_flags "-ggdb -fno-omit-frame-pointer")
 | 
			
		||||
set(_gcc_profile_flags "-pg")
 | 
			
		||||
 | 
			
		||||
if(CMAKE_BUILD_TYPE STREQUAL Profile)
 | 
			
		||||
  # Ключи компиляции для режима профилирования в зависимости от типа компилятора
 | 
			
		||||
  if(CMAKE_CXX_COMPILER_IS_Clang OR CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
    set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} -ggdb -pg -fno-omit-frame-pointer" CACHE STRING ""
 | 
			
		||||
                                                                                                 FORCE)
 | 
			
		||||
    set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -ggdb -pg -fno-omit-frame-pointer" CACHE STRING
 | 
			
		||||
                                                                                                     "" FORCE)
 | 
			
		||||
    set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_STATIC_LINKER_FLAGS_PROFILE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_MODULE_LINKER_FLAGS_PROFILE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} ${_gcc_debug_flags} ${_gcc_profile_flags}"
 | 
			
		||||
        CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} ${_gcc_debug_flags} ${_gcc_profile_flags}"
 | 
			
		||||
        CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${_gcc_profile_flags}"
 | 
			
		||||
        CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${_gcc_profile_flags}"
 | 
			
		||||
        CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_STATIC_LINKER_FLAGS_PROFILE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} ${_gcc_profile_flags}"
 | 
			
		||||
        CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_MODULE_LINKER_FLAGS_PROFILE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${_gcc_profile_flags}"
 | 
			
		||||
        CACHE STRING "" FORCE)
 | 
			
		||||
  elseif(CMAKE_CXX_COMPILER_IS_Intel)
 | 
			
		||||
    message("Set options for profiling with Intel C++")
 | 
			
		||||
  elseif(CMAKE_CXX_COMPILER_IS_MSVC)
 | 
			
		||||
    message("Set options for profiling with Visual Studio C++")
 | 
			
		||||
  endif()
 | 
			
		||||
  set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Enable generation of verbose build scripts." FORCE)
 | 
			
		||||
  set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable generation of compile_commands.json." FORCE)
 | 
			
		||||
  set(PROFILE 1)
 | 
			
		||||
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
 | 
			
		||||
  # В режиме отладки подробный вывод сообщений компилятора
 | 
			
		||||
  if(CMAKE_CXX_COMPILER_IS_Clang OR CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
    set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -fno-omit-frame-pointer" CACHE STRING "" FORCE)
 | 
			
		||||
    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -fno-omit-frame-pointer" CACHE STRING "" FORCE)
 | 
			
		||||
    string(REPLACE " ${_gcc_debug_flags}" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
 | 
			
		||||
    set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${_gcc_debug_flags}" CACHE STRING "" FORCE)
 | 
			
		||||
 | 
			
		||||
    string(REPLACE " ${_gcc_debug_flags}" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
 | 
			
		||||
    if(CMLIB_ENABLE_WARNING_FLAGS)
 | 
			
		||||
      set(CMAKE_CXX_FLAGS_DEBUG
 | 
			
		||||
          "${CMAKE_CXX_FLAGS_DEBUG} ${CMLIB_DETECTED_CXX_FLAGS_DEBUG} ${_gcc_debug_flags}" CACHE STRING ""
 | 
			
		||||
                                                                                                 FORCE)
 | 
			
		||||
    else()
 | 
			
		||||
      set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${_gcc_debug_flags}" CACHE STRING "" FORCE)
 | 
			
		||||
    endif()
 | 
			
		||||
  endif()
 | 
			
		||||
  set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Enable generation of verbose build scripts." FORCE)
 | 
			
		||||
  set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable generation of compile_commands.json." FORCE)
 | 
			
		||||
  set(DEBUG 1)
 | 
			
		||||
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
 | 
			
		||||
  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMLIB_DETECTED_CXX_FLAGS}" CACHE STRING "" FORCE)
 | 
			
		||||
  set(RELEASE 1)
 | 
			
		||||
elseif(CMAKE_BUILD_TYPE STREQUAL None)
 | 
			
		||||
  # Режим None используется для статического анализа кода
 | 
			
		||||
  set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Enable generation of verbose build scripts." FORCE)
 | 
			
		||||
  set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable generation of compile_commands.json." FORCE)
 | 
			
		||||
  set(ANALYSIS 1)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
unset(_gcc_debug_flags)
 | 
			
		||||
unset(_gcc_profile_flags)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,17 @@
 | 
			
		||||
# Общие настройки для пакета: организация, автор, версия
 | 
			
		||||
set(CPACK_PACKAGE_VENDOR ${CMLIB_ORGANIZATION_NAME_LOWER})
 | 
			
		||||
set(CPACK_PACKAGE_NAME ${CMLIB_PROJECT_NAME_LOWER})
 | 
			
		||||
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
 | 
			
		||||
set(CPACK_PACKAGE_VENDOR ${CMLIB_ORGANIZATION_NAME_LOWER} CACHE STRING "")
 | 
			
		||||
set(CPACK_PACKAGE_NAME ${CMLIB_PROJECT_NAME_LOWER} CACHE STRING "")
 | 
			
		||||
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION} CACHE STRING "")
 | 
			
		||||
 | 
			
		||||
# Параметры для архива исходных текстов
 | 
			
		||||
if(NOT CPACK_SOURCE_GENERATOR)
 | 
			
		||||
  set(CPACK_SOURCE_GENERATOR "TXZ")
 | 
			
		||||
  set(CPACK_SOURCE_GENERATOR "TGZ")
 | 
			
		||||
endif()
 | 
			
		||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}")
 | 
			
		||||
 | 
			
		||||
# Типы генераторов для бинарных архивов
 | 
			
		||||
if(NOT CPACK_GENERATOR)
 | 
			
		||||
  set(CPACK_GENERATOR "TXZ" "DEB")
 | 
			
		||||
  set(CPACK_GENERATOR "TGZ" "DEB")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Параметры для архива собранного проекта
 | 
			
		||||
@@ -28,10 +28,11 @@ set(CPACK_SOURCE_IGNORE_FILES
 | 
			
		||||
    "${CMAKE_BINARY_DIR}"
 | 
			
		||||
    "^${CMAKE_SOURCE_DIR}/.?build.?/"
 | 
			
		||||
    "^${CMAKE_SOURCE_DIR}/.?output.?/"
 | 
			
		||||
    "^${CMAKE_SOURCE_DIR}/files/lib"
 | 
			
		||||
    "^${CMAKE_SOURCE_DIR}/files/var"
 | 
			
		||||
    "^${CMAKE_SOURCE_DIR}/files/log"
 | 
			
		||||
    "CMakeLists.txt.user.*"
 | 
			
		||||
    ".*.autosave"
 | 
			
		||||
    ".*.status"
 | 
			
		||||
    "~$"
 | 
			
		||||
    "\\\\.swp$")
 | 
			
		||||
 | 
			
		||||
@@ -40,6 +41,7 @@ if(CMLIB_COMPACT_SOURCE_PACKAGE)
 | 
			
		||||
  # Список масок для исключения из архива исходных текстов для более компактного архива
 | 
			
		||||
  set(CPACK_SOURCE_IGNORE_FILES
 | 
			
		||||
      "${CPACK_SOURCE_IGNORE_FILES}"
 | 
			
		||||
      "\\\\.git"
 | 
			
		||||
      "/\\\\.git/"
 | 
			
		||||
      "/\\\\.gitlab-ci/"
 | 
			
		||||
      "\\\\.clang-tidy$"
 | 
			
		||||
@@ -52,6 +54,14 @@ endif()
 | 
			
		||||
 | 
			
		||||
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/CMLibCPackProject.cmake)
 | 
			
		||||
 | 
			
		||||
option(CMLIB_CPACK_DEFAULT_SCHEME "Use packaging default scheme" ON)
 | 
			
		||||
 | 
			
		||||
# Правила для сборки обычных архивов
 | 
			
		||||
if(CMLIB_CPACK_DEFAULT_SCHEME)
 | 
			
		||||
  set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
 | 
			
		||||
  set(CPACK_COMPONENTS_GROUPING IGNORE)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Правила для сборки пакетов для Debian
 | 
			
		||||
include(CMLibCPackDeb)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -16,43 +16,64 @@ if(NOT CPACK_DEB_COMPONENT_INSTALL)
 | 
			
		||||
  set(CPACK_DEB_COMPONENT_INSTALL ON)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Если имя компонента по умолчанию не определено, то устанавливается MAIN
 | 
			
		||||
if(NOT CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
 | 
			
		||||
  set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME MAIN)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# В списке компонентов обязательно должны быть MAIN и DEV
 | 
			
		||||
list(APPEND CPACK_COMPONENTS_ALL MAIN DEV)
 | 
			
		||||
list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL)
 | 
			
		||||
 | 
			
		||||
# Правило формирования имени пакета и файла для компонента MAIN
 | 
			
		||||
set(CPACK_DEBIAN_MAIN_PACKAGE_NAME "${CMLIB_PROJECT_NAME_LOWER}")
 | 
			
		||||
set(CPACK_DEBIAN_MAIN_FILE_NAME
 | 
			
		||||
    "${CMLIB_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb")
 | 
			
		||||
 | 
			
		||||
# Правило формирования имени пакета и файла для остальных компонентов
 | 
			
		||||
foreach(C ${CPACK_COMPONENTS_ALL})
 | 
			
		||||
  if(NOT "${C}" STREQUAL "MAIN")
 | 
			
		||||
    string(TOLOWER "${C}" cl)
 | 
			
		||||
    set(CPACK_DEBIAN_${C}_PACKAGE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${cl}")
 | 
			
		||||
    set(CPACK_DEBIAN_${C}_FILE_NAME
 | 
			
		||||
        "${CMLIB_PROJECT_NAME_LOWER}-${cl}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb")
 | 
			
		||||
if(CMLIB_CPACK_DEFAULT_SCHEME)
 | 
			
		||||
  # Если имя компонента по умолчанию не определено, то устанавливается MAIN
 | 
			
		||||
  if(NOT CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
 | 
			
		||||
    set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME main)
 | 
			
		||||
  endif()
 | 
			
		||||
endforeach()
 | 
			
		||||
 | 
			
		||||
# Если в каталоге ${CMAKE_SOURCE_DIR}/cmake/deb находятся сценарии сопровождающего
 | 
			
		||||
# postinst, preinst, postrm и prerm, то они будут добавлены к пакету.
 | 
			
		||||
if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/deb/preinst")
 | 
			
		||||
  list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/deb/preinst")
 | 
			
		||||
endif()
 | 
			
		||||
if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/deb/postinst")
 | 
			
		||||
  list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/deb/postinst")
 | 
			
		||||
endif()
 | 
			
		||||
if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/deb/prerm")
 | 
			
		||||
  list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/deb/prerm")
 | 
			
		||||
endif()
 | 
			
		||||
if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/deb/postrm")
 | 
			
		||||
  list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/deb/postrm")
 | 
			
		||||
  # В списке компонентов обязательно должны быть main, base-dev, libs-dev и doc
 | 
			
		||||
  list(
 | 
			
		||||
    APPEND
 | 
			
		||||
    CPACK_COMPONENTS_ALL
 | 
			
		||||
    main
 | 
			
		||||
    base-dev
 | 
			
		||||
    libs-dev
 | 
			
		||||
    doc)
 | 
			
		||||
  list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL)
 | 
			
		||||
 | 
			
		||||
  # Правило формирования имени пакета и файла для компонента main
 | 
			
		||||
  set(CPACK_DEBIAN_MAIN_PACKAGE_NAME "${CMLIB_PROJECT_NAME_LOWER}")
 | 
			
		||||
  set(CPACK_DEBIAN_MAIN_FILE_NAME
 | 
			
		||||
      ${CMLIB_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
 | 
			
		||||
 | 
			
		||||
  # Правило формирования имени пакета и файла для компонента base-dev
 | 
			
		||||
  set(CPACK_DEBIAN_BASE-DEV_PACKAGE_NAME "lib${CMLIB_PROJECT_NAME_LOWER}-base-dev")
 | 
			
		||||
  set(CPACK_DEBIAN_BASE-DEV_FILE_NAME
 | 
			
		||||
      lib${CMLIB_PROJECT_NAME_LOWER}-base-dev_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
 | 
			
		||||
 | 
			
		||||
  # Правило формирования имени пакета и файла для компонента libs-dev
 | 
			
		||||
  set(CPACK_DEBIAN_LIBS-DEV_PACKAGE_NAME lib${CMLIB_PROJECT_NAME_LOWER}-dev)
 | 
			
		||||
  set(CPACK_DEBIAN_LIBS-DEV_FILE_NAME
 | 
			
		||||
      lib${CMLIB_PROJECT_NAME_LOWER}-dev_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
 | 
			
		||||
 | 
			
		||||
  set(CPACK_DEBIAN_LIBS-DEV_PACKAGE_DEPENDS "lib${CMLIB_PROJECT_NAME_LOWER}-base-dev")
 | 
			
		||||
 | 
			
		||||
  foreach(component ${CPACK_COMPONENTS_ALL})
 | 
			
		||||
    string(TOLOWER ${component} _cl)
 | 
			
		||||
    string(TOUPPER ${component} _cu)
 | 
			
		||||
    # Правила формирования имени пакета и файла для остальных компонентов
 | 
			
		||||
    if(NOT ${_cl} STREQUAL main AND NOT ${_cl} STREQUAL base-dev AND NOT ${_cl} STREQUAL libs-dev)
 | 
			
		||||
      set(CPACK_DEBIAN_${_cu}_PACKAGE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${_cl}")
 | 
			
		||||
      set(CPACK_DEBIAN_${_cu}_FILE_NAME
 | 
			
		||||
          "${CMLIB_PROJECT_NAME_LOWER}-${_cl}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb")
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    # Если в каталоге ${CMAKE_SOURCE_DIR}/cmake/deb/${_cl} находятся сценарии сопровождающего
 | 
			
		||||
    # postinst, preinst, postrm и prerm, то они будут добавлены к пакету.
 | 
			
		||||
    if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/deb/${_cl}/preinst")
 | 
			
		||||
      list(APPEND CPACK_DEBIAN_${_cu}_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/deb/${_cl}/preinst")
 | 
			
		||||
    endif()
 | 
			
		||||
    if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/deb/${_cl}/postinst")
 | 
			
		||||
      list(APPEND CPACK_DEBIAN_${_cu}_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/deb/${_cl}/postinst")
 | 
			
		||||
    endif()
 | 
			
		||||
    if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/deb/${_cl}/prerm")
 | 
			
		||||
      list(APPEND CPACK_DEBIAN_${_cu}_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/deb/${_cl}/prerm")
 | 
			
		||||
    endif()
 | 
			
		||||
    if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/deb/${_cl}/postrm")
 | 
			
		||||
      list(APPEND CPACK_DEBIAN_${_cu}_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/deb/${_cl}/postrm")
 | 
			
		||||
    endif()
 | 
			
		||||
  endforeach()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(UNIX AND NOT TARGET deb)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,9 @@
 | 
			
		||||
find_program(
 | 
			
		||||
  CLANG_CHECK_EXE
 | 
			
		||||
  NAMES
 | 
			
		||||
    clang-check-13
 | 
			
		||||
    clang-check-12
 | 
			
		||||
    clang-check-11
 | 
			
		||||
    clang-check-10
 | 
			
		||||
    clang-check-9
 | 
			
		||||
    clang-check)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,9 @@
 | 
			
		||||
find_program(
 | 
			
		||||
  CLANG_TIDY_EXE
 | 
			
		||||
  NAMES
 | 
			
		||||
    clang-tidy-13
 | 
			
		||||
    clang-tidy-12
 | 
			
		||||
    clang-tidy-11
 | 
			
		||||
    clang-tidy-10
 | 
			
		||||
    clang-tidy-9
 | 
			
		||||
    clang-tidy)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,82 +1,51 @@
 | 
			
		||||
find_program(
 | 
			
		||||
  CLANG_APPLY_REPLACEMENTS_EXE
 | 
			
		||||
  NAMES
 | 
			
		||||
    clang-apply-replacements-13
 | 
			
		||||
    clang-apply-replacements-12
 | 
			
		||||
    clang-apply-replacements-11
 | 
			
		||||
    clang-apply-replacements-10
 | 
			
		||||
    clang-apply-replacements-9
 | 
			
		||||
    clang-apply-replacements)
 | 
			
		||||
 | 
			
		||||
find_program(CLAZY_EXE NAMES clazy-standalone)
 | 
			
		||||
 | 
			
		||||
if(CLAZY_EXE AND CLANG_APPLY_REPLACEMENTS_EXE)
 | 
			
		||||
  option(CMLIB_CLAZY_FIX "Perform fixes for Clazy" OFF)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
function(add_clazy_check target)
 | 
			
		||||
  find_program(CLAZY_EXE NAMES clazy-standalone)
 | 
			
		||||
  set(_sources ${ARGN})
 | 
			
		||||
  set(_clazy_checks
 | 
			
		||||
      "container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast"
 | 
			
		||||
  )
 | 
			
		||||
  set(_args -checks=level2,${_clazy_checks} -extra-arg="-Wno-unknown-warning-option" -export-fixes=clazy-fixes-file.yaml)
 | 
			
		||||
  set(options)
 | 
			
		||||
  set(oneValueArgs CHECKS)
 | 
			
		||||
  set(multiValueArgs)
 | 
			
		||||
 | 
			
		||||
  cmake_parse_arguments(_CLAZY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
 | 
			
		||||
 | 
			
		||||
  set(_sources ${_CLAZY_UNPARSED_ARGUMENTS})
 | 
			
		||||
  if(NOT _CLAZY_CHECKS)
 | 
			
		||||
    set(_CLAZY_CHECKS
 | 
			
		||||
        "level2,container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast"
 | 
			
		||||
    )
 | 
			
		||||
  endif()
 | 
			
		||||
  set(_args -checks=${_CLAZY_CHECKS} -extra-arg="-Wno-unknown-warning-option"
 | 
			
		||||
            -export-fixes=clazy-fixes-file.yaml)
 | 
			
		||||
 | 
			
		||||
  if(CLAZY_EXE)
 | 
			
		||||
    if(NOT TARGET clazy-check)
 | 
			
		||||
      add_custom_target(clazy-check)
 | 
			
		||||
    endif()
 | 
			
		||||
    add_custom_target(clazy-check-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
                      COMMAND ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
 | 
			
		||||
    if(CMLIB_CLAZY_FIX)
 | 
			
		||||
      add_custom_target(
 | 
			
		||||
        clazy-check-${target}
 | 
			
		||||
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
        COMMAND ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources}
 | 
			
		||||
        COMMAND ${CLANG_APPLY_REPLACEMENTS_EXE} ${CMAKE_BINARY_DIR})
 | 
			
		||||
    else()
 | 
			
		||||
      add_custom_target(clazy-check-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
                        COMMAND ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
 | 
			
		||||
    endif()
 | 
			
		||||
    add_dependencies(clazy-check-${target} ${target})
 | 
			
		||||
    add_dependencies(clazy-check clazy-check-${target})
 | 
			
		||||
 | 
			
		||||
    option(CMLIB_CLAZY_FIX_QT_KEYWORDS "Fix Qt keywords" OFF)
 | 
			
		||||
    option(CMLIB_CLAZY_FIX_RANGE_LOOP_ADD_REF "Fix range loop add reference" OFF)
 | 
			
		||||
    option(CMLIB_CLAZY_FIX_RANGE_LOOP_ADD_QASCONST "Fix range loop add qAsConst" OFF)
 | 
			
		||||
    option(CMLIB_CLAZY_FIX_FUNCTION_ARGS_BY_REF "Fix function args by reference" OFF)
 | 
			
		||||
    option(CMLIB_CLAZY_FIX_OLD_STYLE_CONNECT "Fix old style connect" OFF)
 | 
			
		||||
    option(CMLIB_CLAZY_FIX_STRING_ALLOCATIONS "Fix string allocations" OFF)
 | 
			
		||||
 | 
			
		||||
    if(CMLIB_CLAZY_FIX_QT_KEYWORDS OR
 | 
			
		||||
       CMLIB_CLAZY_FIX_RANGE_LOOP_ADD_REF OR
 | 
			
		||||
       CMLIB_CLAZY_FIX_RANGE_LOOP_ADD_QASCONST OR
 | 
			
		||||
       CMLIB_CLAZY_FIX_FUNCTION_ARGS_BY_REF OR
 | 
			
		||||
       CMLIB_CLAZY_FIX_OLD_STYLE_CONNECT OR
 | 
			
		||||
       CMLIB_CLAZY_FIX_STRING_ALLOCATIONS)
 | 
			
		||||
      if(NOT TARGET clazy-fix)
 | 
			
		||||
        add_custom_target(clazy-fix)
 | 
			
		||||
      endif()
 | 
			
		||||
      if(CMLIB_CLAZY_FIX_QT_KEYWORDS)
 | 
			
		||||
        add_custom_target(clazy-fix-qt-keywords-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
          COMMAND ${CMAKE_COMMAND} -E env "CLAZY_FIXIT=fix-qt-keywords"
 | 
			
		||||
          ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
 | 
			
		||||
        add_dependencies(clazy-fix-qt-keywords-${target} ${target})
 | 
			
		||||
        add_dependencies(clazy-fix clazy-fix-qt-keywords-${target})
 | 
			
		||||
      endif()
 | 
			
		||||
      if(CMLIB_CLAZY_FIX_RANGE_LOOP_ADD_REF)
 | 
			
		||||
        add_custom_target(clazy-fix-range-loop-add-ref-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
          COMMAND ${CMAKE_COMMAND} -E env "CLAZY_FIXIT=fix-range-loop-add-ref"
 | 
			
		||||
          ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
 | 
			
		||||
        add_dependencies(clazy-fix-range-loop-add-ref-${target} ${target})
 | 
			
		||||
        add_dependencies(clazy-fix clazy-fix-range-loop-add-ref-${target})
 | 
			
		||||
      endif()
 | 
			
		||||
      if(CMLIB_CLAZY_FIX_RANGE_LOOP_ADD_QASCONST)
 | 
			
		||||
        add_custom_target(clazy-fix-range-loop-add-qasconst-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
          COMMAND ${CMAKE_COMMAND} -E env "CLAZY_FIXIT=fix-range-loop-add-qasconst"
 | 
			
		||||
          ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
 | 
			
		||||
        add_dependencies(clazy-fix-range-loop-add-qasconst-${target} ${target})
 | 
			
		||||
        add_dependencies(clazy-fix clazy-fix-range-loop-add-qasconst-${target})
 | 
			
		||||
      endif()
 | 
			
		||||
      if(CMLIB_CLAZY_FIX_FUNCTION_ARGS_BY_REF)
 | 
			
		||||
        add_custom_target(clazy-fix-function-args-by-ref-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
          COMMAND ${CMAKE_COMMAND} -E env "CLAZY_FIXIT=fix-function-args-by-ref"
 | 
			
		||||
          ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
 | 
			
		||||
        add_dependencies(clazy-fix-function-args-by-ref-${target} ${target})
 | 
			
		||||
        add_dependencies(clazy-fix clazy-fix-function-args-by-ref-${target})
 | 
			
		||||
      endif()
 | 
			
		||||
      if(CMLIB_CLAZY_FIX_OLD_STYLE_CONNECT)
 | 
			
		||||
        add_custom_target(clazy-fix-old-style-connect-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
          COMMAND ${CMAKE_COMMAND} -E env "CLAZY_FIXIT=fix-old-style-connect"
 | 
			
		||||
          ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
 | 
			
		||||
        add_dependencies(clazy-fix-old-style-connect-${target} ${target})
 | 
			
		||||
        add_dependencies(clazy-fix clazy-fix-old-style-connect-${target})
 | 
			
		||||
      endif()
 | 
			
		||||
      # "fix-qlatin1string-allocations", "qstring-allocations");
 | 
			
		||||
      # "fix-fromLatin1_fromUtf8-allocations", "qstring-allocations");
 | 
			
		||||
      # "fix-fromCharPtrAllocations", "qstring-allocations");
 | 
			
		||||
      if(CMLIB_CLAZY_FIX_STRING_ALLOCATIONS)
 | 
			
		||||
        add_custom_target(clazy-fix-string-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 | 
			
		||||
          COMMAND ${CMAKE_COMMAND} -E env "CLAZY_FIXIT=fix-qlatin1string-allocations"
 | 
			
		||||
          ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
 | 
			
		||||
        add_dependencies(clazy-fix-string-${target} ${target})
 | 
			
		||||
        add_dependencies(clazy-fix clazy-fix-string-${target})
 | 
			
		||||
      endif()
 | 
			
		||||
    endif()
 | 
			
		||||
  else()
 | 
			
		||||
    message(STATUS "CMLIB warning:")
 | 
			
		||||
    message(STATUS "  Clazy standalone analyzer is not found")
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,20 @@ function(add_pvs_check target)
 | 
			
		||||
        ARGS --analysis-mode 29 --exclude-path ${CMAKE_CURRENT_BINARY_DIR}/${target}_autogen
 | 
			
		||||
        MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
 | 
			
		||||
      add_dependencies(pvs-check pvs-check-${target})
 | 
			
		||||
      configure_file("${CMLIB_MODULE_DIR}/hpp/pvs_studio.hpp.in" "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp")
 | 
			
		||||
      get_target_property(target_type ${target} TYPE)
 | 
			
		||||
      if(${target_type} STREQUAL "INTERFACE_LIBRARY")
 | 
			
		||||
        set(target_type INTERFACE)
 | 
			
		||||
      else()
 | 
			
		||||
        set(target_type PRIVATE)
 | 
			
		||||
      endif()
 | 
			
		||||
      if(MSVC)
 | 
			
		||||
        target_compile_options(${target} BEFORE ${target_type} /FI
 | 
			
		||||
                               "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp")
 | 
			
		||||
      else() # GCC/Clang
 | 
			
		||||
        target_compile_options(${target} BEFORE ${target_type} -include
 | 
			
		||||
                               "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp")
 | 
			
		||||
      endif()
 | 
			
		||||
    else()
 | 
			
		||||
      message(STATUS "CMLIB warning:")
 | 
			
		||||
      message(STATUS "  PVS-Studio analyzer is not found")
 | 
			
		||||
 
 | 
			
		||||
@@ -7,9 +7,7 @@ function(add_code_coverage target)
 | 
			
		||||
  if(CMLIB_ENABLE_CODE_COVERAGE)
 | 
			
		||||
    if(CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
      target_compile_options(${target} PUBLIC "--coverage")
 | 
			
		||||
      get_target_property(LF ${target} LINK_FLAGS)
 | 
			
		||||
      string(APPEND LF " --coverage")
 | 
			
		||||
      set_target_properties(${target} PROPERTIES LINK_FLAGS ${LF})
 | 
			
		||||
      set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " --coverage")
 | 
			
		||||
 | 
			
		||||
      if(LCOV_EXE)
 | 
			
		||||
        add_custom_target(
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,10 @@ if(CMAKE_INSTALL_PREFIX STREQUAL PROJECT_BINARY_DIR)
 | 
			
		||||
  message(FATAL_ERROR "Cannot install into build directory")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_INSTALL_PREFIX STREQUAL PROJECT_SOURCE_DIR)
 | 
			
		||||
  message(FATAL_ERROR "Cannot install into source directory")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
include(CMLibDisableInSourceBuild)
 | 
			
		||||
include(CMakeParseArguments)
 | 
			
		||||
include(GNUInstallDirs)
 | 
			
		||||
@@ -12,6 +16,7 @@ if(DEFINED ENV{DEB_HOST_MULTIARCH})
 | 
			
		||||
  string(APPEND CMAKE_INSTALL_LIBDIR "/$ENV{DEB_HOST_MULTIARCH}")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${CMAKE_CXX_SOURCE_FILE_EXTENSIONS};tpp;tcc)
 | 
			
		||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
 | 
			
		||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 | 
			
		||||
 | 
			
		||||
@@ -25,12 +30,14 @@ include(CMLibLSBInfo)
 | 
			
		||||
include(CMLibCompiler)
 | 
			
		||||
include(CMLibCompilerFlags)
 | 
			
		||||
include(CMLibDistCC)
 | 
			
		||||
include(CMLibCompilerFeaturesHPPGenerate)
 | 
			
		||||
include(CMLibGenerateCompilerFeaturesHPP)
 | 
			
		||||
include(CMLibFlagRemove)
 | 
			
		||||
include(CMLibCotire)
 | 
			
		||||
include(CMLibBuildTypes)
 | 
			
		||||
include(CMLibDebugOutput)
 | 
			
		||||
include(CMLibCommonTargetProperties)
 | 
			
		||||
include(CMLibCommonLibraryTarget)
 | 
			
		||||
include(CMLibPkgConfig)
 | 
			
		||||
include(CMLibCodeAnalysisPvsStudio)
 | 
			
		||||
include(CMLibCodeAnalysisClangAnalyze)
 | 
			
		||||
include(CMLibCodeAnalysisClangTidy)
 | 
			
		||||
@@ -43,8 +50,10 @@ include(CMLibDocDoxygen)
 | 
			
		||||
include(CMLibDocBreathe)
 | 
			
		||||
include(CMLibQtTranslation)
 | 
			
		||||
include(CMLibToday)
 | 
			
		||||
include(CMLibGit)
 | 
			
		||||
include(CMLibAuxilarySymlinks)
 | 
			
		||||
include(CMLibConfigHPPGenerate)
 | 
			
		||||
include(CMLibGeneratePrivateConfigHPP)
 | 
			
		||||
include(CMLibNinjaGeneratorHelper)
 | 
			
		||||
include(CMLibExternalProject)
 | 
			
		||||
include(CMLibCPack)
 | 
			
		||||
include(CMLibUninstall)
 | 
			
		||||
 
 | 
			
		||||
@@ -5,36 +5,33 @@ function(add_common_library target)
 | 
			
		||||
  set(multiValueArgs SOURCES)
 | 
			
		||||
 | 
			
		||||
  cmake_parse_arguments(_LOCAL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
 | 
			
		||||
  set(SOURCES ${_LOCAL_SOURCES})
 | 
			
		||||
 | 
			
		||||
  if(_LOCAL_OUTPUT_NAME)
 | 
			
		||||
    set(OUTNAME ${_LOCAL_OUTPUT_NAME})
 | 
			
		||||
    set(output_name ${_LOCAL_OUTPUT_NAME})
 | 
			
		||||
  else()
 | 
			
		||||
    set(OUTNAME ${target})
 | 
			
		||||
    set(output_name ${target})
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  add_library(${target} OBJECT ${SOURCES})
 | 
			
		||||
  add_library(${target} OBJECT ${_LOCAL_SOURCES})
 | 
			
		||||
  target_include_directories(
 | 
			
		||||
    ${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
 | 
			
		||||
                     $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/${target}>)
 | 
			
		||||
  set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
 | 
			
		||||
 | 
			
		||||
  # cmake-format: off
 | 
			
		||||
  if(BUILD_SHARED_LIBS)
 | 
			
		||||
    add_library(${target}_shared SHARED $<TARGET_OBJECTS:${target}>)
 | 
			
		||||
    set_target_properties(
 | 
			
		||||
      ${target}_shared
 | 
			
		||||
      PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} OUTPUT_NAME ${OUTNAME}
 | 
			
		||||
                 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
 | 
			
		||||
    set_target_properties(${target}_shared PROPERTIES OUTPUT_NAME ${output_name}
 | 
			
		||||
      VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}
 | 
			
		||||
      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
 | 
			
		||||
    install(TARGETS ${target}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  if(NOT SKIP_STATIC_LIBS)
 | 
			
		||||
    add_library(${target}_static STATIC $<TARGET_OBJECTS:${target}>)
 | 
			
		||||
    set_target_properties(${target}_static PROPERTIES OUTPUT_NAME ${OUTNAME} ARCHIVE_OUTPUT_DIRECTORY
 | 
			
		||||
                                                                             ${CMAKE_INSTALL_LIBDIR})
 | 
			
		||||
    set_target_properties(${target}_static PROPERTIES OUTPUT_NAME ${output_name}
 | 
			
		||||
      ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
 | 
			
		||||
    install(TARGETS ${target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${target}.pc)
 | 
			
		||||
  install(FILES ${CMAKE_BINARY_DIR}/${target}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 | 
			
		||||
  # cmake-format: on
 | 
			
		||||
endfunction()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,76 +1,80 @@
 | 
			
		||||
set(COMMON_CXX_FEATURES cxx_alias_templates cxx_nullptr cxx_override)
 | 
			
		||||
 | 
			
		||||
function(common_target_properties target)
 | 
			
		||||
  get_target_property(__type ${target} TYPE)
 | 
			
		||||
  get_target_property(_targetType ${target} TYPE)
 | 
			
		||||
 | 
			
		||||
  set(__visibility PUBLIC)
 | 
			
		||||
  if(__type STREQUAL INTERFACE_LIBRARY)
 | 
			
		||||
  if(_targetType STREQUAL INTERFACE_LIBRARY)
 | 
			
		||||
    set(__interface 1)
 | 
			
		||||
    set(__visibility INTERFACE)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  get_target_property(__sources ${target} SOURCES)
 | 
			
		||||
  foreach(__src IN LISTS __sources)
 | 
			
		||||
    string(REGEX MATCH ".*/qrc_.*\\.cpp$" __qrc ${__src})
 | 
			
		||||
  foreach(src IN LISTS __sources)
 | 
			
		||||
    string(REGEX MATCH ".*/qrc_.*\\.cpp$" __qrc ${src})
 | 
			
		||||
    if(__qrc)
 | 
			
		||||
      set_property(SOURCE ${__qrc} PROPERTY COTIRE_EXCLUDED ON)
 | 
			
		||||
    endif()
 | 
			
		||||
  endforeach()
 | 
			
		||||
 | 
			
		||||
  target_compile_features(${target} ${__visibility} ${COMMON_CXX_FEATURES})
 | 
			
		||||
  get_target_property(_targetType ${target} TYPE)
 | 
			
		||||
  if(_targetType STREQUAL "EXECUTABLE" AND CMAKE_CXX_COMPILE_OPTIONS_PIE)
 | 
			
		||||
    target_compile_options(${target} PUBLIC "${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
 | 
			
		||||
  if(_targetType STREQUAL "EXECUTABLE")
 | 
			
		||||
    set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
 | 
			
		||||
                                               ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
 | 
			
		||||
    if(CMAKE_CXX_COMPILE_OPTIONS_PIE)
 | 
			
		||||
      target_compile_options(${target} PUBLIC "${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
 | 
			
		||||
    endif()
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  target_include_directories(
 | 
			
		||||
    ${target}
 | 
			
		||||
    PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
 | 
			
		||||
           $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
 | 
			
		||||
 | 
			
		||||
  if(APPLE)
 | 
			
		||||
    target_compile_definitions(${target} ${__visibility} Darwin)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  if(NOT __interface)
 | 
			
		||||
    if(TARGET Qt5::Core)
 | 
			
		||||
      if(_targetType STREQUAL "EXECUTABLE")
 | 
			
		||||
        target_compile_options(${target} PUBLIC "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
 | 
			
		||||
      endif()
 | 
			
		||||
      if(NOT CMLIB_DEBUG_OUTPUT)
 | 
			
		||||
        add_definitions(-DQT_NO_DEBUG_OUTPUT)
 | 
			
		||||
      endif()
 | 
			
		||||
      if(NOT CMLIB_INFO_OUTPUT)
 | 
			
		||||
        add_definitions(-DQT_NO_INFO_OUTPUT)
 | 
			
		||||
      endif()
 | 
			
		||||
      if(NOT CMLIB_WARNING_OUTPUT)
 | 
			
		||||
        add_definitions(-DQT_NO_WARNING_OUTPUT)
 | 
			
		||||
      endif()
 | 
			
		||||
    endif()
 | 
			
		||||
    if(CMAKE_CXX_COMPILER_IS_GCC AND NOT APPLE)
 | 
			
		||||
      set_target_properties(${target} PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
 | 
			
		||||
      set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--no-as-needed")
 | 
			
		||||
    endif()
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  # LTO only for executables (not libraries) in Release build type
 | 
			
		||||
  get_target_property(target_type ${target} TYPE)
 | 
			
		||||
  if(target_type STREQUAL "EXECUTABLE" AND CMAKE_BUILD_TYPE STREQUAL "Release")
 | 
			
		||||
  if(_targetType STREQUAL "EXECUTABLE" AND CMAKE_BUILD_TYPE STREQUAL "Release")
 | 
			
		||||
    check_cxx_compiler_flag(-flto CXX_HAS_LTO_FLAG)
 | 
			
		||||
    check_cxx_compiler_flag(-fno-fat-lto-objects CXX_HAS_NO_FAT_LTO_FLAG)
 | 
			
		||||
    if(CMAKE_CXX_COMPILER_IS_GCC AND CXX_HAS_LTO_FLAG)
 | 
			
		||||
      find_program(CMAKE_GCC_AR NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_TOOLCHAIN_SUFFIX}"
 | 
			
		||||
                                      "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar" HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 | 
			
		||||
      find_program(CMAKE_GCC_NM NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm${_CMAKE_TOOLCHAIN_SUFFIX}"
 | 
			
		||||
                                      "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm" HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 | 
			
		||||
      find_program(
 | 
			
		||||
        CMAKE_GCC_RANLIB NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_TOOLCHAIN_SUFFIX}"
 | 
			
		||||
                               "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib" HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 | 
			
		||||
      if(CMAKE_GCC_AR AND CMAKE_GCC_NM AND CMAKE_GCC_RANLIB)
 | 
			
		||||
        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
 | 
			
		||||
        if(CXX_HAS_NO_FAT_LTO_FLAG)
 | 
			
		||||
          set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-fat-lto-objects")
 | 
			
		||||
        endif()
 | 
			
		||||
        set(CMAKE_AR "${CMAKE_GCC_AR}")
 | 
			
		||||
        set(CMAKE_NM "${CMAKE_GCC_NM}")
 | 
			
		||||
        set(CMAKE_RANLIB "${CMAKE_GCC_RANLIB}")
 | 
			
		||||
      else()
 | 
			
		||||
        message(WARNING "GCC indicates LTO support, but binutils wrappers could not be found. Disabling LTO.")
 | 
			
		||||
    if(CXX_HAS_LTO_FLAG)
 | 
			
		||||
      target_compile_options(${target} PUBLIC "-flto")
 | 
			
		||||
      set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " -flto")
 | 
			
		||||
      if(CXX_HAS_NO_FAT_LTO_FLAG)
 | 
			
		||||
        target_compile_options(${target} PUBLIC "-fno-fat-lto-objects")
 | 
			
		||||
        set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " -fno-fat-lto-objects")
 | 
			
		||||
      endif()
 | 
			
		||||
    else()
 | 
			
		||||
      check_enable_compiler_flag(-flto)
 | 
			
		||||
      check_enable_compiler_flag(-fno-fat-lto-objects)
 | 
			
		||||
    endif()
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  set_target_properties(${target} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER ${CMLIB_COTIRE_ENABLE_PRECOMPILED_HEADER})
 | 
			
		||||
  set_target_properties(${target} PROPERTIES COTIRE_ADD_UNITY_BUILD ${CMLIB_COTIRE_ADD_UNITY_BUILD})
 | 
			
		||||
  # cmake-format: off
 | 
			
		||||
  set_property(TARGET ${target}
 | 
			
		||||
               PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${CMLIB_COTIRE_ENABLE_PRECOMPILED_HEADER})
 | 
			
		||||
  set_property(TARGET ${target}
 | 
			
		||||
               PROPERTY COTIRE_ADD_UNITY_BUILD ${CMLIB_COTIRE_ADD_UNITY_BUILD})
 | 
			
		||||
# cmake-format: on
 | 
			
		||||
 | 
			
		||||
  if(CMAKE_BUILD_TYPE STREQUAL Profile)
 | 
			
		||||
    target_compile_definitions(${target} ${__visibility} PROFILE)
 | 
			
		||||
@@ -81,9 +85,6 @@ function(common_target_properties target)
 | 
			
		||||
  elseif(CMAKE_BUILD_TYPE STREQUAL None)
 | 
			
		||||
    target_compile_definitions(${target} ${__visibility} ANALYSIS)
 | 
			
		||||
  endif()
 | 
			
		||||
  target_compile_definitions(
 | 
			
		||||
    ${target}
 | 
			
		||||
    ${__visibility}
 | 
			
		||||
    "TARGET_LSB_ID_${LSB_DISTRIBUTOR_ID}"
 | 
			
		||||
    "TARGET_LSB_CODENAME_${LSB_CODENAME}")
 | 
			
		||||
  target_compile_definitions(${target} ${__visibility} "TARGET_LSB_ID_${LSB_DISTRIBUTOR_ID}")
 | 
			
		||||
  target_compile_definitions(${target} ${__visibility} "TARGET_LSB_CODENAME_${LSB_CODENAME}")
 | 
			
		||||
endfunction()
 | 
			
		||||
 
 | 
			
		||||
@@ -19,3 +19,28 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 | 
			
		||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
 | 
			
		||||
  set(CMAKE_CXX_COMPILER_IS_MSVC ON)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Предпочтительные пути к утилитам для компоновки
 | 
			
		||||
if(CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
  find_program(
 | 
			
		||||
    CMAKE_GCC_AR NAMES "/usr/e2k-linux/bin/ar" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_TOOLCHAIN_SUFFIX}"
 | 
			
		||||
                       "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar" "ar" HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 | 
			
		||||
  if(CMAKE_GCC_AR)
 | 
			
		||||
    set(CMAKE_AR ${CMAKE_GCC_AR} CACHE STRING "" FORCE)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  find_program(
 | 
			
		||||
    CMAKE_GCC_NM NAMES "/usr/e2k-linux/bin/nm" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm${_CMAKE_TOOLCHAIN_SUFFIX}"
 | 
			
		||||
                       "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm" "nm" HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 | 
			
		||||
  if(CMAKE_GCC_NM)
 | 
			
		||||
    set(CMAKE_NM ${CMAKE_GCC_NM} CACHE STRING "" FORCE)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  find_program(
 | 
			
		||||
    CMAKE_GCC_RANLIB
 | 
			
		||||
    NAMES "/usr/e2k-linux/bin/ranlib" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_TOOLCHAIN_SUFFIX}"
 | 
			
		||||
          "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib" "ranlib" HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 | 
			
		||||
  if(CMAKE_GCC_RANLIB)
 | 
			
		||||
    set(CMAKE_RANLIB ${CMAKE_GCC_RANLIB} CACHE STRING "" FORCE)
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
include(WriteCompilerDetectionHeader)
 | 
			
		||||
 | 
			
		||||
write_compiler_detection_header(
 | 
			
		||||
  FILE include/compiler_features.hpp
 | 
			
		||||
  PREFIX ${CMLIB_PROJECT_NAME_CANONICAL}
 | 
			
		||||
  COMPILERS GNU Clang MSVC Intel
 | 
			
		||||
  FEATURES
 | 
			
		||||
    cxx_nullptr
 | 
			
		||||
    cxx_override
 | 
			
		||||
    cxx_alignas
 | 
			
		||||
    cxx_alignof
 | 
			
		||||
    cxx_attributes
 | 
			
		||||
    cxx_auto_type
 | 
			
		||||
    cxx_constexpr
 | 
			
		||||
    cxx_digit_separators
 | 
			
		||||
    cxx_range_for)
 | 
			
		||||
@@ -1,7 +1,5 @@
 | 
			
		||||
# based on https://github.com/bluescarni/yacma
 | 
			
		||||
 | 
			
		||||
option(CMLIB_WARNING_FLAGS "Enable warning flags" ON)
 | 
			
		||||
 | 
			
		||||
include(CheckCXXCompilerFlag)
 | 
			
		||||
 | 
			
		||||
macro(CHECK_ENABLE_CXX_FLAG flag)
 | 
			
		||||
@@ -10,8 +8,8 @@ macro(CHECK_ENABLE_CXX_FLAG flag)
 | 
			
		||||
  unset(CMAKE_REQUIRED_QUIET)
 | 
			
		||||
 | 
			
		||||
  if(CHECK_CXX_FLAG)
 | 
			
		||||
    message(STATUS "'${flag}': flag is enabled.")
 | 
			
		||||
    add_compile_options("${flag}")
 | 
			
		||||
    message(STATUS "'${flag}': flag is supported.")
 | 
			
		||||
    string(CONCAT _CMLIB_DETECTED_CXX_FLAGS "${_CMLIB_DETECTED_CXX_FLAGS} ${flag}")
 | 
			
		||||
  else()
 | 
			
		||||
    message(STATUS "'${flag}': flag is NOT supported.")
 | 
			
		||||
  endif()
 | 
			
		||||
@@ -19,103 +17,201 @@ macro(CHECK_ENABLE_CXX_FLAG flag)
 | 
			
		||||
  unset(CHECK_CXX_FLAG CACHE)
 | 
			
		||||
endmacro()
 | 
			
		||||
 | 
			
		||||
if(LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" AND LSB_CODENAME STREQUAL "smolensk" AND LSB_RELEASE STREQUAL
 | 
			
		||||
                                                                                       "1.5")
 | 
			
		||||
  set(_CMAKE_TOOLCHAIN_PREFIX "x86_64-linux-gnu-")
 | 
			
		||||
  set(_CMAKE_TOOLCHAIN_SUFFIX "-4.7")
 | 
			
		||||
  set(_CMAKE_TOOLCHAIN_LOCATION} "/usr/bin")
 | 
			
		||||
else()
 | 
			
		||||
  # -Wshadow gives a lot of false positives with GCC 4.7.2 in Astra Linux 1.5
 | 
			
		||||
  if(CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
    check_enable_cxx_flag(-Wshadow)
 | 
			
		||||
macro(CHECK_ENABLE_DEBUG_CXX_FLAG flag)
 | 
			
		||||
  if(CMAKE_BUILD_TYPE STREQUAL "Debug")
 | 
			
		||||
    set(CMAKE_REQUIRED_QUIET TRUE)
 | 
			
		||||
    check_cxx_compiler_flag("${flag}" CHECK_CXX_FLAG_DEBUG)
 | 
			
		||||
    unset(CMAKE_REQUIRED_QUIET)
 | 
			
		||||
 | 
			
		||||
    if(CHECK_CXX_FLAG_DEBUG)
 | 
			
		||||
      message(STATUS "'${flag}': debug flag is supported.")
 | 
			
		||||
      string(CONCAT _CMLIB_DETECTED_CXX_FLAGS_DEBUG "${_CMLIB_DETECTED_CXX_FLAGS_DEBUG} ${flag}")
 | 
			
		||||
    else()
 | 
			
		||||
      message(STATUS "'${flag}': debug flag is NOT supported.")
 | 
			
		||||
    endif()
 | 
			
		||||
    # NOTE: check_cxx_compiler stores variables in the cache.
 | 
			
		||||
    unset(CHECK_CXX_FLAG_DEBUG CACHE)
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
endmacro()
 | 
			
		||||
 | 
			
		||||
# Common configuration for GCC, clang and Intel.
 | 
			
		||||
if(CMAKE_CXX_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_IS_INTEL OR CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
  set(CMAKE_CXX_STANDARD 11)
 | 
			
		||||
  set(CMAKE_CXX_STANDARD_REQUIRED YES)
 | 
			
		||||
  set(CMAKE_CXX_EXTENSIONS YES)
 | 
			
		||||
function(cmlib_set_cxx_standard version)
 | 
			
		||||
  # Выбор стандарта по умолчанию (можно переопределить в проекте)
 | 
			
		||||
  set(CMAKE_CXX_STANDARD_REQUIRED YES PARENT_SCOPE)
 | 
			
		||||
 | 
			
		||||
  if(CMLIB_WARNING_FLAGS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
 | 
			
		||||
    check_enable_cxx_flag(-Wall)
 | 
			
		||||
    check_enable_cxx_flag(-Wextra)
 | 
			
		||||
    check_enable_cxx_flag(-Wnon-virtual-dtor)
 | 
			
		||||
    check_enable_cxx_flag(-Wnoexcept)
 | 
			
		||||
    check_enable_cxx_flag(-Wlogical-op)
 | 
			
		||||
    check_enable_cxx_flag(-Wconversion)
 | 
			
		||||
    check_enable_cxx_flag(-Wdeprecated)
 | 
			
		||||
  if(version EQUAL 11)
 | 
			
		||||
    set(CMAKE_CXX_STANDARD 11 PARENT_SCOPE)
 | 
			
		||||
    set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  if(version EQUAL 14)
 | 
			
		||||
    set(CMAKE_CXX_STANDARD 14 PARENT_SCOPE)
 | 
			
		||||
    set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  if(version EQUAL 17)
 | 
			
		||||
    if(${CMAKE_VERSION} VERSION_LESS "3.10.0")
 | 
			
		||||
      check_cxx_compiler_flag(-std=gnu++17 HAVE_FLAG_STD_GNUXX17)
 | 
			
		||||
      if(HAVE_FLAG_STD_GNUXX17)
 | 
			
		||||
        add_compile_options("-std=gnu++17")
 | 
			
		||||
      else()
 | 
			
		||||
        check_cxx_compiler_flag(-std=gnu++1z HAVE_FLAG_STD_GNUXX1Z)
 | 
			
		||||
        if(HAVE_FLAG_STD_GNUXX1Z)
 | 
			
		||||
          add_compile_options("-std=gnu++1z")
 | 
			
		||||
        else()
 | 
			
		||||
          check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
 | 
			
		||||
          if(HAVE_FLAG_STD_CXX17)
 | 
			
		||||
            add_compile_options("-std=c++17")
 | 
			
		||||
          else()
 | 
			
		||||
            check_cxx_compiler_flag(-std=c++1z HAVE_FLAG_STD_CXX1Z)
 | 
			
		||||
            if(HAVE_FLAG_STD_CXX1Z)
 | 
			
		||||
              add_compile_options("-std=c++1z")
 | 
			
		||||
            endif()
 | 
			
		||||
          endif()
 | 
			
		||||
        endif()
 | 
			
		||||
      endif()
 | 
			
		||||
    else()
 | 
			
		||||
      set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE)
 | 
			
		||||
      set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
 | 
			
		||||
    endif()
 | 
			
		||||
  endif()
 | 
			
		||||
endfunction()
 | 
			
		||||
 | 
			
		||||
if(NOT CMLIB_CXX_FLAGS_AUTODETECTION_DONE)
 | 
			
		||||
  set(_CMLIB_DETECTED_CXX_FLAGS "")
 | 
			
		||||
  set(_CMLIB_DETECTED_CXX_FLAGS_DEBUG "")
 | 
			
		||||
 | 
			
		||||
  # Configuration bits specific for clang.
 | 
			
		||||
  if(CMAKE_CXX_COMPILER_IS_CLANG)
 | 
			
		||||
    # For now it seems like -Wshadow from clang behaves better than GCC's,
 | 
			
		||||
    # just enable it here for the time being.
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wshadow)
 | 
			
		||||
    # New warnings in clang 8.
 | 
			
		||||
    # NOTE: a few issues with macros here, let's disable for now.
 | 
			
		||||
    # CHECK_ENABLE_DEBUG_CXX_FLAG(-Wextra-semi-stmt)
 | 
			
		||||
    # New warnings in clang 10.
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wtautological-overlap-compare)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wtautological-compare)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wtautological-bitwise-compare)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wbitwise-conditional-parentheses)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wrange-loop-analysis)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wmisleading-indentation)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wc99-designator)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wreorder-init-list)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsizeof-pointer-div)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsizeof-array-div)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wxor-used-as-pow)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wfinal-dtor-non-final-class)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  # Common configuration for GCC, clang and Intel.
 | 
			
		||||
  if(CMAKE_CXX_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_IS_INTEL OR CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wall)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wextra)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wnon-virtual-dtor)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wnoexcept)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wlogical-op)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wconversion)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wdeprecated)
 | 
			
		||||
    # This limit is supposed to be at least 1024 in C++11, but for some reason
 | 
			
		||||
    # clang sets this to 256, and gcc to 900.
 | 
			
		||||
    check_enable_cxx_flag(-ftemplate-depth=1024)
 | 
			
		||||
    check_enable_cxx_flag(-Wold-style-cast)
 | 
			
		||||
    check_enable_cxx_flag(-Wdisabled-optimization)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wold-style-cast)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wdisabled-optimization)
 | 
			
		||||
    # This is useful when the compiler decides the template backtrace is too
 | 
			
		||||
    # verbose.
 | 
			
		||||
    check_enable_cxx_flag(-ftemplate-backtrace-limit=0)
 | 
			
		||||
    check_enable_cxx_flag(-fstack-protector-all)
 | 
			
		||||
    check_enable_debug_cxx_flag(-ftemplate-backtrace-limit=0)
 | 
			
		||||
    check_enable_debug_cxx_flag(-fstack-protector-all)
 | 
			
		||||
    # A few suggestion flags.
 | 
			
		||||
    check_enable_cxx_flag(-Wsuggest-attribute=pure)
 | 
			
		||||
    check_enable_cxx_flag(-Wsuggest-attribute=const)
 | 
			
		||||
    check_enable_cxx_flag(-Wsuggest-attribute=noreturn)
 | 
			
		||||
    check_enable_cxx_flag(-Wsuggest-attribute=format)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsuggest-attribute=pure)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsuggest-attribute=const)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsuggest-attribute=noreturn)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsuggest-attribute=format)
 | 
			
		||||
    # From GCC 5.
 | 
			
		||||
    check_enable_cxx_flag(-Wodr)
 | 
			
		||||
    check_enable_cxx_flag(-Wsuggest-final-types)
 | 
			
		||||
    check_enable_cxx_flag(-Wsuggest-final-methods)
 | 
			
		||||
    check_enable_cxx_flag(-Wsuggest-override)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wodr)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsuggest-final-types)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsuggest-final-methods)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsuggest-override)
 | 
			
		||||
    # From GCC 6.
 | 
			
		||||
    check_enable_cxx_flag(-Wshift-negative-value)
 | 
			
		||||
    check_enable_cxx_flag(-Wshift-overflow=2)
 | 
			
		||||
    check_enable_cxx_flag(-Wduplicated-cond)
 | 
			
		||||
    check_enable_cxx_flag(-Wnull-dereference)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wshift-negative-value)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wshift-overflow=2)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wduplicated-cond)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wnull-dereference)
 | 
			
		||||
    # From GCC 7.
 | 
			
		||||
    check_enable_cxx_flag(-Wrestrict)
 | 
			
		||||
    check_enable_cxx_flag(-Waligned-new)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wrestrict)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Waligned-new)
 | 
			
		||||
    check_enable_debug_cxx_flag(-fdiagnostics-parseable-fixits)
 | 
			
		||||
    check_enable_debug_cxx_flag(-fdiagnostics-generate-patch)
 | 
			
		||||
    # From GCC 8.
 | 
			
		||||
    check_enable_cxx_flag(-Wcast-align=strict)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wcast-align=strict)
 | 
			
		||||
    # This is supposed to produce a nice graphical visualization of mismatching
 | 
			
		||||
    # template errors.
 | 
			
		||||
    check_enable_cxx_flag(-fdiagnostics-show-template-tree)
 | 
			
		||||
    check_enable_cxx_flag(-fdiagnostics-show-option)
 | 
			
		||||
    check_enable_debug_cxx_flag(-fdiagnostics-show-option)
 | 
			
		||||
 | 
			
		||||
    check_enable_cxx_flag(-pedantic)
 | 
			
		||||
    check_enable_cxx_flag(-Wcast-align)
 | 
			
		||||
    check_enable_cxx_flag(-Wcast-qual)
 | 
			
		||||
    check_enable_cxx_flag(-Wctor-dtor-privacy)
 | 
			
		||||
    check_enable_cxx_flag(-Wdisabled-optimization)
 | 
			
		||||
    check_enable_cxx_flag(-Wformat=2)
 | 
			
		||||
    check_enable_cxx_flag(-Winit-self)
 | 
			
		||||
    check_enable_cxx_flag(-Wmissing-include-dirs)
 | 
			
		||||
    check_enable_cxx_flag(-Woverloaded-virtual)
 | 
			
		||||
    check_enable_cxx_flag(-Wredundant-decls)
 | 
			
		||||
    check_enable_cxx_flag(-Wsign-promo)
 | 
			
		||||
    check_enable_cxx_flag(-Wstrict-overflow=5)
 | 
			
		||||
    check_enable_cxx_flag(-Wundef)
 | 
			
		||||
    check_enable_cxx_flag(-Wno-unused)
 | 
			
		||||
    check_enable_cxx_flag(-Wno-variadic-macros)
 | 
			
		||||
    check_enable_cxx_flag(-Wno-parentheses)
 | 
			
		||||
    check_enable_cxx_flag(-Wstrict-null-sentinel)
 | 
			
		||||
    check_enable_cxx_flag(-Wshadow-all)
 | 
			
		||||
    check_enable_debug_cxx_flag(-pedantic)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wcast-align)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wcast-qual)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wctor-dtor-privacy)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wdisabled-optimization)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wformat=2)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Winit-self)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wmissing-include-dirs)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Woverloaded-virtual)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wredundant-decls)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wsign-promo)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wstrict-overflow=5)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wundef)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wno-unused)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wno-variadic-macros)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wno-parentheses)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wstrict-null-sentinel)
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wshadow-all)
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
  check_enable_cxx_flag(-fdiagnostics-color=auto)
 | 
			
		||||
  # The -Wmaybe-uninitialized flag is enabled by -Wall,
 | 
			
		||||
  # but it is known to emit a lot of possibly spurious warnings.
 | 
			
		||||
  # Let's just disable it.
 | 
			
		||||
  check_enable_cxx_flag(-Wno-maybe-uninitialized)
 | 
			
		||||
  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.999")
 | 
			
		||||
    # NOTE: GCC >= 6 seems to be wrongly warning about visibility attributes
 | 
			
		||||
    # in some situations:
 | 
			
		||||
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80947
 | 
			
		||||
    # Let's just disable the warning for now.
 | 
			
		||||
    check_enable_cxx_flag(-Wno-attributes)
 | 
			
		||||
  if(CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
    check_enable_cxx_flag(-fdiagnostics-color=auto)
 | 
			
		||||
    # The -Wmaybe-uninitialized flag is enabled by -Wall,
 | 
			
		||||
    # but it is known to emit a lot of possibly spurious warnings.
 | 
			
		||||
    # Let's just disable it.
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wno-maybe-uninitialized)
 | 
			
		||||
    # New in GCC 9.
 | 
			
		||||
    check_enable_debug_cxx_flag(-Waddress-of-packed-member)
 | 
			
		||||
 | 
			
		||||
    if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.999")
 | 
			
		||||
      # NOTE: GCC >= 6 seems to be wrongly warning about visibility attributes
 | 
			
		||||
      # in some situations:
 | 
			
		||||
      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80947
 | 
			
		||||
      # Let's just disable the warning for now.
 | 
			
		||||
      check_enable_cxx_flag(-Wno-attributes)
 | 
			
		||||
    endif()
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")
 | 
			
		||||
  check_enable_cxx_flag(-Wno-invalid-offsetof)
 | 
			
		||||
  list(APPEND CMAKE_LIBRARY_PATH "/usr/lib/e2k-linux-gnu")
 | 
			
		||||
  # cmake-format: off
 | 
			
		||||
  if(LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" AND
 | 
			
		||||
     LSB_CODENAME       STREQUAL "smolensk" AND
 | 
			
		||||
     LSB_RELEASE        STREQUAL "1.5")
 | 
			
		||||
  # cmake-format: on
 | 
			
		||||
    cmlib_set_cxx_standard(11)
 | 
			
		||||
 | 
			
		||||
    set(_CMAKE_TOOLCHAIN_PREFIX "x86_64-linux-gnu-" CACHE INTERNAL "" FORCE)
 | 
			
		||||
    set(_CMAKE_TOOLCHAIN_SUFFIX "-4.7" CACHE INTERNAL "" FORCE)
 | 
			
		||||
    set(_CMAKE_TOOLCHAIN_LOCATION "/usr/bin" CACHE INTERNAL "" FORCE)
 | 
			
		||||
  else()
 | 
			
		||||
    cmlib_set_cxx_standard(17)
 | 
			
		||||
 | 
			
		||||
    # -Wshadow gives a lot of false positives with GCC 4.7.2 in Astra Linux 1.5
 | 
			
		||||
    if(CMAKE_CXX_COMPILER_IS_GCC)
 | 
			
		||||
      check_enable_debug_cxx_flag(-Wshadow)
 | 
			
		||||
    endif()
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  if(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")
 | 
			
		||||
    check_enable_debug_cxx_flag(-Wno-invalid-offsetof)
 | 
			
		||||
    list(APPEND CMAKE_LIBRARY_PATH "/usr/lib/e2k-linux-gnu")
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  # Set the cache variables.
 | 
			
		||||
  set(CMLIB_DETECTED_CXX_FLAGS "${_CMLIB_DETECTED_CXX_FLAGS}" CACHE INTERNAL "")
 | 
			
		||||
  set(CMLIB_DETECTED_CXX_FLAGS_DEBUG "${_CMLIB_DETECTED_CXX_FLAGS_DEBUG}" CACHE INTERNAL "")
 | 
			
		||||
  set(CMLIB_CXX_FLAGS_AUTODETECTION_DONE YES CACHE INTERNAL "")
 | 
			
		||||
endif()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
function(cmlib_config_hpp_generate)
 | 
			
		||||
  include(CMLibLargeFiles)
 | 
			
		||||
  cmlib_test_large_files(HAVE_LARGEFILES)
 | 
			
		||||
 | 
			
		||||
  get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
 | 
			
		||||
  configure_file(${CMLIB_MODULE_DIR}/hpp/cmlib_private_config.hpp.in
 | 
			
		||||
                 ${CMAKE_BINARY_DIR}/include/cmlib_private_config.hpp)
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										13
									
								
								CMLibDebugOutput.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								CMLibDebugOutput.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
# По умолчанию отключена отладочная печать
 | 
			
		||||
# (если не включена явно программистом)
 | 
			
		||||
option(CMLIB_DEBUG_OUTPUT "Enable debug output" OFF)
 | 
			
		||||
option(CMLIB_INFO_OUTPUT "Enable info output" OFF)
 | 
			
		||||
option(CMLIB_WARNING_OUTPUT "Enable warning output" OFF)
 | 
			
		||||
 | 
			
		||||
# Если сборка производится в режиме для отладки,
 | 
			
		||||
# то включаются флаги для разрешения отладочной печати
 | 
			
		||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
 | 
			
		||||
  set(CMLIB_DEBUG_OUTPUT ON CACHE BOOL "" FORCE)
 | 
			
		||||
  set(CMLIB_INFO_OUTPUT ON CACHE BOOL "" FORCE)
 | 
			
		||||
  set(CMLIB_WARNING_OUTPUT ON CACHE BOOL "" FORCE)
 | 
			
		||||
endif()
 | 
			
		||||
@@ -14,8 +14,8 @@ endif()
 | 
			
		||||
 | 
			
		||||
# Очистка от сгенерированных файлов
 | 
			
		||||
file(GLOB_RECURSE _cmakelists_files RELATIVE ${_source_realpath} CMakeLists.txt)
 | 
			
		||||
foreach(_it ${_cmakelists_files})
 | 
			
		||||
  get_filename_component(_file ${_it} REALPATH)
 | 
			
		||||
foreach(it ${_cmakelists_files})
 | 
			
		||||
  get_filename_component(_file ${it} REALPATH)
 | 
			
		||||
  get_filename_component(_dir ${_file} DIRECTORY)
 | 
			
		||||
  file(
 | 
			
		||||
    REMOVE_RECURSE
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
find_program(DISTCC_EXECUTABLE distcc)
 | 
			
		||||
mark_as_advanced(DISTCC_EXECUTABLE)
 | 
			
		||||
if(DISTCC_EXECUTABLE)
 | 
			
		||||
  foreach(LANG C CXX)
 | 
			
		||||
    if(NOT DEFINED CMAKE_${LANG}_COMPILER_LAUNCHER AND NOT CMAKE_${LANG}_COMPILER MATCHES ".*/distcc$")
 | 
			
		||||
      message(STATUS "Enabling distcc for ${LANG}")
 | 
			
		||||
      set(CMAKE_${LANG}_COMPILER_LAUNCHER ${DISTCC_EXECUTABLE} CACHE STRING "")
 | 
			
		||||
  foreach(lang C CXX)
 | 
			
		||||
    if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND NOT CMAKE_${lang}_COMPILER MATCHES ".*/distcc$")
 | 
			
		||||
      message(STATUS "Enabling distcc for ${lang}")
 | 
			
		||||
      set(CMAKE_${lang}_COMPILER_LAUNCHER ${DISTCC_EXECUTABLE} CACHE STRING "")
 | 
			
		||||
    endif()
 | 
			
		||||
  endforeach()
 | 
			
		||||
endif()
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ set_property(CACHE BREATHE_FOUND PROPERTY STRINGS ON OFF AUTO)
 | 
			
		||||
 | 
			
		||||
find_package(Doxygen)
 | 
			
		||||
find_package(Perl)
 | 
			
		||||
set(Python_ADDITIONAL_VERSIONS 3.8;3.7;3.6;3.5;3.4;3.3;3.2)
 | 
			
		||||
set(Python_ADDITIONAL_VERSIONS 3.9;3.8;3.7;3.6;3.5;3.4;3.3;3.2)
 | 
			
		||||
find_package(PythonInterp)
 | 
			
		||||
if(PYTHONINTERP_FOUND)
 | 
			
		||||
  find_package(Sphinx)
 | 
			
		||||
@@ -24,7 +24,7 @@ else()
 | 
			
		||||
  set(BREATHE_FOUND OFF CACHE STRING "Breathe documentation generator disabled" FORCE)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
function(add_breathe target)
 | 
			
		||||
function(add_breathe_target target)
 | 
			
		||||
  set(options)
 | 
			
		||||
  set(oneValueArgs COMMENT)
 | 
			
		||||
  set(multiValueArgs)
 | 
			
		||||
@@ -36,8 +36,8 @@ function(add_breathe target)
 | 
			
		||||
    set(GENERATE_XML YES)
 | 
			
		||||
    set(GENERATE_HTML NO)
 | 
			
		||||
    set(GENERATE_LATEX NO)
 | 
			
		||||
    set(CONF_FILE ${CMAKE_SOURCE_DIR}/cmake/doc/breathe-conf.py.in)
 | 
			
		||||
    set(DOXY_FILE ${CMAKE_SOURCE_DIR}/cmake/doc/Doxyfile.in)
 | 
			
		||||
    set(CONF_FILE ${CMLIB_MODULE_DIR}/doxygen/breathe-conf.py.in)
 | 
			
		||||
    set(DOXY_FILE ${CMLIB_MODULE_DIR}/doxygen/Doxyfile.in)
 | 
			
		||||
 | 
			
		||||
    configure_file(${CONF_FILE} ${WORK_DIR}/conf.py @ONLY)
 | 
			
		||||
    configure_file(${DOXY_FILE} ${WORK_DIR}/Doxyfile @ONLY)
 | 
			
		||||
@@ -68,6 +68,11 @@ function(add_breathe target)
 | 
			
		||||
                                                              ${RST_FILES} ${WORK_DIR})
 | 
			
		||||
      endif()
 | 
			
		||||
    endif()
 | 
			
		||||
    install(
 | 
			
		||||
      DIRECTORY ${CMAKE_BINARY_DIR}/doc/breathe/
 | 
			
		||||
      COMPONENT doc
 | 
			
		||||
      OPTIONAL
 | 
			
		||||
      DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/breathe)
 | 
			
		||||
  else()
 | 
			
		||||
    message(STATUS "CMLIB warning:")
 | 
			
		||||
    add_custom_target(${target} VERBATIM COMMENT "  Breathe is not found. Skipping target ${target} build")
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ else()
 | 
			
		||||
  set(DOXYGEN_FOUND OFF CACHE STRING "Doxygen documentation generator disabled" FORCE)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
function(add_doxygen target)
 | 
			
		||||
function(add_doxygen_target target)
 | 
			
		||||
  set(options)
 | 
			
		||||
  set(oneValueArgs SQLITE LATEX HTML)
 | 
			
		||||
  set(multiValueArgs)
 | 
			
		||||
@@ -25,16 +25,21 @@ function(add_doxygen target)
 | 
			
		||||
      set(GENERATE_LATEX YES)
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    set(WORK_DIR ${CMAKE_BINARY_DIR}/doc/doxygen)
 | 
			
		||||
    configure_file(${CMAKE_SOURCE_DIR}/cmake/doc/Doxyfile.in ${WORK_DIR}/Doxyfile @ONLY)
 | 
			
		||||
    set(work_dir ${CMAKE_BINARY_DIR}/doc/doxygen)
 | 
			
		||||
    configure_file(${CMLIB_MODULE_DIR}/doxygen/Doxyfile.in ${work_dir}/Doxyfile @ONLY)
 | 
			
		||||
 | 
			
		||||
    add_custom_target(
 | 
			
		||||
      ${target}
 | 
			
		||||
      VERBATIM
 | 
			
		||||
      COMMAND "${CMAKE_COMMAND}" -E remove -f "${WORK_DIR}/doxygen_sqlite3.db"
 | 
			
		||||
      COMMAND ${DOXYGEN_EXECUTABLE} ${WORK_DIR}/Doxyfile
 | 
			
		||||
      WORKING_DIRECTORY ${WORK_DIR}
 | 
			
		||||
      COMMAND "${CMAKE_COMMAND}" -E remove -f "${work_dir}/doxygen_sqlite3.db"
 | 
			
		||||
      COMMAND ${DOXYGEN_EXECUTABLE} ${work_dir}/Doxyfile
 | 
			
		||||
      WORKING_DIRECTORY ${work_dir}
 | 
			
		||||
      COMMENT "Generating API documentation with Doxygen")
 | 
			
		||||
    install(
 | 
			
		||||
      DIRECTORY ${CMAKE_BINARY_DIR}/doc/doxygen/html/
 | 
			
		||||
      COMPONENT doc
 | 
			
		||||
      OPTIONAL
 | 
			
		||||
      DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/doxygen)
 | 
			
		||||
  else()
 | 
			
		||||
    message(STATUS "CMLIB warning:")
 | 
			
		||||
    add_custom_target(${target} VERBATIM COMMENT "  Doxygen is not found. Skipping target ${target} build")
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								CMLibExternalProject.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								CMLibExternalProject.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
include(ExternalProject)
 | 
			
		||||
 | 
			
		||||
if(CMAKE_BUILD_TYPE)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_C_COMPILER)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_C_FLAGS)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -E env "CFLAGS=${CMAKE_C_FLAGS}")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_CPP_COMPILER)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -DCMAKE_CPP_COMPILER=${CMAKE_CPP_COMPILER})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_CXX_FLAGS)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -E env "CXXFLAGS=${CMAKE_CXX_FLAGS}")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_Fortran_COMPILER)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_Fortran_FLAGS)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -E env "FFLAGS=${CMAKE_Fortran_FLAGS}")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_INSTALL_PREFIX)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_PREFIX_PATH)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(Qt5_DIR)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -DQt5_DIR=${Qt5_DIR})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(Qt5Core_DIR)
 | 
			
		||||
  list(APPEND CMLIB_EXT_PROJ_DEFAULT_ARGS -DQt5Core_DIR=${Qt5Core_DIR})
 | 
			
		||||
endif()
 | 
			
		||||
@@ -6,6 +6,7 @@
 | 
			
		||||
#
 | 
			
		||||
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
 | 
			
		||||
#
 | 
			
		||||
# cmake-lint: disable=C0103
 | 
			
		||||
macro(remove_flag_from_target _target _flag)
 | 
			
		||||
  get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
 | 
			
		||||
  if(_target_cxx_flags)
 | 
			
		||||
@@ -22,6 +23,7 @@ endmacro()
 | 
			
		||||
#
 | 
			
		||||
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
 | 
			
		||||
#
 | 
			
		||||
# cmake-lint: disable=C0103
 | 
			
		||||
macro(remove_flag_from_file _target _file _flag)
 | 
			
		||||
  get_target_property(_target_sources ${_target} SOURCES)
 | 
			
		||||
  # Check if a sync is required, in which case we'll force a rewrite of the cache variables.
 | 
			
		||||
 
 | 
			
		||||
@@ -4,22 +4,35 @@ function(add_format_sources target)
 | 
			
		||||
  if(NOT TARGET format-sources)
 | 
			
		||||
    add_custom_target(format-sources)
 | 
			
		||||
  endif()
 | 
			
		||||
  if(NOT TARGET check-format-sources)
 | 
			
		||||
    add_custom_target(check-format-sources)
 | 
			
		||||
  endif()
 | 
			
		||||
  if(NOT TARGET doc-add-comments)
 | 
			
		||||
    add_custom_target(doc-add-comments)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  find_program(UNCRUSTIFY_EXE NAMES uncrustify)
 | 
			
		||||
  if(UNCRUSTIFY_EXE)
 | 
			
		||||
    list(
 | 
			
		||||
      APPEND
 | 
			
		||||
      UNCRUSTIFY_OPTS
 | 
			
		||||
      -lCPP
 | 
			
		||||
      --replace
 | 
			
		||||
      --no-backup
 | 
			
		||||
      --mtime)
 | 
			
		||||
    if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg)
 | 
			
		||||
      list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg)
 | 
			
		||||
    endif()
 | 
			
		||||
    add_custom_target(format-sources-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS}
 | 
			
		||||
                                                                  ${_sources})
 | 
			
		||||
    # cmake-format: off
 | 
			
		||||
    add_custom_target(check-format-sources-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE}
 | 
			
		||||
      ${UNCRUSTIFY_OPTS} --check ${_sources})
 | 
			
		||||
    list(APPEND UNCRUSTIFY_OPTS --replace --no-backup)
 | 
			
		||||
    add_custom_target(format-sources-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE}
 | 
			
		||||
      ${UNCRUSTIFY_OPTS} --mtime ${_sources})
 | 
			
		||||
    add_custom_target(doc-add-comments-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE}
 | 
			
		||||
      ${UNCRUSTIFY_OPTS}
 | 
			
		||||
      --set cmt_insert_file_header=fileheader.txt
 | 
			
		||||
      --set cmt_insert_file_footer=filefooter.txt
 | 
			
		||||
      --set cmt_insert_func_header=funcheader.txt
 | 
			
		||||
      --set cmt_insert_class_header=classheader.txt
 | 
			
		||||
      --set cmt_insert_before_ctor_dtor=true ${_sources})
 | 
			
		||||
    # cmake-format: on
 | 
			
		||||
    add_dependencies(format-sources format-sources-uncrustify-${target})
 | 
			
		||||
    add_dependencies(check-format-sources check-format-sources-uncrustify-${target})
 | 
			
		||||
    add_dependencies(doc-add-comments doc-add-comments-uncrustify-${target})
 | 
			
		||||
  else()
 | 
			
		||||
    message(STATUS "CMLIB warning:")
 | 
			
		||||
    message(STATUS "  uncrustify executable is not found")
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								CMLibGenerateCompilerFeaturesHPP.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								CMLibGenerateCompilerFeaturesHPP.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
if(${CMAKE_VERSION} VERSION_GREATER "3.6.0")
 | 
			
		||||
  include(WriteCompilerDetectionHeader)
 | 
			
		||||
 | 
			
		||||
  set(OUTPUT_FILE ${CMAKE_BINARY_DIR}/include/compiler_features.hpp)
 | 
			
		||||
  if(CMLIB_GENERATED_HEADERS_PATH)
 | 
			
		||||
    set(OUTPUT_FILE ${CMLIB_GENERATED_HEADERS_PATH}/compiler_features.hpp)
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  write_compiler_detection_header(
 | 
			
		||||
    FILE ${OUTPUT_FILE}
 | 
			
		||||
    PREFIX ${CMLIB_PROJECT_NAME_CANONICAL}
 | 
			
		||||
    COMPILERS GNU Clang MSVC Intel
 | 
			
		||||
    FEATURES
 | 
			
		||||
      cxx_nullptr
 | 
			
		||||
      cxx_override
 | 
			
		||||
      cxx_alignas
 | 
			
		||||
      cxx_alignof
 | 
			
		||||
      cxx_attributes
 | 
			
		||||
      cxx_auto_type
 | 
			
		||||
      cxx_constexpr
 | 
			
		||||
      cxx_digit_separators
 | 
			
		||||
      cxx_range_for)
 | 
			
		||||
 | 
			
		||||
  unset(OUTPUT_FILE)
 | 
			
		||||
endif()
 | 
			
		||||
							
								
								
									
										14
									
								
								CMLibGeneratePrivateConfigHPP.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								CMLibGeneratePrivateConfigHPP.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
function(cmlib_generate_private_config_hpp)
 | 
			
		||||
  include(CMLibLargeFiles)
 | 
			
		||||
  cmlib_test_large_files(HAVE_LARGEFILES)
 | 
			
		||||
 | 
			
		||||
  set(output_file ${CMAKE_BINARY_DIR}/include/cmlib_private_config.hpp)
 | 
			
		||||
  if(CMLIB_GENERATED_HEADERS_PATH)
 | 
			
		||||
    set(output_file ${CMLIB_GENERATED_HEADERS_PATH}/cmlib_private_config.hpp)
 | 
			
		||||
  elseif(ARGV0)
 | 
			
		||||
    set(output_file ${ARGV0})
 | 
			
		||||
  endif()
 | 
			
		||||
 | 
			
		||||
  get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
 | 
			
		||||
  configure_file(${CMLIB_MODULE_DIR}/hpp/cmlib_private_config.hpp.in ${output_file})
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										16
									
								
								CMLibGit.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								CMLibGit.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
set(output_file ${CMAKE_BINARY_DIR}/include/cmlib_git_version.hpp)
 | 
			
		||||
if(CMLIB_GENERATED_HEADERS_PATH)
 | 
			
		||||
  set(output_file ${CMLIB_GENERATED_HEADERS_PATH}/cmlib_git_version.hpp)
 | 
			
		||||
elseif(ARGV0)
 | 
			
		||||
  set(output_file ${ARGV0})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# cmake-format: off
 | 
			
		||||
add_custom_target(git-version ALL
 | 
			
		||||
  ${CMAKE_COMMAND} -DCMLIB_PROJECT_NAME_UPPER=${CMLIB_PROJECT_NAME_UPPER}
 | 
			
		||||
                   -DCMLIB_MODULE_DIR=${CMLIB_MODULE_DIR}
 | 
			
		||||
                   -DCMLIB_GIT_VERSION_FILE=${output_file} -P ${CMLIB_MODULE_DIR}/CMLibGitVersion.cmake
 | 
			
		||||
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
 | 
			
		||||
# cmake-format: on
 | 
			
		||||
 | 
			
		||||
unset(output_file)
 | 
			
		||||
							
								
								
									
										26
									
								
								CMLibGitVersion.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								CMLibGitVersion.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
set(CMLIB_GIT_REV "N/A")
 | 
			
		||||
set(CMLIB_GIT_DIFF "")
 | 
			
		||||
set(CMLIB_GIT_TAG "N/A")
 | 
			
		||||
set(CMLIB_GIT_BRANCH "N/A")
 | 
			
		||||
 | 
			
		||||
find_program(GIT_EXECUTABLE git)
 | 
			
		||||
if(GIT_EXECUTABLE)
 | 
			
		||||
  execute_process(COMMAND git log --pretty=format:'%h' -n 1 OUTPUT_VARIABLE CMLIB_GIT_REV ERROR_QUIET)
 | 
			
		||||
 | 
			
		||||
  # Check whether we got any revision (which isn't
 | 
			
		||||
  # always the case, e.g. when someone downloaded a zip
 | 
			
		||||
  # file from Github instead of a checkout)
 | 
			
		||||
  if(NOT "${CMLIB_GIT_REV}" STREQUAL "")
 | 
			
		||||
    execute_process(COMMAND bash -c "git diff --quiet --exit-code || echo +" OUTPUT_VARIABLE CMLIB_GIT_DIFF)
 | 
			
		||||
    execute_process(COMMAND git describe --exact-match --tags OUTPUT_VARIABLE CMLIB_GIT_TAG ERROR_QUIET)
 | 
			
		||||
    execute_process(COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE CMLIB_GIT_BRANCH)
 | 
			
		||||
 | 
			
		||||
    string(STRIP "${CMLIB_GIT_REV}" CMLIB_GIT_REV)
 | 
			
		||||
    string(SUBSTRING "${CMLIB_GIT_REV}" 1 7 CMLIB_GIT_REV)
 | 
			
		||||
    string(STRIP "${CMLIB_GIT_DIFF}" CMLIB_GIT_DIFF)
 | 
			
		||||
    string(STRIP "${CMLIB_GIT_TAG}" CMLIB_GIT_TAG)
 | 
			
		||||
    string(STRIP "${CMLIB_GIT_BRANCH}" CMLIB_GIT_BRANCH)
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
configure_file(${CMLIB_MODULE_DIR}/hpp/cmlib_git_version.hpp.in ${CMLIB_GIT_VERSION_FILE})
 | 
			
		||||
@@ -1,5 +1,14 @@
 | 
			
		||||
function(canonical_string INV OUTV)
 | 
			
		||||
  string(TOUPPER ${INV} _arg_uppercase)
 | 
			
		||||
function(canonical_string in_string out_string)
 | 
			
		||||
  string(TOUPPER ${in_string} _arg_uppercase)
 | 
			
		||||
  string(REGEX REPLACE "[ -]" "_" _arg_fixed ${_arg_uppercase})
 | 
			
		||||
  set(${OUTV} ${_arg_fixed} PARENT_SCOPE)
 | 
			
		||||
  set(${out_string} ${_arg_fixed} PARENT_SCOPE)
 | 
			
		||||
endfunction()
 | 
			
		||||
 | 
			
		||||
# Добавление общего префикса ко всем переменным в списке
 | 
			
		||||
function(list_transform_prepend var prefix)
 | 
			
		||||
  set(temp "")
 | 
			
		||||
  foreach(filename ${${var}})
 | 
			
		||||
    list(APPEND temp "${prefix}${filename}")
 | 
			
		||||
  endforeach()
 | 
			
		||||
  set(${var} "${temp}" PARENT_SCOPE)
 | 
			
		||||
endfunction()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,31 @@
 | 
			
		||||
if(NOT CMLIB_THEME_NAME)
 | 
			
		||||
  set(CMLIB_THEME_NAME "default")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
canonical_string(${CMLIB_ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL)
 | 
			
		||||
canonical_string(${PROJECT_NAME} CMLIB_PROJECT_NAME_CANONICAL)
 | 
			
		||||
canonical_string(${ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL)
 | 
			
		||||
canonical_string(${CMLIB_THEME_NAME} CMLIB_THEME_NAME_CANONICAL)
 | 
			
		||||
 | 
			
		||||
string(TOLOWER ${CMLIB_ORGANIZATION_NAME_CANONICAL} CMLIB_ORGANIZATION_NAME_LOWER)
 | 
			
		||||
string(TOLOWER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_LOWER)
 | 
			
		||||
string(TOLOWER ${CMLIB_THEME_NAME_CANONICAL} CMLIB_THEME_NAME_LOWER)
 | 
			
		||||
 | 
			
		||||
string(TOUPPER ${CMLIB_ORGANIZATION_NAME_CANONICAL} CMLIB_ORGANIZATION_NAME_UPPER)
 | 
			
		||||
string(TOUPPER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_UPPER)
 | 
			
		||||
string(TOUPPER ${CMLIB_THEME_NAME_CANONICAL} CMLIB_THEME_NAME_UPPER)
 | 
			
		||||
 | 
			
		||||
option(CMLIB_ADD_THEME_PREFIX "Append theme name to install prefix" OFF)
 | 
			
		||||
if(CMLIB_ADD_THEME_PREFIX AND NOT CMLIB_THEME_PREFIX_APPENDED)
 | 
			
		||||
  if(NOT CMLIB_THEME_NAME_LOWER STREQUAL "default")
 | 
			
		||||
    set(CMLIB_THEME_PREFIX_APPENDED ON CACHE BOOL "" FORCE)
 | 
			
		||||
    set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${CMLIB_THEME_NAME}" CACHE PATH "" FORCE)
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# CMLIB_MODULE_DIR
 | 
			
		||||
foreach(_m ${CMAKE_MODULE_PATH})
 | 
			
		||||
  if(EXISTS ${_m}/CMLibCommon.cmake)
 | 
			
		||||
    get_filename_component(CMLIB_MODULE_DIR ${_m}/CMLibCommon.cmake DIRECTORY)
 | 
			
		||||
foreach(module ${CMAKE_MODULE_PATH})
 | 
			
		||||
  if(EXISTS ${module}/CMLibCommon.cmake)
 | 
			
		||||
    get_filename_component(CMLIB_MODULE_DIR ${module}/CMLibCommon.cmake DIRECTORY)
 | 
			
		||||
    break()
 | 
			
		||||
  endif()
 | 
			
		||||
endforeach()
 | 
			
		||||
@@ -23,3 +38,10 @@ if(IS_DIRECTORY "${CMLIB_MODULE_DIR}")
 | 
			
		||||
else()
 | 
			
		||||
  message(FATAL_ERROR "CMLib directory not found.")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(NOT DEFINED CMLIB_CMAKE_DIR)
 | 
			
		||||
  get_filename_component(CMLIB_CMAKE_DIR ${CMLIB_MODULE_DIR} DIRECTORY)
 | 
			
		||||
  if(IS_DIRECTORY "${CMLIB_CMAKE_DIR}/find")
 | 
			
		||||
    list(APPEND CMAKE_MODULE_PATH "${CMLIB_CMAKE_DIR}/find")
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 
 | 
			
		||||
@@ -16,14 +16,11 @@ if(EXISTS /etc/mcst_version)
 | 
			
		||||
  execute_process(COMMAND cat /etc/mcst_version OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
else()
 | 
			
		||||
  find_program(_lsb_release_executable lsb_release)
 | 
			
		||||
  # cmake-format: off
 | 
			
		||||
  if(_lsb_release_executable)
 | 
			
		||||
    execute_process(COMMAND ${_lsb_release_executable} -si OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
 | 
			
		||||
                                                                           OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
 | 
			
		||||
    execute_process(COMMAND ${_lsb_release_executable} -sc OUTPUT_VARIABLE LSB_CODENAME
 | 
			
		||||
                                                                           OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
 | 
			
		||||
    execute_process(COMMAND ${_lsb_release_executable} -sr OUTPUT_VARIABLE LSB_RELEASE
 | 
			
		||||
                                                                           OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
    execute_process(COMMAND ${_lsb_release_executable} -si OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
    execute_process(COMMAND ${_lsb_release_executable} -sc OUTPUT_VARIABLE LSB_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
    execute_process(COMMAND ${_lsb_release_executable} -sr OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
			
		||||
  # cmake-format: on
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 
 | 
			
		||||
@@ -129,6 +129,7 @@ macro(cmlib_test_large_files VARIABLE)
 | 
			
		||||
      endif()
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    # cmake-lint: disable=C0103
 | 
			
		||||
    if(NOT FILE64_OK)
 | 
			
		||||
      # now check for Windows stuff
 | 
			
		||||
      try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestWindowsFSeek.c")
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								CMLibPkgConfig.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								CMLibPkgConfig.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
function(generate_pkgconfig library_name)
 | 
			
		||||
  set(options)
 | 
			
		||||
  set(oneValueArgs COMPONENT INSTALL_LIBRARY)
 | 
			
		||||
  set(multiValueArgs)
 | 
			
		||||
 | 
			
		||||
  cmake_parse_arguments(_PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
 | 
			
		||||
 | 
			
		||||
  if(${_PKG_INSTALL_LIBRARY})
 | 
			
		||||
    configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${library_name}.pc)
 | 
			
		||||
  else()
 | 
			
		||||
    configure_file(${CMLIB_MODULE_DIR}/pc/lib-header-only.pc.in ${CMAKE_BINARY_DIR}/${library_name}.pc)
 | 
			
		||||
  endif()
 | 
			
		||||
  install(FILES ${CMAKE_BINARY_DIR}/${library_name}.pc COMPONENT ${_PKG_COMPONENT}
 | 
			
		||||
          DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 | 
			
		||||
endfunction()
 | 
			
		||||
@@ -14,19 +14,19 @@ function(qt5_translation outfiles)
 | 
			
		||||
  set(L10N_QRC_BODY "")
 | 
			
		||||
  make_directory(${_output_dir})
 | 
			
		||||
 | 
			
		||||
  foreach(_lang ${_languages})
 | 
			
		||||
    set(_ts "${_base_name}_${_lang}.ts")
 | 
			
		||||
    set(_qm "${_base_name}_${_lang}.qm")
 | 
			
		||||
  foreach(lang ${_languages})
 | 
			
		||||
    set(_ts "${_base_name}_${lang}.ts")
 | 
			
		||||
    set(_qm "${_base_name}_${lang}.qm")
 | 
			
		||||
    list(APPEND _ts_list ${_output_dir}/${_ts})
 | 
			
		||||
    list(APPEND _l10n_names_list "${_base_name}_l10n_${_lang}")
 | 
			
		||||
    list(APPEND _l10n_names_list "${_base_name}_l10n_${lang}")
 | 
			
		||||
    string(APPEND L10N_QRC_BODY "<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
 | 
			
		||||
 | 
			
		||||
    add_custom_target(
 | 
			
		||||
      ${_base_name}_l10n_${_lang} COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources} -ts ${_output_dir}/${_ts}
 | 
			
		||||
                                          -target-language ${_lang} DEPENDS ${_sources})
 | 
			
		||||
      ${_base_name}_l10n_${lang} COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources} -ts ${_output_dir}/${_ts}
 | 
			
		||||
                                         -target-language ${lang} DEPENDS ${_sources})
 | 
			
		||||
 | 
			
		||||
    if(NOT EXISTS "${_output_dir}/${_ts}")
 | 
			
		||||
      add_custom_target(${_ts} DEPENDS ${_base_name}_l10n_${_lang})
 | 
			
		||||
      add_custom_target(${_ts} DEPENDS ${_base_name}_l10n_${lang})
 | 
			
		||||
    else()
 | 
			
		||||
      add_custom_target(${_ts} COMMAND echo "Skipping lupdate for ${_ts}")
 | 
			
		||||
    endif()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,21 @@
 | 
			
		||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/etc/Variables.cmake")
 | 
			
		||||
  message(FATAL_ERROR "Required file cmake/etc/Variables.cmake does not exist")
 | 
			
		||||
#
 | 
			
		||||
# Обязательные переменные, значения которым необходимо присвоить в файле CMakeLists.txt
 | 
			
		||||
# до подключения CMLib, либо передать из командной строки через ключ -D
 | 
			
		||||
#
 | 
			
		||||
if(NOT CMLIB_ORGANIZATION_NAME)
 | 
			
		||||
  message(FATAL_ERROR "Required variable CMLIB_ORGANIZATION_NAME is not defined")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
include("${CMAKE_SOURCE_DIR}/cmake/etc/Variables.cmake")
 | 
			
		||||
 | 
			
		||||
if(NOT ORGANIZATION_NAME)
 | 
			
		||||
  message(FATAL_ERROR "Required variable ORGANIZATION_NAME is not defined")
 | 
			
		||||
if(NOT CMLIB_AUTHOR_NAME)
 | 
			
		||||
  message(FATAL_ERROR "Required variable CMLIB_AUTHOR_NAME is not defined")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
set(CPACK_PACKAGE_VENDOR ${ORGANIZATION_NAME})
 | 
			
		||||
 | 
			
		||||
if(NOT CPACK_PACKAGE_CONTACT)
 | 
			
		||||
  message(FATAL_ERROR "Required variable CPACK_PACKAGE_CONTACT is not defined")
 | 
			
		||||
if(NOT CMLIB_AUTHOR_EMAIL)
 | 
			
		||||
  message(FATAL_ERROR "Required variable CMLIB_AUTHOR_EMAIL is not defined")
 | 
			
		||||
endif()
 | 
			
		||||
set(CPACK_PACKAGE_CONTACT "${CMLIB_AUTHOR_NAME} <${CMLIB_AUTHOR_EMAIL}>" CACHE STRING "")
 | 
			
		||||
 | 
			
		||||
if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
 | 
			
		||||
  message(FATAL_ERROR "Required variable CPACK_PACKAGE_DESCRIPTION_SUMMARY is not defined")
 | 
			
		||||
if(NOT CMLIB_DESCRIPTION)
 | 
			
		||||
  message(FATAL_ERROR "Required variable CMLIB_DESCRIPTION is not defined")
 | 
			
		||||
endif()
 | 
			
		||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CMLIB_DESCRIPTION} CACHE STRING "")
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
if(IS_DIRECTORY "${CMLIB_MODULE_DIR}")
 | 
			
		||||
  set(CMLIB_SANITIZERS_DIR "${CMLIB_MODULE_DIR}/thirdparty/sanitizers/cmake")
 | 
			
		||||
  set(CMLIB_SANITIZERS_DIR "${CMLIB_MODULE_DIR}/thirdparty/sanitizers")
 | 
			
		||||
  if(IS_DIRECTORY "${CMLIB_SANITIZERS_DIR}")
 | 
			
		||||
    list(APPEND CMAKE_MODULE_PATH ${CMLIB_SANITIZERS_DIR})
 | 
			
		||||
    find_package(Sanitizers)
 | 
			
		||||
 
 | 
			
		||||
@@ -51,6 +51,7 @@ set(CPACK_SOURCE_IGNORE_FILES
 | 
			
		||||
    obj.*/
 | 
			
		||||
    _build/
 | 
			
		||||
    _output/
 | 
			
		||||
    files/log
 | 
			
		||||
    files/var
 | 
			
		||||
    CMakeLists.txt.user
 | 
			
		||||
    ~$
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										383
									
								
								doxygen/Doxyfile.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										383
									
								
								doxygen/Doxyfile.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,383 @@
 | 
			
		||||
# Doxyfile 1.8.16
 | 
			
		||||
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Project related configuration options
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
DOXYFILE_ENCODING      = UTF-8
 | 
			
		||||
PROJECT_NAME           = "@DOXYGEN_PROJECT_TITLE@"
 | 
			
		||||
PROJECT_NUMBER         =
 | 
			
		||||
PROJECT_BRIEF          =
 | 
			
		||||
PROJECT_LOGO           =
 | 
			
		||||
OUTPUT_DIRECTORY       = "@OUTPUT_DIRECTORY@"
 | 
			
		||||
CREATE_SUBDIRS         = NO
 | 
			
		||||
ALLOW_UNICODE_NAMES    = NO
 | 
			
		||||
OUTPUT_LANGUAGE        = Russian
 | 
			
		||||
OUTPUT_TEXT_DIRECTION  = None
 | 
			
		||||
BRIEF_MEMBER_DESC      = YES
 | 
			
		||||
REPEAT_BRIEF           = YES
 | 
			
		||||
ABBREVIATE_BRIEF       = "The $name class" \
 | 
			
		||||
                         "The $name widget" \
 | 
			
		||||
                         "The $name file" \
 | 
			
		||||
                         is \
 | 
			
		||||
                         provides \
 | 
			
		||||
                         specifies \
 | 
			
		||||
                         contains \
 | 
			
		||||
                         represents \
 | 
			
		||||
                         a \
 | 
			
		||||
                         an \
 | 
			
		||||
                         the
 | 
			
		||||
ALWAYS_DETAILED_SEC    = NO
 | 
			
		||||
INLINE_INHERITED_MEMB  = NO
 | 
			
		||||
FULL_PATH_NAMES        = YES
 | 
			
		||||
STRIP_FROM_PATH        = "@CMAKE_SOURCE_DIR@/src"
 | 
			
		||||
STRIP_FROM_INC_PATH    = "@CMAKE_SOURCE_DIR@/src"
 | 
			
		||||
SHORT_NAMES            = NO
 | 
			
		||||
JAVADOC_AUTOBRIEF      = NO
 | 
			
		||||
JAVADOC_BANNER         = NO
 | 
			
		||||
QT_AUTOBRIEF           = NO
 | 
			
		||||
MULTILINE_CPP_IS_BRIEF = NO
 | 
			
		||||
INHERIT_DOCS           = YES
 | 
			
		||||
SEPARATE_MEMBER_PAGES  = NO
 | 
			
		||||
TAB_SIZE               = 4
 | 
			
		||||
ALIASES                =
 | 
			
		||||
TCL_SUBST              =
 | 
			
		||||
OPTIMIZE_OUTPUT_FOR_C  = NO
 | 
			
		||||
OPTIMIZE_OUTPUT_JAVA   = NO
 | 
			
		||||
OPTIMIZE_FOR_FORTRAN   = NO
 | 
			
		||||
OPTIMIZE_OUTPUT_VHDL   = NO
 | 
			
		||||
OPTIMIZE_OUTPUT_SLICE  = NO
 | 
			
		||||
EXTENSION_MAPPING      =
 | 
			
		||||
MARKDOWN_SUPPORT       = YES
 | 
			
		||||
TOC_INCLUDE_HEADINGS   = 5
 | 
			
		||||
AUTOLINK_SUPPORT       = YES
 | 
			
		||||
BUILTIN_STL_SUPPORT    = NO
 | 
			
		||||
CPP_CLI_SUPPORT        = NO
 | 
			
		||||
SIP_SUPPORT            = NO
 | 
			
		||||
IDL_PROPERTY_SUPPORT   = YES
 | 
			
		||||
DISTRIBUTE_GROUP_DOC   = NO
 | 
			
		||||
GROUP_NESTED_COMPOUNDS = NO
 | 
			
		||||
SUBGROUPING            = YES
 | 
			
		||||
INLINE_GROUPED_CLASSES = NO
 | 
			
		||||
INLINE_SIMPLE_STRUCTS  = NO
 | 
			
		||||
TYPEDEF_HIDES_STRUCT   = NO
 | 
			
		||||
LOOKUP_CACHE_SIZE      = 0
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Build related configuration options
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
EXTRACT_ALL            = YES
 | 
			
		||||
EXTRACT_PRIVATE        = YES
 | 
			
		||||
EXTRACT_PRIV_VIRTUAL   = NO
 | 
			
		||||
EXTRACT_PACKAGE        = NO
 | 
			
		||||
EXTRACT_STATIC         = YES
 | 
			
		||||
EXTRACT_LOCAL_CLASSES  = YES
 | 
			
		||||
EXTRACT_LOCAL_METHODS  = YES
 | 
			
		||||
EXTRACT_ANON_NSPACES   = NO
 | 
			
		||||
HIDE_UNDOC_MEMBERS     = NO
 | 
			
		||||
HIDE_UNDOC_CLASSES     = NO
 | 
			
		||||
HIDE_FRIEND_COMPOUNDS  = NO
 | 
			
		||||
HIDE_IN_BODY_DOCS      = NO
 | 
			
		||||
INTERNAL_DOCS          = NO
 | 
			
		||||
CASE_SENSE_NAMES       = NO
 | 
			
		||||
HIDE_SCOPE_NAMES       = NO
 | 
			
		||||
HIDE_COMPOUND_REFERENCE= NO
 | 
			
		||||
SHOW_INCLUDE_FILES     = YES
 | 
			
		||||
SHOW_GROUPED_MEMB_INC  = NO
 | 
			
		||||
FORCE_LOCAL_INCLUDES   = NO
 | 
			
		||||
INLINE_INFO            = YES
 | 
			
		||||
SORT_MEMBER_DOCS       = YES
 | 
			
		||||
SORT_BRIEF_DOCS        = NO
 | 
			
		||||
SORT_MEMBERS_CTORS_1ST = NO
 | 
			
		||||
SORT_GROUP_NAMES       = NO
 | 
			
		||||
SORT_BY_SCOPE_NAME     = NO
 | 
			
		||||
STRICT_PROTO_MATCHING  = NO
 | 
			
		||||
GENERATE_TODOLIST      = YES
 | 
			
		||||
GENERATE_TESTLIST      = YES
 | 
			
		||||
GENERATE_BUGLIST       = YES
 | 
			
		||||
GENERATE_DEPRECATEDLIST= YES
 | 
			
		||||
ENABLED_SECTIONS       =
 | 
			
		||||
MAX_INITIALIZER_LINES  = 30
 | 
			
		||||
SHOW_USED_FILES        = YES
 | 
			
		||||
SHOW_FILES             = YES
 | 
			
		||||
SHOW_NAMESPACES        = YES
 | 
			
		||||
FILE_VERSION_FILTER    =
 | 
			
		||||
LAYOUT_FILE            =
 | 
			
		||||
CITE_BIB_FILES         =
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to warning and progress messages
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
QUIET                  = NO
 | 
			
		||||
WARNINGS               = YES
 | 
			
		||||
WARN_IF_UNDOCUMENTED   = YES
 | 
			
		||||
WARN_IF_DOC_ERROR      = YES
 | 
			
		||||
WARN_NO_PARAMDOC       = NO
 | 
			
		||||
WARN_AS_ERROR          = NO
 | 
			
		||||
WARN_FORMAT            = "$file:$line: $text"
 | 
			
		||||
WARN_LOGFILE           =
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the input files
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
INPUT                  = "@PROJECT_SOURCE_DIR@/src" \
 | 
			
		||||
                         "@PROJECT_SOURCE_DIR@/doc/html"
 | 
			
		||||
INPUT_ENCODING         = UTF-8
 | 
			
		||||
FILE_PATTERNS          = *.c \
 | 
			
		||||
                         *.cc \
 | 
			
		||||
                         *.cxx \
 | 
			
		||||
                         *.cpp \
 | 
			
		||||
                         *.c++ \
 | 
			
		||||
                         *.java \
 | 
			
		||||
                         *.ii \
 | 
			
		||||
                         *.ixx \
 | 
			
		||||
                         *.ipp \
 | 
			
		||||
                         *.i++ \
 | 
			
		||||
                         *.inl \
 | 
			
		||||
                         *.idl \
 | 
			
		||||
                         *.ddl \
 | 
			
		||||
                         *.odl \
 | 
			
		||||
                         *.h \
 | 
			
		||||
                         *.hh \
 | 
			
		||||
                         *.hxx \
 | 
			
		||||
                         *.hpp \
 | 
			
		||||
                         *.h++ \
 | 
			
		||||
                         *.cs \
 | 
			
		||||
                         *.d \
 | 
			
		||||
                         *.php \
 | 
			
		||||
                         *.php4 \
 | 
			
		||||
                         *.php5 \
 | 
			
		||||
                         *.phtml \
 | 
			
		||||
                         *.inc \
 | 
			
		||||
                         *.m \
 | 
			
		||||
                         *.markdown \
 | 
			
		||||
                         *.md \
 | 
			
		||||
                         *.mm \
 | 
			
		||||
                         *.dox \
 | 
			
		||||
                         *.py \
 | 
			
		||||
                         *.pyw \
 | 
			
		||||
                         *.f90 \
 | 
			
		||||
                         *.f95 \
 | 
			
		||||
                         *.f03 \
 | 
			
		||||
                         *.f08 \
 | 
			
		||||
                         *.f \
 | 
			
		||||
                         *.for \
 | 
			
		||||
                         *.tcl \
 | 
			
		||||
                         *.vhd \
 | 
			
		||||
                         *.vhdl \
 | 
			
		||||
                         *.ucf \
 | 
			
		||||
                         *.qsf
 | 
			
		||||
RECURSIVE              = YES
 | 
			
		||||
EXCLUDE                =
 | 
			
		||||
EXCLUDE_SYMLINKS       = NO
 | 
			
		||||
EXCLUDE_PATTERNS       =
 | 
			
		||||
EXCLUDE_SYMBOLS        =
 | 
			
		||||
EXAMPLE_PATH           =
 | 
			
		||||
EXAMPLE_PATTERNS       = *
 | 
			
		||||
EXAMPLE_RECURSIVE      = NO
 | 
			
		||||
IMAGE_PATH             =
 | 
			
		||||
INPUT_FILTER           =
 | 
			
		||||
FILTER_PATTERNS        =
 | 
			
		||||
FILTER_SOURCE_FILES    = NO
 | 
			
		||||
FILTER_SOURCE_PATTERNS =
 | 
			
		||||
USE_MDFILE_AS_MAINPAGE =
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to source browsing
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
SOURCE_BROWSER         = NO
 | 
			
		||||
INLINE_SOURCES         = NO
 | 
			
		||||
STRIP_CODE_COMMENTS    = YES
 | 
			
		||||
REFERENCED_BY_RELATION = NO
 | 
			
		||||
REFERENCES_RELATION    = NO
 | 
			
		||||
REFERENCES_LINK_SOURCE = YES
 | 
			
		||||
SOURCE_TOOLTIPS        = YES
 | 
			
		||||
USE_HTAGS              = NO
 | 
			
		||||
VERBATIM_HEADERS       = YES
 | 
			
		||||
CLANG_ASSISTED_PARSING = NO
 | 
			
		||||
CLANG_OPTIONS          =
 | 
			
		||||
CLANG_DATABASE_PATH    =
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the alphabetical class index
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
ALPHABETICAL_INDEX     = YES
 | 
			
		||||
COLS_IN_ALPHA_INDEX    = 5
 | 
			
		||||
IGNORE_PREFIX          =
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the HTML output
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
GENERATE_HTML          = @GENERATE_HTML@
 | 
			
		||||
HTML_OUTPUT            = html
 | 
			
		||||
HTML_FILE_EXTENSION    = .html
 | 
			
		||||
HTML_HEADER            =
 | 
			
		||||
HTML_FOOTER            =
 | 
			
		||||
HTML_STYLESHEET        =
 | 
			
		||||
HTML_EXTRA_STYLESHEET  =
 | 
			
		||||
HTML_EXTRA_FILES       =
 | 
			
		||||
HTML_COLORSTYLE_HUE    = 220
 | 
			
		||||
HTML_COLORSTYLE_SAT    = 100
 | 
			
		||||
HTML_COLORSTYLE_GAMMA  = 80
 | 
			
		||||
HTML_TIMESTAMP         = NO
 | 
			
		||||
HTML_DYNAMIC_MENUS     = YES
 | 
			
		||||
HTML_DYNAMIC_SECTIONS  = NO
 | 
			
		||||
HTML_INDEX_NUM_ENTRIES = 100
 | 
			
		||||
GENERATE_DOCSET        = NO
 | 
			
		||||
DOCSET_FEEDNAME        = "Doxygen generated docs"
 | 
			
		||||
DOCSET_BUNDLE_ID       = org.doxygen.Project
 | 
			
		||||
DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
 | 
			
		||||
DOCSET_PUBLISHER_NAME  = Publisher
 | 
			
		||||
GENERATE_HTMLHELP      = NO
 | 
			
		||||
CHM_FILE               =
 | 
			
		||||
HHC_LOCATION           =
 | 
			
		||||
GENERATE_CHI           = NO
 | 
			
		||||
CHM_INDEX_ENCODING     =
 | 
			
		||||
BINARY_TOC             = NO
 | 
			
		||||
TOC_EXPAND             = NO
 | 
			
		||||
GENERATE_QHP           = NO
 | 
			
		||||
QCH_FILE               =
 | 
			
		||||
QHP_NAMESPACE          = org.doxygen.Project
 | 
			
		||||
QHP_VIRTUAL_FOLDER     = doc
 | 
			
		||||
QHP_CUST_FILTER_NAME   =
 | 
			
		||||
QHP_CUST_FILTER_ATTRS  =
 | 
			
		||||
QHP_SECT_FILTER_ATTRS  =
 | 
			
		||||
QHG_LOCATION           =
 | 
			
		||||
GENERATE_ECLIPSEHELP   = NO
 | 
			
		||||
ECLIPSE_DOC_ID         = org.doxygen.Project
 | 
			
		||||
DISABLE_INDEX          = NO
 | 
			
		||||
GENERATE_TREEVIEW      = YES
 | 
			
		||||
ENUM_VALUES_PER_LINE   = 4
 | 
			
		||||
TREEVIEW_WIDTH         = 250
 | 
			
		||||
EXT_LINKS_IN_WINDOW    = NO
 | 
			
		||||
FORMULA_FONTSIZE       = 10
 | 
			
		||||
FORMULA_TRANSPARENT    = YES
 | 
			
		||||
USE_MATHJAX            = NO
 | 
			
		||||
MATHJAX_FORMAT         = HTML-CSS
 | 
			
		||||
MATHJAX_RELPATH        = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
 | 
			
		||||
MATHJAX_EXTENSIONS     =
 | 
			
		||||
MATHJAX_CODEFILE       =
 | 
			
		||||
SEARCHENGINE           = YES
 | 
			
		||||
SERVER_BASED_SEARCH    = NO
 | 
			
		||||
EXTERNAL_SEARCH        = NO
 | 
			
		||||
SEARCHENGINE_URL       =
 | 
			
		||||
SEARCHDATA_FILE        = searchdata.xml
 | 
			
		||||
EXTERNAL_SEARCH_ID     =
 | 
			
		||||
EXTRA_SEARCH_MAPPINGS  =
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the LaTeX output
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
GENERATE_LATEX         = @GENERATE_LATEX@
 | 
			
		||||
LATEX_OUTPUT           = latex
 | 
			
		||||
LATEX_CMD_NAME         = latex
 | 
			
		||||
MAKEINDEX_CMD_NAME     = makeindex
 | 
			
		||||
LATEX_MAKEINDEX_CMD    = makeindex
 | 
			
		||||
COMPACT_LATEX          = NO
 | 
			
		||||
PAPER_TYPE             = a4
 | 
			
		||||
EXTRA_PACKAGES         =
 | 
			
		||||
LATEX_HEADER           =
 | 
			
		||||
LATEX_FOOTER           =
 | 
			
		||||
LATEX_EXTRA_STYLESHEET =
 | 
			
		||||
LATEX_EXTRA_FILES      =
 | 
			
		||||
PDF_HYPERLINKS         = YES
 | 
			
		||||
USE_PDFLATEX           = YES
 | 
			
		||||
LATEX_BATCHMODE        = NO
 | 
			
		||||
LATEX_HIDE_INDICES     = NO
 | 
			
		||||
LATEX_SOURCE_CODE      = NO
 | 
			
		||||
LATEX_BIB_STYLE        = plain
 | 
			
		||||
LATEX_TIMESTAMP        = NO
 | 
			
		||||
LATEX_EMOJI_DIRECTORY  =
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the RTF output
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
GENERATE_RTF           = NO
 | 
			
		||||
RTF_OUTPUT             = rtf
 | 
			
		||||
COMPACT_RTF            = NO
 | 
			
		||||
RTF_HYPERLINKS         = NO
 | 
			
		||||
RTF_STYLESHEET_FILE    =
 | 
			
		||||
RTF_EXTENSIONS_FILE    =
 | 
			
		||||
RTF_SOURCE_CODE        = NO
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the man page output
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
GENERATE_MAN           = NO
 | 
			
		||||
MAN_OUTPUT             = man
 | 
			
		||||
MAN_EXTENSION          = .3
 | 
			
		||||
MAN_SUBDIR             =
 | 
			
		||||
MAN_LINKS              = NO
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the XML output
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
GENERATE_XML           = @GENERATE_XML@
 | 
			
		||||
XML_OUTPUT             = xml
 | 
			
		||||
XML_PROGRAMLISTING     = YES
 | 
			
		||||
XML_NS_MEMB_FILE_SCOPE = NO
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the DOCBOOK output
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
GENERATE_DOCBOOK       = NO
 | 
			
		||||
DOCBOOK_OUTPUT         = docbook
 | 
			
		||||
DOCBOOK_PROGRAMLISTING = NO
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options for the AutoGen Definitions output
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
GENERATE_AUTOGEN_DEF   = NO
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the Perl module output
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
GENERATE_PERLMOD       = NO
 | 
			
		||||
PERLMOD_LATEX          = NO
 | 
			
		||||
PERLMOD_PRETTY         = YES
 | 
			
		||||
PERLMOD_MAKEVAR_PREFIX =
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the preprocessor
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
ENABLE_PREPROCESSING   = YES
 | 
			
		||||
MACRO_EXPANSION        = NO
 | 
			
		||||
EXPAND_ONLY_PREDEF     = NO
 | 
			
		||||
SEARCH_INCLUDES        = YES
 | 
			
		||||
INCLUDE_PATH           =
 | 
			
		||||
INCLUDE_FILE_PATTERNS  =
 | 
			
		||||
PREDEFINED             =
 | 
			
		||||
EXPAND_AS_DEFINED      =
 | 
			
		||||
SKIP_FUNCTION_MACROS   = YES
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to external references
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
TAGFILES               =
 | 
			
		||||
GENERATE_TAGFILE       =
 | 
			
		||||
ALLEXTERNALS           = NO
 | 
			
		||||
EXTERNAL_GROUPS        = YES
 | 
			
		||||
EXTERNAL_PAGES         = YES
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
# Configuration options related to the dot tool
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
CLASS_DIAGRAMS         = YES
 | 
			
		||||
DIA_PATH               =
 | 
			
		||||
HIDE_UNDOC_RELATIONS   = YES
 | 
			
		||||
HAVE_DOT               = YES
 | 
			
		||||
DOT_NUM_THREADS        = 0
 | 
			
		||||
DOT_FONTNAME           = Helvetica
 | 
			
		||||
DOT_FONTSIZE           = 10
 | 
			
		||||
DOT_FONTPATH           =
 | 
			
		||||
CLASS_GRAPH            = YES
 | 
			
		||||
COLLABORATION_GRAPH    = YES
 | 
			
		||||
GROUP_GRAPHS           = YES
 | 
			
		||||
UML_LOOK               = YES
 | 
			
		||||
UML_LIMIT_NUM_FIELDS   = 10
 | 
			
		||||
TEMPLATE_RELATIONS     = YES
 | 
			
		||||
INCLUDE_GRAPH          = YES
 | 
			
		||||
INCLUDED_BY_GRAPH      = YES
 | 
			
		||||
CALL_GRAPH             = YES
 | 
			
		||||
CALLER_GRAPH           = YES
 | 
			
		||||
GRAPHICAL_HIERARCHY    = YES
 | 
			
		||||
DIRECTORY_GRAPH        = YES
 | 
			
		||||
DOT_IMAGE_FORMAT       = png
 | 
			
		||||
INTERACTIVE_SVG        = YES
 | 
			
		||||
DOT_PATH               = @DOXYGEN_DOT_PATH@
 | 
			
		||||
DOTFILE_DIRS           =
 | 
			
		||||
MSCFILE_DIRS           =
 | 
			
		||||
DIAFILE_DIRS           =
 | 
			
		||||
PLANTUML_JAR_PATH      =
 | 
			
		||||
PLANTUML_CFG_FILE      =
 | 
			
		||||
PLANTUML_INCLUDE_PATH  =
 | 
			
		||||
DOT_GRAPH_MAX_NODES    = 50
 | 
			
		||||
MAX_DOT_GRAPH_DEPTH    = 0
 | 
			
		||||
DOT_TRANSPARENT        = NO
 | 
			
		||||
DOT_MULTI_TARGETS      = NO
 | 
			
		||||
GENERATE_LEGEND        = YES
 | 
			
		||||
DOT_CLEANUP            = YES
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										185
									
								
								doxygen/breathe-conf.py.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										185
									
								
								doxygen/breathe-conf.py.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,185 @@
 | 
			
		||||
#!@PYTHON_EXECUTABLE@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import subprocess
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
# -- General configuration ------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# At top on conf.py (with other import statements)
 | 
			
		||||
import recommonmark
 | 
			
		||||
from recommonmark.parser import CommonMarkParser
 | 
			
		||||
from recommonmark.transform import AutoStructify
 | 
			
		||||
from recommonmark.states import DummyStateMachine
 | 
			
		||||
# Monkey patch to fix recommonmark 0.4 doc reference issues.
 | 
			
		||||
orig_run_role = DummyStateMachine.run_role
 | 
			
		||||
def run_role(self, name, options=None, content=None):
 | 
			
		||||
    if name == 'doc':
 | 
			
		||||
        name = 'any'
 | 
			
		||||
    return orig_run_role(self, name, options, content)
 | 
			
		||||
DummyStateMachine.run_role = run_role
 | 
			
		||||
 | 
			
		||||
source_parsers = {
 | 
			
		||||
    '.md': CommonMarkParser
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# If your documentation needs a minimal Sphinx version, state it here.
 | 
			
		||||
#
 | 
			
		||||
# needs_sphinx = '1.0'
 | 
			
		||||
 | 
			
		||||
# Add any Sphinx extension module names here, as strings. They can be
 | 
			
		||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 | 
			
		||||
# ones.
 | 
			
		||||
extensions = [
 | 
			
		||||
    'breathe', 'sphinx.ext.autosectionlabel', 'recommonmark'
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
# Add any paths that contain templates here, relative to this directory.
 | 
			
		||||
templates_path = ['_templates']
 | 
			
		||||
 | 
			
		||||
# The suffix(es) of source filenames.
 | 
			
		||||
# You can specify multiple suffix as a list of string:
 | 
			
		||||
#
 | 
			
		||||
source_suffix = ['.rst', '.md']
 | 
			
		||||
 | 
			
		||||
# The master toctree document.
 | 
			
		||||
master_doc = 'index'
 | 
			
		||||
 | 
			
		||||
# General information about the project.
 | 
			
		||||
project = '@DOXYGEN_PROJECT_TITLE@'
 | 
			
		||||
author = '@AUTHOR_NAME@'
 | 
			
		||||
copyright = '@CMLIB_YEAR@, ' + author
 | 
			
		||||
 | 
			
		||||
# The version info for the project you're documenting, acts as replacement for
 | 
			
		||||
# |version| and |release|, also used in various other places throughout the
 | 
			
		||||
# built documents.
 | 
			
		||||
#
 | 
			
		||||
# The short X.Y version.
 | 
			
		||||
version = '@PROJECT_VERSION@'
 | 
			
		||||
# The full version, including alpha/beta/rc tags.
 | 
			
		||||
release = ''
 | 
			
		||||
 | 
			
		||||
# The language for content autogenerated by Sphinx. Refer to documentation
 | 
			
		||||
# for a list of supported languages.
 | 
			
		||||
#
 | 
			
		||||
# This is also used if you do content translation via gettext catalogs.
 | 
			
		||||
# Usually you set "language" from the command line for these cases.
 | 
			
		||||
language = None
 | 
			
		||||
 | 
			
		||||
# List of patterns, relative to source directory, that match files and
 | 
			
		||||
# directories to ignore when looking for source files.
 | 
			
		||||
# This patterns also effect to html_static_path and html_extra_path
 | 
			
		||||
exclude_patterns = ['_build', '_output', 'Thumbs.db', '.DS_Store']
 | 
			
		||||
 | 
			
		||||
# The name of the Pygments (syntax highlighting) style to use.
 | 
			
		||||
pygments_style = 'sphinx'
 | 
			
		||||
 | 
			
		||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
 | 
			
		||||
todo_include_todos = False
 | 
			
		||||
 | 
			
		||||
# -- Options for HTML output ----------------------------------------------
 | 
			
		||||
 | 
			
		||||
# The theme to use for HTML and HTML Help pages.  See the documentation for
 | 
			
		||||
# a list of builtin themes.
 | 
			
		||||
#
 | 
			
		||||
html_theme = 'sphinx_rtd_theme'
 | 
			
		||||
 | 
			
		||||
# Theme options are theme-specific and customize the look and feel of a theme
 | 
			
		||||
# further.  For a list of options available for each theme, see the
 | 
			
		||||
# documentation.
 | 
			
		||||
#
 | 
			
		||||
# html_theme_options = {}
 | 
			
		||||
 | 
			
		||||
# Add any paths that contain custom static files (such as style sheets) here,
 | 
			
		||||
# relative to this directory. They are copied after the builtin static files,
 | 
			
		||||
# so a file named "default.css" will overwrite the builtin "default.css".
 | 
			
		||||
html_static_path = []
 | 
			
		||||
 | 
			
		||||
# Custom sidebar templates, must be a dictionary that maps document names
 | 
			
		||||
# to template names.
 | 
			
		||||
#
 | 
			
		||||
# This is required for the alabaster theme
 | 
			
		||||
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
 | 
			
		||||
html_sidebars = {
 | 
			
		||||
    '**': [
 | 
			
		||||
        'relations.html',  # needs 'show_related': True theme option to display
 | 
			
		||||
        'searchbox.html',
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# -- Options for HTMLHelp output ------------------------------------------
 | 
			
		||||
 | 
			
		||||
# Output file base name for HTML help builder.
 | 
			
		||||
htmlhelp_basename = '@PROJECT_NAME@doc'
 | 
			
		||||
 | 
			
		||||
# -- Options for LaTeX output ---------------------------------------------
 | 
			
		||||
 | 
			
		||||
latex_elements = {
 | 
			
		||||
    # The paper size ('letterpaper' or 'a4paper').
 | 
			
		||||
    #
 | 
			
		||||
    # 'papersize': 'letterpaper',
 | 
			
		||||
 | 
			
		||||
    # The font size ('10pt', '11pt' or '12pt').
 | 
			
		||||
    #
 | 
			
		||||
    # 'pointsize': '10pt',
 | 
			
		||||
 | 
			
		||||
    # Additional stuff for the LaTeX preamble.
 | 
			
		||||
    #
 | 
			
		||||
    # 'preamble': '',
 | 
			
		||||
 | 
			
		||||
    # Latex figure (float) alignment
 | 
			
		||||
    #
 | 
			
		||||
    # 'figure_align': 'htbp',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Grouping the document tree into LaTeX files. List of tuples
 | 
			
		||||
# (source start file, target name, title,
 | 
			
		||||
#  author, documentclass [howto, manual, or own class]).
 | 
			
		||||
latex_documents = [
 | 
			
		||||
    (master_doc, '@PROJECT_NAME@.tex', '@PROJECT_NAME@ Documentation',
 | 
			
		||||
     author, 'manual'),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
# -- Options for manual page output ---------------------------------------
 | 
			
		||||
 | 
			
		||||
# One entry per manual page. List of tuples
 | 
			
		||||
# (source start file, name, description, authors, manual section).
 | 
			
		||||
man_pages = [(master_doc, '@PROJECT_NAME@', '@PROJECT_NAME@ Documentation', [author], 1)]
 | 
			
		||||
 | 
			
		||||
# -- Options for Texinfo output -------------------------------------------
 | 
			
		||||
 | 
			
		||||
# Grouping the document tree into Texinfo files. List of tuples
 | 
			
		||||
# (source start file, target name, title, author,
 | 
			
		||||
#  dir menu entry, description, category)
 | 
			
		||||
texinfo_documents = [
 | 
			
		||||
    (master_doc, '@PROJECT_NAME@', '@PROJECT_NAME@ Documentation', author, '@PROJECT_NAME@',
 | 
			
		||||
     'One line description of project.', 'Miscellaneous'),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
breathe_projects = {'@PROJECT_NAME@': '@BREATHE_DOCS_BUILD_DIR@/xml'}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def run_doxygen(folder):
 | 
			
		||||
    """Run the doxygen make command in the designated folder"""
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        retcode = subprocess.call("cd {}; doxygen".format(folder), shell=True)
 | 
			
		||||
        if retcode < 0:
 | 
			
		||||
            sys.stderr.write(
 | 
			
		||||
                "doxygen terminated by signal {}".format(-retcode))
 | 
			
		||||
    except OSError as e:
 | 
			
		||||
        sys.stderr.write("doxygen execution failed: {}".format(e))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def setup(app):
 | 
			
		||||
    run_doxygen('@BREATHE_DOCS_BUILD_DIR@')
 | 
			
		||||
    app.add_config_value('recommonmark_config', {
 | 
			
		||||
        'enable_auto_toc_tree': True,
 | 
			
		||||
        'enable_eval_rst': True,
 | 
			
		||||
        'enable_auto_doc_ref': True,
 | 
			
		||||
        'enable_math': True,
 | 
			
		||||
        'enable_inline_math': True
 | 
			
		||||
        }, True)
 | 
			
		||||
    app.add_transform(AutoStructify)
 | 
			
		||||
							
								
								
									
										31
									
								
								hpp/cmlib_git_version.hpp.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								hpp/cmlib_git_version.hpp.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
#ifndef @CMLIB_PROJECT_NAME_UPPER@_CMLIB_GIT_VERSION_HPP_
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_UPPER@_CMLIB_GIT_VERSION_HPP_
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#if defined (@CMLIB_PROJECT_NAME_UPPER@_GIT_REV)
 | 
			
		||||
#error "Duplicate definition of macros @CMLIB_PROJECT_NAME_UPPER@_GIT_REV"
 | 
			
		||||
#else
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_UPPER@_GIT_REV "@CMLIB_GIT_REV@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (@CMLIB_PROJECT_NAME_UPPER@_GIT_DIFF)
 | 
			
		||||
#error "Duplicate definition of macros @CMLIB_PROJECT_NAME_UPPER@_GIT_DIFF"
 | 
			
		||||
#else
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_UPPER@_GIT_DIFF "@CMLIB_GIT_DIFF@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (@CMLIB_PROJECT_NAME_UPPER@_GIT_BRANCH)
 | 
			
		||||
#error "Duplicate definition of macros @CMLIB_PROJECT_NAME_UPPER@_GIT_BRANCH"
 | 
			
		||||
#else
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_UPPER@_GIT_BRANCH "@CMLIB_GIT_BRANCH@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (@CMLIB_PROJECT_NAME_UPPER@_GIT_TAG)
 | 
			
		||||
#error "Duplicate definition of macros @CMLIB_PROJECT_NAME_UPPER@_GIT_TAG"
 | 
			
		||||
#else
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_UPPER@_GIT_TAG "@CMLIB_GIT_TAG@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* @CMLIB_PROJECT_NAME_UPPER@_CMLIB_GIT_VERSION_HPP_ */
 | 
			
		||||
 | 
			
		||||
@@ -1,15 +1,15 @@
 | 
			
		||||
#ifndef @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_
 | 
			
		||||
#ifndef @CMLIB_PROJECT_NAME_UPPER@_CMLIB_CONFIG_HPP_
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_UPPER@_CMLIB_CONFIG_HPP_
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_STR "@PROJECT_VERSION@"
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_INT @PROJECT_VERSION_INT@
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_UPPER@_VERSION_STR "@PROJECT_VERSION@"
 | 
			
		||||
#define @CMLIB_PROJECT_NAME_UPPER@_VERSION_INT @PROJECT_VERSION_INT@
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_ORGANIZATION_NAME)
 | 
			
		||||
#error "Duplicate definition of macros CMLIB_ORGANIZATION_NAME"
 | 
			
		||||
#else
 | 
			
		||||
#define CMLIB_ORGANIZATION_NAME "@ORGANIZATION_NAME@"
 | 
			
		||||
#define CMLIB_ORGANIZATION_NAME "@CMLIB_ORGANIZATION_NAME@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_ORGANIZATION_NAME_LOWER)
 | 
			
		||||
@@ -42,6 +42,42 @@
 | 
			
		||||
#define CMLIB_PROJECT_NAME_UPPER "@CMLIB_PROJECT_NAME_UPPER@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_THEME_NAME)
 | 
			
		||||
#error "Duplicate definition of macros CMLIB_THEME_NAME"
 | 
			
		||||
#else
 | 
			
		||||
#define CMLIB_THEME_NAME "@CMLIB_THEME_NAME@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_THEME_NAME_LOWER)
 | 
			
		||||
#error "Duplicate definition of macros CMLIB_THEME_NAME_LOWER"
 | 
			
		||||
#else
 | 
			
		||||
#define CMLIB_THEME_NAME_LOWER "@CMLIB_THEME_NAME_LOWER@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_THEME_NAME_UPPER)
 | 
			
		||||
#error "Duplicate definition of macros CMLIB_THEME_NAME_UPPER"
 | 
			
		||||
#else
 | 
			
		||||
#define CMLIB_THEME_NAME_UPPER "@CMLIB_THEME_NAME_UPPER@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_AUTHOR_NAME)
 | 
			
		||||
#error "Duplicate definition of macros CMLIB_AUTHOR_NAME"
 | 
			
		||||
#else
 | 
			
		||||
#define CMLIB_AUTHOR_NAME "@CMLIB_AUTHOR_NAME@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_AUTHOR_EMAIL)
 | 
			
		||||
#error "Duplicate definition of macros CMLIB_AUTHOR_EMAIL"
 | 
			
		||||
#else
 | 
			
		||||
#define CMLIB_AUTHOR_EMAIL "@CMLIB_AUTHOR_EMAIL@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_DESCRIPTION)
 | 
			
		||||
#error "Duplicate definition of macros CMLIB_DESCRIPTION"
 | 
			
		||||
#else
 | 
			
		||||
#define CMLIB_DESCRIPTION "@CMLIB_DESCRIPTION@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (CMLIB_BUILD_TYPE)
 | 
			
		||||
#error "Duplicate definition of macros CMLIB_BUILD_TYPE"
 | 
			
		||||
#else
 | 
			
		||||
@@ -54,5 +90,5 @@
 | 
			
		||||
#define CMLIB_BUILD_DATE "@TODAY@"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_ */
 | 
			
		||||
#endif /* @CMLIB_PROJECT_NAME_UPPER@_CMLIB_CONFIG_HPP_ */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								hpp/pvs_studio.hpp.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								hpp/pvs_studio.hpp.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
#ifndef PVS_STUDIO_HPP_
 | 
			
		||||
#define PVS_STUDIO_HPP_
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
//-V813_MINSIZE=33
 | 
			
		||||
 | 
			
		||||
#endif // PVS_STUDIO_HPP_
 | 
			
		||||
							
								
								
									
										11
									
								
								pc/lib-header-only.pc.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								pc/lib-header-only.pc.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
prefix=@CMAKE_INSTALL_PREFIX@
 | 
			
		||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
 | 
			
		||||
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
 | 
			
		||||
 | 
			
		||||
Name: @library_name@
 | 
			
		||||
Description: @library_name@ library
 | 
			
		||||
Version: @PROJECT_VERSION@
 | 
			
		||||
 | 
			
		||||
Requires:
 | 
			
		||||
Cflags: -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
 | 
			
		||||
 | 
			
		||||
@@ -3,11 +3,11 @@ exec_prefix=@CMAKE_INSTALL_PREFIX@
 | 
			
		||||
libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
 | 
			
		||||
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
 | 
			
		||||
 | 
			
		||||
Name: @current_target@
 | 
			
		||||
Description: @current_target@ library
 | 
			
		||||
Name: @library_name@
 | 
			
		||||
Description: @library_name@ library
 | 
			
		||||
Version: @PROJECT_VERSION@
 | 
			
		||||
 | 
			
		||||
Requires:
 | 
			
		||||
Libs: -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -l@current_target@
 | 
			
		||||
Libs: -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -l@library_name@
 | 
			
		||||
Cflags: -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								thirdparty/cotire.cmake
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								thirdparty/cotire.cmake
									
									
									
									
										vendored
									
									
								
							@@ -1136,6 +1136,11 @@ function (cotire_parse_includes _language _scanOutput _ignoredIncludeDirs _honor
 | 
			
		||||
	string (REPLACE ";" "\\;" _scanOutput "${_scanOutput}")
 | 
			
		||||
	# then separate lines
 | 
			
		||||
	string (REGEX REPLACE "\n" ";" _scanOutput "${_scanOutput}")
 | 
			
		||||
	if ("${_language}" STREQUAL "CXX")
 | 
			
		||||
	    # Fix clang9's libc++ errno
 | 
			
		||||
	    message (STATUS "replacing <stdlib.h> with <cstdlib>")
 | 
			
		||||
	    string (REGEX REPLACE "include_next" "include" _scanOutput "${_scanOutput}")
 | 
			
		||||
	endif()
 | 
			
		||||
	list (LENGTH _scanOutput _len)
 | 
			
		||||
	# remove duplicate lines to speed up parsing
 | 
			
		||||
	list (REMOVE_DUPLICATES _scanOutput)
 | 
			
		||||
@@ -3701,7 +3706,7 @@ if (CMAKE_SCRIPT_MODE_FILE)
 | 
			
		||||
			COMPILER_VERSION "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_VERSION}"
 | 
			
		||||
			LANGUAGE "${COTIRE_TARGET_LANGUAGE}"
 | 
			
		||||
			IGNORE_PATH "${COTIRE_TARGET_IGNORE_PATH};${COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH}"
 | 
			
		||||
			INCLUDE_PATH ${COTIRE_TARGET_INCLUDE_PATH}
 | 
			
		||||
			INCLUDE_PATH "${COTIRE_TARGET_INCLUDE_PATH};${COTIRE_ADDITIONAL_PREFIX_HEADER_INCLUDE_PATH}"
 | 
			
		||||
			IGNORE_EXTENSIONS "${CMAKE_${COTIRE_TARGET_LANGUAGE}_SOURCE_FILE_EXTENSIONS};${COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS}"
 | 
			
		||||
			INCLUDE_PRIORITY_PATH ${COTIRE_TARGET_INCLUDE_PRIORITY_PATH}
 | 
			
		||||
			INCLUDE_DIRECTORIES ${_includeDirs}
 | 
			
		||||
@@ -3802,6 +3807,9 @@ else()
 | 
			
		||||
	set (COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH "" CACHE STRING
 | 
			
		||||
		"Ignore headers from these directories when generating the prefix header.")
 | 
			
		||||
 | 
			
		||||
	set (COTIRE_ADDITIONAL_PREFIX_HEADER_INCLUDE_PATH "" CACHE STRING
 | 
			
		||||
		"Include headers from these directories when generating the prefix header.")
 | 
			
		||||
 | 
			
		||||
	set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING
 | 
			
		||||
		"Ignore sources with the listed file extensions from the generated unity source.")
 | 
			
		||||
 | 
			
		||||
@@ -3878,6 +3886,15 @@ else()
 | 
			
		||||
			"If not defined, defaults to empty list."
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	define_property(
 | 
			
		||||
		CACHED_VARIABLE PROPERTY "COTIRE_ADDITIONAL_PREFIX_HEADER_INCLUDE_PATH"
 | 
			
		||||
		BRIEF_DOCS "Include headers from these directories when generating the prefix header."
 | 
			
		||||
		FULL_DOCS
 | 
			
		||||
			"The variable can be set to a semicolon separated list of include directories."
 | 
			
		||||
			"If a header file is found in one of these directories or sub-directories, it will be included in the generated prefix header."
 | 
			
		||||
			"If not defined, defaults to empty list."
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	define_property(
 | 
			
		||||
		CACHED_VARIABLE PROPERTY "COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS"
 | 
			
		||||
		BRIEF_DOCS "Ignore includes with the listed file extensions from the generated prefix header."
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								thirdparty/sanitizers
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								thirdparty/sanitizers
									
									
									
									
										vendored
									
									
								
							 Submodule thirdparty/sanitizers deleted from f1abee3365
									
								
							
							
								
								
									
										248
									
								
								thirdparty/sanitizers/.cmake-format.py
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										248
									
								
								thirdparty/sanitizers/.cmake-format.py
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,248 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
# ----------------------------------
 | 
			
		||||
# Options affecting listfile parsing
 | 
			
		||||
# ----------------------------------
 | 
			
		||||
with section("parse"):
 | 
			
		||||
 | 
			
		||||
  # Specify structure for custom cmake functions
 | 
			
		||||
  additional_commands = {
 | 
			
		||||
    'add_doxygen': { 'flags' : [],
 | 
			
		||||
                            'kwargs': { 'LATEX': 1,
 | 
			
		||||
                                        'HTML': 1,
 | 
			
		||||
                                        'COMMENT': 1}},
 | 
			
		||||
    'add_breathe': { 'flags' : [],
 | 
			
		||||
                            'kwargs': { 'COMMENT': 1}},
 | 
			
		||||
    'add_common_library': { 'flags' : [],
 | 
			
		||||
                            'kwargs': { 'OUTPUT_NAME': 1,
 | 
			
		||||
                                        'SOURCES': '*',
 | 
			
		||||
                                        'TARGET': 1}},
 | 
			
		||||
    'qt5_translation': { 'flags' : [],
 | 
			
		||||
                         'kwargs': { 'OUTPUT_DIR': 1,
 | 
			
		||||
                                     'LANGUAGES': '*',
 | 
			
		||||
                                     'SOURCES': '*',
 | 
			
		||||
                                     'BASE_NAME': 1}},
 | 
			
		||||
    'pvs_studio_add_target': { 'flags' : [ 'COMPILE_COMMANDS',
 | 
			
		||||
                                           'OUTPUT',
 | 
			
		||||
                                           'HIDE_HELP'],
 | 
			
		||||
                               'kwargs': { 'ARGS': '*',
 | 
			
		||||
                                           'CONFIG': '*',
 | 
			
		||||
                                           'DEPENDS': '*',
 | 
			
		||||
                                           'FORMAT': '*',
 | 
			
		||||
                                           'MODE': '*',
 | 
			
		||||
                                           'TARGET': 1}},
 | 
			
		||||
    'write_compiler_detection_header': { 'flags' : [],
 | 
			
		||||
                                         'kwargs': { 'COMPILERS': '*',
 | 
			
		||||
                                                     'FEATURES': '*',
 | 
			
		||||
                                                     'FILE': '*',
 | 
			
		||||
                                                     'PREFIX': '*'}}}
 | 
			
		||||
 | 
			
		||||
  # Specify variable tags.
 | 
			
		||||
  vartags = []
 | 
			
		||||
 | 
			
		||||
  # Specify property tags.
 | 
			
		||||
  proptags = []
 | 
			
		||||
 | 
			
		||||
# -----------------------------
 | 
			
		||||
# Options affecting formatting.
 | 
			
		||||
# -----------------------------
 | 
			
		||||
with section("format"):
 | 
			
		||||
 | 
			
		||||
  # How wide to allow formatted cmake files
 | 
			
		||||
  line_width = 100
 | 
			
		||||
 | 
			
		||||
  # How many spaces to tab for indent
 | 
			
		||||
  tab_size = 4
 | 
			
		||||
 | 
			
		||||
  # If an argument group contains more than this many sub-groups (parg or kwarg
 | 
			
		||||
  # groups) then force it to a vertical layout.
 | 
			
		||||
  max_subgroups_hwrap = 3
 | 
			
		||||
 | 
			
		||||
  # If a positional argument group contains more than this many arguments, then
 | 
			
		||||
  # force it to a vertical layout.
 | 
			
		||||
  max_pargs_hwrap = 5
 | 
			
		||||
 | 
			
		||||
  # If a cmdline positional group consumes more than this many lines without
 | 
			
		||||
  # nesting, then invalidate the layout (and nest)
 | 
			
		||||
  max_rows_cmdline = 2
 | 
			
		||||
 | 
			
		||||
  # If true, separate flow control names from their parentheses with a space
 | 
			
		||||
  separate_ctrl_name_with_space = False
 | 
			
		||||
 | 
			
		||||
  # If true, separate function names from parentheses with a space
 | 
			
		||||
  separate_fn_name_with_space = False
 | 
			
		||||
 | 
			
		||||
  # If a statement is wrapped to more than one line, than dangle the closing
 | 
			
		||||
  # parenthesis on its own line.
 | 
			
		||||
  dangle_parens = False
 | 
			
		||||
 | 
			
		||||
  # If the trailing parenthesis must be 'dangled' on its on line, then align it
 | 
			
		||||
  # to this reference: `prefix`: the start of the statement,  `prefix-indent`:
 | 
			
		||||
  # the start of the statement, plus one indentation  level, `child`: align to
 | 
			
		||||
  # the column of the arguments
 | 
			
		||||
  dangle_align = 'prefix'
 | 
			
		||||
 | 
			
		||||
  # If the statement spelling length (including space and parenthesis) is
 | 
			
		||||
  # smaller than this amount, then force reject nested layouts.
 | 
			
		||||
  min_prefix_chars = 4
 | 
			
		||||
 | 
			
		||||
  # If the statement spelling length (including space and parenthesis) is larger
 | 
			
		||||
  # than the tab width by more than this amount, then force reject un-nested
 | 
			
		||||
  # layouts.
 | 
			
		||||
  max_prefix_chars = 2
 | 
			
		||||
 | 
			
		||||
  # If a candidate layout is wrapped horizontally but it exceeds this many
 | 
			
		||||
  # lines, then reject the layout.
 | 
			
		||||
  max_lines_hwrap = 2
 | 
			
		||||
 | 
			
		||||
  # What style line endings to use in the output.
 | 
			
		||||
  line_ending = 'unix'
 | 
			
		||||
 | 
			
		||||
  # Format command names consistently as 'lower' or 'upper' case
 | 
			
		||||
  command_case = 'canonical'
 | 
			
		||||
 | 
			
		||||
  # Format keywords consistently as 'lower' or 'upper' case
 | 
			
		||||
  keyword_case = 'upper'
 | 
			
		||||
 | 
			
		||||
  # A list of command names which should always be wrapped
 | 
			
		||||
  always_wrap = []
 | 
			
		||||
 | 
			
		||||
  # If true, the argument lists which are known to be sortable will be sorted
 | 
			
		||||
  # lexicographicall
 | 
			
		||||
  enable_sort = True
 | 
			
		||||
 | 
			
		||||
  # If true, the parsers may infer whether or not an argument list is sortable
 | 
			
		||||
  # (without annotation).
 | 
			
		||||
  autosort = False
 | 
			
		||||
 | 
			
		||||
  # By default, if cmake-format cannot successfully fit everything into the
 | 
			
		||||
  # desired linewidth it will apply the last, most agressive attempt that it
 | 
			
		||||
  # made. If this flag is True, however, cmake-format will print error, exit
 | 
			
		||||
  # with non-zero status code, and write-out nothing
 | 
			
		||||
  require_valid_layout = False
 | 
			
		||||
 | 
			
		||||
  # A dictionary mapping layout nodes to a list of wrap decisions. See the
 | 
			
		||||
  # documentation for more information.
 | 
			
		||||
  layout_passes = {}
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------
 | 
			
		||||
# Options affecting comment reflow and formatting.
 | 
			
		||||
# ------------------------------------------------
 | 
			
		||||
with section("markup"):
 | 
			
		||||
 | 
			
		||||
  # What character to use for bulleted lists
 | 
			
		||||
  bullet_char = '*'
 | 
			
		||||
 | 
			
		||||
  # What character to use as punctuation after numerals in an enumerated list
 | 
			
		||||
  enum_char = '.'
 | 
			
		||||
 | 
			
		||||
  # If comment markup is enabled, don't reflow the first comment block in each
 | 
			
		||||
  # listfile. Use this to preserve formatting of your copyright/license
 | 
			
		||||
  # statements.
 | 
			
		||||
  first_comment_is_literal = False
 | 
			
		||||
 | 
			
		||||
  # If comment markup is enabled, don't reflow any comment block which matches
 | 
			
		||||
  # this (regex) pattern. Default is `None` (disabled).
 | 
			
		||||
  literal_comment_pattern = None
 | 
			
		||||
 | 
			
		||||
  # Regular expression to match preformat fences in comments default=
 | 
			
		||||
  # ``r'^\s*([`~]{3}[`~]*)(.*)$'``
 | 
			
		||||
  fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
 | 
			
		||||
 | 
			
		||||
  # Regular expression to match rulers in comments default=
 | 
			
		||||
  # ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'``
 | 
			
		||||
  ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'
 | 
			
		||||
 | 
			
		||||
  # If a comment line matches starts with this pattern then it is explicitly a
 | 
			
		||||
  # trailing comment for the preceeding argument. Default is '#<'
 | 
			
		||||
  explicit_trailing_pattern = '#<'
 | 
			
		||||
 | 
			
		||||
  # If a comment line starts with at least this many consecutive hash
 | 
			
		||||
  # characters, then don't lstrip() them off. This allows for lazy hash rulers
 | 
			
		||||
  # where the first hash char is not separated by space
 | 
			
		||||
  hashruler_min_length = 10
 | 
			
		||||
 | 
			
		||||
  # If true, then insert a space between the first hash char and remaining hash
 | 
			
		||||
  # chars in a hash ruler, and normalize its length to fill the column
 | 
			
		||||
  canonicalize_hashrulers = True
 | 
			
		||||
 | 
			
		||||
  # enable comment markup parsing and reflow
 | 
			
		||||
  enable_markup = False
 | 
			
		||||
 | 
			
		||||
# ----------------------------
 | 
			
		||||
# Options affecting the linter
 | 
			
		||||
# ----------------------------
 | 
			
		||||
with section("lint"):
 | 
			
		||||
 | 
			
		||||
  # a list of lint codes to disable
 | 
			
		||||
  disabled_codes = ['C0113']
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid function names
 | 
			
		||||
  function_pattern = '[0-9a-z_]+'
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid macro names
 | 
			
		||||
  macro_pattern = '[0-9A-Z_]+'
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid names for variables with global
 | 
			
		||||
  # scope
 | 
			
		||||
  global_var_pattern = '[0-9A-Z][0-9A-Z_]+'
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid names for variables with global
 | 
			
		||||
  # scope (but internal semantic)
 | 
			
		||||
  internal_var_pattern = '_[0-9A-Z][0-9A-Z_]+'
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid names for variables with local
 | 
			
		||||
  # scope
 | 
			
		||||
  local_var_pattern = '[0-9a-z_]+'
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid names for privatedirectory
 | 
			
		||||
  # variables
 | 
			
		||||
  private_var_pattern = '_[0-9a-z_]+'
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid names for publicdirectory
 | 
			
		||||
  # variables
 | 
			
		||||
  public_var_pattern = '[0-9A-Z][0-9A-Z_]+'
 | 
			
		||||
 | 
			
		||||
  # regular expression pattern describing valid names for keywords used in
 | 
			
		||||
  # functions or macros
 | 
			
		||||
  keyword_pattern = '[0-9A-Z_]+'
 | 
			
		||||
 | 
			
		||||
  # In the heuristic for C0201, how many conditionals to match within a loop in
 | 
			
		||||
  # before considering the loop a parser.
 | 
			
		||||
  max_conditionals_custom_parser = 2
 | 
			
		||||
 | 
			
		||||
  # Require at least this many newlines between statements
 | 
			
		||||
  min_statement_spacing = 1
 | 
			
		||||
 | 
			
		||||
  # Require no more than this many newlines between statements
 | 
			
		||||
  max_statement_spacing = 2
 | 
			
		||||
  max_returns = 6
 | 
			
		||||
  max_branches = 12
 | 
			
		||||
  max_arguments = 5
 | 
			
		||||
  max_localvars = 15
 | 
			
		||||
  max_statements = 50
 | 
			
		||||
 | 
			
		||||
# -------------------------------
 | 
			
		||||
# Options affecting file encoding
 | 
			
		||||
# -------------------------------
 | 
			
		||||
with section("encode"):
 | 
			
		||||
 | 
			
		||||
  # If true, emit the unicode byte-order mark (BOM) at the start of the file
 | 
			
		||||
  emit_byteorder_mark = False
 | 
			
		||||
 | 
			
		||||
  # Specify the encoding of the input file. Defaults to utf-8
 | 
			
		||||
  input_encoding = 'utf-8'
 | 
			
		||||
 | 
			
		||||
  # Specify the encoding of the output file. Defaults to utf-8. Note that cmake
 | 
			
		||||
  # only claims to support utf-8 so be careful when using anything else
 | 
			
		||||
  output_encoding = 'utf-8'
 | 
			
		||||
 | 
			
		||||
# -------------------------------------
 | 
			
		||||
# Miscellaneous configurations options.
 | 
			
		||||
# -------------------------------------
 | 
			
		||||
with section("misc"):
 | 
			
		||||
 | 
			
		||||
  # A dictionary containing any per-command configuration overrides. Currently
 | 
			
		||||
  # only `command_case` is supported.
 | 
			
		||||
  per_command = {}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										45
									
								
								thirdparty/sanitizers/FindASan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								thirdparty/sanitizers/FindASan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault 2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2021 Markus Eggenbauer
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 | 
			
		||||
# associated documentation files (the "Software"), to deal in the Software without restriction,
 | 
			
		||||
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
 | 
			
		||||
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all copies or
 | 
			
		||||
# substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
 | 
			
		||||
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 | 
			
		||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 | 
			
		||||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
 | 
			
		||||
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
option(SANITIZE_ADDRESS "Enable AddressSanitizer for sanitized targets." Off)
 | 
			
		||||
 | 
			
		||||
set(FLAG_CANDIDATES
 | 
			
		||||
    # Clang 3.2+ use this version. The no-omit-frame-pointer option is optional.
 | 
			
		||||
    "-g -fsanitize=address -fno-omit-frame-pointer" "-g -fsanitize=address"
 | 
			
		||||
    # Older deprecated flag for ASan
 | 
			
		||||
    "-g -faddress-sanitizer")
 | 
			
		||||
 | 
			
		||||
include(sanitize-helpers)
 | 
			
		||||
 | 
			
		||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "AddressSanitizer" "ASan")
 | 
			
		||||
 | 
			
		||||
find_program(ASan_WRAPPER "asan-wrapper" PATHS ${CMAKE_MODULE_PATH})
 | 
			
		||||
mark_as_advanced(ASan_WRAPPER)
 | 
			
		||||
 | 
			
		||||
function(add_sanitize_address TARGET)
 | 
			
		||||
    # TODO: check conditions for target:
 | 
			
		||||
    # if (SANITIZE_ADDRESS AND (SANITIZE_THREAD OR SANITIZE_MEMORY))
 | 
			
		||||
    #   message(FATAL_ERROR "AddressSanitizer is not compatible with ThreadSanitizer or MemorySanitizer.")
 | 
			
		||||
    # endif ()
 | 
			
		||||
 | 
			
		||||
    sanitizer_check_target(${TARGET})
 | 
			
		||||
    sanitizer_add_flags(${TARGET} "AddressSanitizer" "ASan")
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										42
									
								
								thirdparty/sanitizers/FindCFI.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								thirdparty/sanitizers/FindCFI.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault 2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2021 Markus Eggenbauer
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 | 
			
		||||
# associated documentation files (the "Software"), to deal in the Software without restriction,
 | 
			
		||||
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
 | 
			
		||||
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all copies or
 | 
			
		||||
# substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
 | 
			
		||||
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 | 
			
		||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 | 
			
		||||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
 | 
			
		||||
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
option(SANITIZE_CFI "Enable Control Flow Integrity (CFI) for sanitized targets." OFF)
 | 
			
		||||
 | 
			
		||||
set(FLAG_CANDIDATES
 | 
			
		||||
    # FIXME: Brief comment on why the additional flags
 | 
			
		||||
    # In this case you need a
 | 
			
		||||
    # linker that does optimization at
 | 
			
		||||
    # linking time such as LLVM lld or GNU gold.
 | 
			
		||||
    "-g -fsanitize=cfi -fvisibility=hidden -flto -fuse-ld=lld")
 | 
			
		||||
 | 
			
		||||
# There might be some conflict with the other sanitizer
 | 
			
		||||
# hence it might need an if statement here.
 | 
			
		||||
 | 
			
		||||
# add some handy functions
 | 
			
		||||
include(sanitize-helpers)
 | 
			
		||||
 | 
			
		||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "ControlFlowIntegrity" "CFI")
 | 
			
		||||
 | 
			
		||||
function(add_sanitize_cfi TARGET)
 | 
			
		||||
    sanitizer_check_target(${TARGET})
 | 
			
		||||
    sanitizer_add_flags(${TARGET} "ControlFlowIntegrity" "CFI")
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										37
									
								
								thirdparty/sanitizers/FindLeakSan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								thirdparty/sanitizers/FindLeakSan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault
 | 
			
		||||
#   2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2019 Barcelona Supercomputing Center
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
# in the Software without restriction, including without limitation the rights
 | 
			
		||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
# copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
# copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
# SOFTWARE.
 | 
			
		||||
 | 
			
		||||
option(SANITIZE_LEAK "Enable LeakSanitizer for sanitized targets." Off)
 | 
			
		||||
 | 
			
		||||
set(FLAG_CANDIDATES "-g -fsanitize=leak")
 | 
			
		||||
 | 
			
		||||
include(sanitize-helpers)
 | 
			
		||||
 | 
			
		||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "LeakSanitizer" "LeakSan")
 | 
			
		||||
 | 
			
		||||
function(add_sanitize_leak TARGET)
 | 
			
		||||
    sanitizer_check_target(${TARGET})
 | 
			
		||||
    sanitizer_add_flags(${TARGET} "LeakSanitizer" "LeakSan")
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										49
									
								
								thirdparty/sanitizers/FindMSan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								thirdparty/sanitizers/FindMSan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault
 | 
			
		||||
#   2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2021 Markus Eggenbauer
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
# in the Software without restriction, including without limitation the rights
 | 
			
		||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
# copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
# copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
# SOFTWARE.
 | 
			
		||||
 | 
			
		||||
option(SANITIZE_MEMORY "Enable MemorySanitizer for sanitized targets." Off)
 | 
			
		||||
 | 
			
		||||
set(FLAG_CANDIDATES "-g -fsanitize=memory")
 | 
			
		||||
 | 
			
		||||
include(sanitize-helpers)
 | 
			
		||||
 | 
			
		||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
 | 
			
		||||
    message(NOTICE "MemorySanitizer disabled for target ${TARGET} because "
 | 
			
		||||
            "MemorySanitizer is supported for Linux systems only.")
 | 
			
		||||
elseif(NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
 | 
			
		||||
    message(NOTICE "MemorySanitizer disabled for target ${TARGET} because "
 | 
			
		||||
            "MemorySanitizer is supported for 64bit systems only.")
 | 
			
		||||
else()
 | 
			
		||||
    sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer" "MSan")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
function(add_sanitize_memory TARGET)
 | 
			
		||||
    # TODO: check conditions for target:
 | 
			
		||||
    # if (SANITIZE_MEMORY AND (SANITIZE_THREAD OR SANITIZE_ADDRESS))
 | 
			
		||||
    #   message(FATAL_ERROR "AddressSanitizer is not compatible with ThreadSanitizer or MemorySanitizer.")
 | 
			
		||||
    # endif ()
 | 
			
		||||
    sanitizer_check_target(${TARGET})
 | 
			
		||||
    sanitizer_add_flags(${TARGET} "MemorySanitizer" "MSan")
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										37
									
								
								thirdparty/sanitizers/FindSS.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								thirdparty/sanitizers/FindSS.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault 2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2021 Markus Eggenbauer
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 | 
			
		||||
# associated documentation files (the "Software"), to deal in the Software without restriction,
 | 
			
		||||
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
 | 
			
		||||
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all copies or
 | 
			
		||||
# substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
 | 
			
		||||
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 | 
			
		||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 | 
			
		||||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
 | 
			
		||||
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
option(SANITIZE_SS "Enable SafeStack for sanitized targets." OFF)
 | 
			
		||||
 | 
			
		||||
set(FLAG_CANDIDATES "-g -fsanitize=safe-stack")
 | 
			
		||||
 | 
			
		||||
# There might be some conflict with the other sanitizer
 | 
			
		||||
# hence it might need an if statement here.
 | 
			
		||||
 | 
			
		||||
# add some handy functions
 | 
			
		||||
include(sanitize-helpers)
 | 
			
		||||
 | 
			
		||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "SafeStack" "SS")
 | 
			
		||||
 | 
			
		||||
function(add_sanitize_ss TARGET)
 | 
			
		||||
    sanitizer_check_target(${TARGET})
 | 
			
		||||
    sanitizer_add_flags(${TARGET} "SafeStack" "SS")
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										109
									
								
								thirdparty/sanitizers/FindSanitizers.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								thirdparty/sanitizers/FindSanitizers.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,109 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault
 | 
			
		||||
#   2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2021 Markus Eggenbauer
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
# in the Software without restriction, including without limitation the rights
 | 
			
		||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
# copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
# copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
# SOFTWARE.
 | 
			
		||||
 | 
			
		||||
# If any of the used compiler is a GNU compiler, add a second option to static
 | 
			
		||||
# link against the sanitizers.
 | 
			
		||||
option(SANITIZE_LINK_STATIC "Try to link static against sanitizers." Off)
 | 
			
		||||
 | 
			
		||||
set(FIND_QUIETLY_FLAG "")
 | 
			
		||||
if(DEFINED Sanitizers_FIND_QUIETLY)
 | 
			
		||||
    set(FIND_QUIETLY_FLAG "QUIET")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
find_package(ASan ${FIND_QUIETLY_FLAG})
 | 
			
		||||
find_package(TSan ${FIND_QUIETLY_FLAG})
 | 
			
		||||
find_package(MSan ${FIND_QUIETLY_FLAG})
 | 
			
		||||
find_package(UBSan ${FIND_QUIETLY_FLAG})
 | 
			
		||||
find_package(LeakSan ${FIND_QUIETLY_FLAG})
 | 
			
		||||
find_package(CFI ${FIND_QUIETLY_FLAG})
 | 
			
		||||
find_package(SS ${FIND_QUIETLY_FLAG})
 | 
			
		||||
 | 
			
		||||
function(sanitizer_add_blacklist_file FILE)
 | 
			
		||||
    if(NOT IS_ABSOLUTE ${FILE})
 | 
			
		||||
        set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
 | 
			
		||||
    endif()
 | 
			
		||||
    get_filename_component(FILE "${FILE}" REALPATH)
 | 
			
		||||
 | 
			
		||||
    sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}" "SanitizerBlacklist" "SanBlist")
 | 
			
		||||
endfunction()
 | 
			
		||||
 | 
			
		||||
function(add_sanitizers ...)
 | 
			
		||||
    # If no sanitizer is enabled, return immediately.
 | 
			
		||||
    if(NOT
 | 
			
		||||
       (SANITIZE_ADDRESS
 | 
			
		||||
        OR SANITIZE_MEMORY
 | 
			
		||||
        OR SANITIZE_THREAD
 | 
			
		||||
        OR SANITIZE_UNDEFINED
 | 
			
		||||
        OR SANITIZE_LEAK
 | 
			
		||||
        OR SANITIZE_CFI
 | 
			
		||||
        OR SANITIZE_SS))
 | 
			
		||||
        message(STATUS "No sanitizer selected.")
 | 
			
		||||
        return()
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    if(SANITIZE_ADDRESS AND SANITIZE_THREAD)
 | 
			
		||||
        message(
 | 
			
		||||
            FATAL_ERROR
 | 
			
		||||
                "Incompatible Sanitizer combination enabled: AddressSanitizer, ThreadSanitizer")
 | 
			
		||||
    endif()
 | 
			
		||||
    if(SANITIZE_ADDRESS AND SANITIZE_MEMORY)
 | 
			
		||||
        message(
 | 
			
		||||
            FATAL_ERROR
 | 
			
		||||
                "Incompatible Sanitizer combination enabled: AddressSanitizer, MemorySanitizer")
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    if(SANITIZE_MEMORY AND SANITIZE_THREAD)
 | 
			
		||||
        message(
 | 
			
		||||
            FATAL_ERROR
 | 
			
		||||
                "Incompatible Sanitizer combination enabled: MemorySanitizer, ThreadSanitizer")
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    foreach(TARGET ${ARGV})
 | 
			
		||||
        sanitizer_check_target(${TARGET})
 | 
			
		||||
 | 
			
		||||
        # Add sanitizers for target.
 | 
			
		||||
        if(SANITIZE_ADDRESS)
 | 
			
		||||
            add_sanitize_address(${TARGET})
 | 
			
		||||
        endif()
 | 
			
		||||
        if(SANITIZE_THREAD)
 | 
			
		||||
            add_sanitize_thread(${TARGET})
 | 
			
		||||
        endif()
 | 
			
		||||
        if(SANITIZE_MEMORY)
 | 
			
		||||
            add_sanitize_memory(${TARGET})
 | 
			
		||||
        endif()
 | 
			
		||||
        if(SANITIZE_UNDEFINED)
 | 
			
		||||
            add_sanitize_undefined(${TARGET})
 | 
			
		||||
        endif()
 | 
			
		||||
        if(SANITIZE_LEAK)
 | 
			
		||||
            add_sanitize_leak(${TARGET})
 | 
			
		||||
        endif()
 | 
			
		||||
        if(SANITIZE_CFI)
 | 
			
		||||
            add_sanitize_cfi(${TARGET})
 | 
			
		||||
        endif()
 | 
			
		||||
        if(SANITIZE_SS)
 | 
			
		||||
            add_sanitize_ss(${TARGET})
 | 
			
		||||
        endif()
 | 
			
		||||
    endforeach()
 | 
			
		||||
endfunction(add_sanitizers)
 | 
			
		||||
							
								
								
									
										53
									
								
								thirdparty/sanitizers/FindTSan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								thirdparty/sanitizers/FindTSan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault
 | 
			
		||||
#   2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2021 Markus Eggenbauer
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
# in the Software without restriction, including without limitation the rights
 | 
			
		||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
# copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
# copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
# SOFTWARE.
 | 
			
		||||
 | 
			
		||||
option(SANITIZE_THREAD "Enable ThreadSanitizer for sanitized targets." Off)
 | 
			
		||||
 | 
			
		||||
set(FLAG_CANDIDATES "-g -fsanitize=thread")
 | 
			
		||||
 | 
			
		||||
include(sanitize-helpers)
 | 
			
		||||
 | 
			
		||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
 | 
			
		||||
    message(NOTICE "ThreadSanitizer disabled for target ${TARGET} because "
 | 
			
		||||
            "ThreadSanitizer is supported for Linux systems and macOS only.")
 | 
			
		||||
    set(SANITIZE_THREAD Off CACHE BOOL "Enable ThreadSanitizer for sanitized targets." FORCE)
 | 
			
		||||
elseif(NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
 | 
			
		||||
    message(NOTICE "ThreadSanitizer disabled for target ${TARGET} because "
 | 
			
		||||
            "ThreadSanitizer is supported for 64bit systems only.")
 | 
			
		||||
    set(SANITIZE_THREAD Off CACHE BOOL "Enable ThreadSanitizer for sanitized targets." FORCE)
 | 
			
		||||
else()
 | 
			
		||||
    sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "ThreadSanitizer" "TSan")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
function(add_sanitize_thread TARGET)
 | 
			
		||||
    # ThreadSanitizer is not compatible with MemorySanitizer.
 | 
			
		||||
    #
 | 
			
		||||
    # if(SANITIZE_THREAD AND SANITIZE_MEMORY)
 | 
			
		||||
    #     message(FATAL_ERROR "ThreadSanitizer is not compatible with " "MemorySanitizer.")
 | 
			
		||||
    # endif()
 | 
			
		||||
 | 
			
		||||
    sanitizer_check_target(${TARGET})
 | 
			
		||||
    sanitizer_add_flags(${TARGET} "ThreadSanitizer" "TSan")
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										37
									
								
								thirdparty/sanitizers/FindUBSan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								thirdparty/sanitizers/FindUBSan.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault
 | 
			
		||||
#   2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2021 Markus Eggenbauer
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
# in the Software without restriction, including without limitation the rights
 | 
			
		||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
# copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
# copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
# SOFTWARE.
 | 
			
		||||
 | 
			
		||||
option(SANITIZE_UNDEFINED "Enable UndefinedBehaviorSanitizer for sanitized targets." Off)
 | 
			
		||||
 | 
			
		||||
set(FLAG_CANDIDATES "-g -fsanitize=undefined")
 | 
			
		||||
 | 
			
		||||
include(sanitize-helpers)
 | 
			
		||||
 | 
			
		||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "UndefinedBehaviorSanitizer" "UBSan")
 | 
			
		||||
 | 
			
		||||
function(add_sanitize_undefined TARGET)
 | 
			
		||||
    sanitizer_check_target(${TARGET})
 | 
			
		||||
    sanitizer_add_flags(${TARGET} "UndefinedBehaviorSanitizer" "UBSan")
 | 
			
		||||
endfunction()
 | 
			
		||||
							
								
								
									
										55
									
								
								thirdparty/sanitizers/asan-wrapper
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										55
									
								
								thirdparty/sanitizers/asan-wrapper
									
									
									
									
										vendored
									
									
										Executable file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault
 | 
			
		||||
#   2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
# in the Software without restriction, including without limitation the rights
 | 
			
		||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
# copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
# copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
# SOFTWARE.
 | 
			
		||||
 | 
			
		||||
# This script is a wrapper for AddressSanitizer. In some special cases you need
 | 
			
		||||
# to preload AddressSanitizer to avoid error messages - e.g. if you're
 | 
			
		||||
# preloading another library to your application. At the moment this script will
 | 
			
		||||
# only do something, if we're running on a Linux platform. OSX might not be
 | 
			
		||||
# affected.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Exit immediately, if platform is not Linux.
 | 
			
		||||
if [ "$(uname)" != "Linux" ]
 | 
			
		||||
then
 | 
			
		||||
    exec $@
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Get the used libasan of the application ($1). If a libasan was found, it will
 | 
			
		||||
# be prepended to LD_PRELOAD.
 | 
			
		||||
libasan=$(ldd $1 | grep libasan | sed "s/^[[:space:]]//" | cut -d' ' -f1)
 | 
			
		||||
if [ -n "$libasan" ]
 | 
			
		||||
then
 | 
			
		||||
    if [ -n "$LD_PRELOAD" ]
 | 
			
		||||
    then
 | 
			
		||||
        export LD_PRELOAD="$libasan:$LD_PRELOAD"
 | 
			
		||||
    else
 | 
			
		||||
        export LD_PRELOAD="$libasan"
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Execute the application.
 | 
			
		||||
exec $@
 | 
			
		||||
							
								
								
									
										199
									
								
								thirdparty/sanitizers/sanitize-helpers.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										199
									
								
								thirdparty/sanitizers/sanitize-helpers.cmake
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,199 @@
 | 
			
		||||
# The MIT License (MIT)
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)
 | 
			
		||||
#   2013 Matthew Arsenault
 | 
			
		||||
#   2015-2016 RWTH Aachen University, Federal Republic of Germany
 | 
			
		||||
#   2021 Markus Eggenbauer
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
# in the Software without restriction, including without limitation the rights
 | 
			
		||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
# copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
# copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
# SOFTWARE.
 | 
			
		||||
 | 
			
		||||
# Helper function to get the language of a source file.
 | 
			
		||||
function(sanitizer_lang_of_source FILE RETURN_VAR)
 | 
			
		||||
    get_filename_component(LONGEST_EXT "${FILE}" EXT)
 | 
			
		||||
    # If extension is empty return. This can happen for extensionless headers
 | 
			
		||||
    if("${LONGEST_EXT}" STREQUAL "")
 | 
			
		||||
        set(${RETURN_VAR} "" PARENT_SCOPE)
 | 
			
		||||
        return()
 | 
			
		||||
    endif()
 | 
			
		||||
    # Get shortest extension as some files can have dot in their names
 | 
			
		||||
    string(REGEX REPLACE "^.*(\\.[^.]+)$" "\\1" FILE_EXT ${LONGEST_EXT})
 | 
			
		||||
    string(TOLOWER "${FILE_EXT}" FILE_EXT)
 | 
			
		||||
    string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
 | 
			
		||||
 | 
			
		||||
    get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
 | 
			
		||||
    foreach(LANG ${ENABLED_LANGUAGES})
 | 
			
		||||
        list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
 | 
			
		||||
        if(NOT ${TEMP} EQUAL -1)
 | 
			
		||||
            set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
 | 
			
		||||
            return()
 | 
			
		||||
        endif()
 | 
			
		||||
    endforeach()
 | 
			
		||||
 | 
			
		||||
    set(${RETURN_VAR} "" PARENT_SCOPE)
 | 
			
		||||
endfunction()
 | 
			
		||||
 | 
			
		||||
# Helper function to get compilers used by a target.
 | 
			
		||||
function(sanitizer_target_compilers TARGET RETURN_VAR)
 | 
			
		||||
    # Check if all sources for target use the same compiler. If a target uses
 | 
			
		||||
    # e.g. C and Fortran mixed and uses different compilers (e.g. clang and
 | 
			
		||||
    # gfortran) this can trigger huge problems, because different compilers may
 | 
			
		||||
    # use different implementations for sanitizers.
 | 
			
		||||
    set(BUFFER "")
 | 
			
		||||
    get_target_property(TSOURCES ${TARGET} SOURCES)
 | 
			
		||||
    foreach(FILE ${TSOURCES})
 | 
			
		||||
        # If expression was found, FILE is a generator-expression for an object
 | 
			
		||||
        # library. Object libraries will be ignored.
 | 
			
		||||
        string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
 | 
			
		||||
        if("${_file}" STREQUAL "")
 | 
			
		||||
            sanitizer_lang_of_source(${FILE} LANG)
 | 
			
		||||
            if(LANG)
 | 
			
		||||
                list(APPEND BUFFER ${CMAKE_${LANG}_COMPILER_ID})
 | 
			
		||||
            endif()
 | 
			
		||||
        endif()
 | 
			
		||||
    endforeach()
 | 
			
		||||
 | 
			
		||||
    list(REMOVE_DUPLICATES BUFFER)
 | 
			
		||||
    set(${RETURN_VAR} "${BUFFER}" PARENT_SCOPE)
 | 
			
		||||
endfunction()
 | 
			
		||||
 | 
			
		||||
# Helper function to check compiler flags for language compiler.
 | 
			
		||||
function(sanitizer_check_compiler_flag FLAG LANG VARIABLE)
 | 
			
		||||
    if(${LANG} STREQUAL "C")
 | 
			
		||||
        include(CheckCCompilerFlag)
 | 
			
		||||
        check_c_compiler_flag("${FLAG}" ${VARIABLE})
 | 
			
		||||
 | 
			
		||||
    elseif(${LANG} STREQUAL "CXX")
 | 
			
		||||
        include(CheckCXXCompilerFlag)
 | 
			
		||||
        check_cxx_compiler_flag("${FLAG}" ${VARIABLE})
 | 
			
		||||
 | 
			
		||||
    elseif(${LANG} STREQUAL "Fortran")
 | 
			
		||||
        # CheckFortranCompilerFlag was introduced in CMake 3.x. To be compatible
 | 
			
		||||
        # with older Cmake versions, we will check if this module is present
 | 
			
		||||
        # before we use it. Otherwise we will define Fortran coverage support as
 | 
			
		||||
        # not available.
 | 
			
		||||
        include(CheckFortranCompilerFlag OPTIONAL RESULT_VARIABLE INCLUDED)
 | 
			
		||||
        if(INCLUDED)
 | 
			
		||||
            CHECK_Fortran_COMPILER_FLAG("${FLAG}" ${VARIABLE})
 | 
			
		||||
        elseif(NOT CMAKE_REQUIRED_QUIET)
 | 
			
		||||
            message(STATUS "Performing Test ${VARIABLE}")
 | 
			
		||||
            message(STATUS "Performing Test ${VARIABLE}" " - Failed (Check not supported)")
 | 
			
		||||
        endif()
 | 
			
		||||
    endif()
 | 
			
		||||
endfunction()
 | 
			
		||||
 | 
			
		||||
# Helper function to test compiler flags.
 | 
			
		||||
function(sanitizer_check_compiler_flags FLAG_CANDIDATES NAME PREFIX)
 | 
			
		||||
    set(CMAKE_REQUIRED_QUIET ${${PREFIX}_FIND_QUIETLY})
 | 
			
		||||
 | 
			
		||||
    get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
 | 
			
		||||
    foreach(LANG ${ENABLED_LANGUAGES})
 | 
			
		||||
        # Sanitizer flags are not dependend on language, but the used compiler.
 | 
			
		||||
        # So instead of searching flags foreach language, search flags foreach
 | 
			
		||||
        # compiler used.
 | 
			
		||||
        set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
 | 
			
		||||
        if(NOT DEFINED ${PREFIX}_${COMPILER}_FLAGS)
 | 
			
		||||
            foreach(FLAG ${FLAG_CANDIDATES})
 | 
			
		||||
                if(NOT CMAKE_REQUIRED_QUIET)
 | 
			
		||||
                    message(STATUS "Try ${COMPILER} ${NAME} flag = [${FLAG}]")
 | 
			
		||||
                endif()
 | 
			
		||||
 | 
			
		||||
                set(CMAKE_REQUIRED_FLAGS "${FLAG}")
 | 
			
		||||
                unset(${PREFIX}_FLAG_DETECTED CACHE)
 | 
			
		||||
                sanitizer_check_compiler_flag("${FLAG}" ${LANG} ${PREFIX}_FLAG_DETECTED)
 | 
			
		||||
 | 
			
		||||
                if(${PREFIX}_FLAG_DETECTED)
 | 
			
		||||
                    # If compiler is a GNU compiler, search for static flag, if
 | 
			
		||||
                    # SANITIZE_LINK_STATIC is enabled.
 | 
			
		||||
                    if(SANITIZE_LINK_STATIC AND (COMPILER STREQUAL "GNU"))
 | 
			
		||||
                        string(TOLOWER ${PREFIX} PREFIX_lower)
 | 
			
		||||
                        sanitizer_check_compiler_flag("-static-lib${PREFIX_lower}" ${LANG}
 | 
			
		||||
                                                      ${PREFIX}_STATIC_FLAG_DETECTED)
 | 
			
		||||
 | 
			
		||||
                        if(${PREFIX}_STATIC_FLAG_DETECTED)
 | 
			
		||||
                            set(FLAG "-static-lib${PREFIX_lower} ${FLAG}")
 | 
			
		||||
                        endif()
 | 
			
		||||
                    endif()
 | 
			
		||||
 | 
			
		||||
                    set(${PREFIX}_${COMPILER}_FLAGS "${FLAG}"
 | 
			
		||||
                        CACHE STRING "${NAME} flags for ${COMPILER} compiler.")
 | 
			
		||||
                    mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
 | 
			
		||||
                    break()
 | 
			
		||||
                endif()
 | 
			
		||||
            endforeach()
 | 
			
		||||
 | 
			
		||||
            if(NOT ${PREFIX}_FLAG_DETECTED)
 | 
			
		||||
                set(${PREFIX}_${COMPILER}_FLAGS "" CACHE STRING
 | 
			
		||||
                                                         "${NAME} flags for ${COMPILER} compiler.")
 | 
			
		||||
                mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
 | 
			
		||||
 | 
			
		||||
                message(
 | 
			
		||||
                    NOTICE "${NAME} is not available for ${COMPILER} "
 | 
			
		||||
                    "compiler. Targets using this compiler will be " "compiled without ${NAME}.")
 | 
			
		||||
            endif()
 | 
			
		||||
        endif()
 | 
			
		||||
    endforeach()
 | 
			
		||||
endfunction()
 | 
			
		||||
 | 
			
		||||
# Helper to assign sanitizer flags for TARGET.
 | 
			
		||||
function(sanitizer_add_flags TARGET NAME PREFIX)
 | 
			
		||||
    # Get list of compilers used by target and check, if sanitizer is available
 | 
			
		||||
    # for this target. Other compiler checks like check for conflicting
 | 
			
		||||
    # compilers will be done in add_sanitizers function.
 | 
			
		||||
    sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
 | 
			
		||||
    list(LENGTH TARGET_COMPILER NUM_COMPILERS)
 | 
			
		||||
    if("${${PREFIX}_${TARGET_COMPILER}_FLAGS}" STREQUAL "")
 | 
			
		||||
        return()
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    # Set compile- and link-flags for target.
 | 
			
		||||
    set_property(TARGET ${TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS
 | 
			
		||||
                                                         " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
 | 
			
		||||
    set_property(TARGET ${TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS
 | 
			
		||||
                                                         " ${SanBlist_${TARGET_COMPILER}_FLAGS}")
 | 
			
		||||
    set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS
 | 
			
		||||
                                                         " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
 | 
			
		||||
endfunction()
 | 
			
		||||
 | 
			
		||||
macro(sanitizer_check_target TARGET)
 | 
			
		||||
    # Check if this target will be compiled by exactly one compiler. Other-
 | 
			
		||||
    # wise sanitizers can't be used and a warning should be printed once.
 | 
			
		||||
    get_target_property(TARGET_TYPE ${TARGET} TYPE)
 | 
			
		||||
    if(TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
 | 
			
		||||
        message(NOTICE "Can't use any sanitizers for target ${TARGET}, "
 | 
			
		||||
                "because it is an interface library and cannot be " "compiled directly.")
 | 
			
		||||
        return()
 | 
			
		||||
    endif()
 | 
			
		||||
    sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
 | 
			
		||||
    list(LENGTH TARGET_COMPILER NUM_COMPILERS)
 | 
			
		||||
    if(NUM_COMPILERS GREATER 1)
 | 
			
		||||
        message(
 | 
			
		||||
            NOTICE "Can't use any sanitizers for target ${TARGET}, "
 | 
			
		||||
            "because it will be compiled by incompatible compilers. "
 | 
			
		||||
            "Target will be compiled without sanitizers.")
 | 
			
		||||
        return()
 | 
			
		||||
 | 
			
		||||
        # If the target is compiled by no or no known compiler, give a warning.
 | 
			
		||||
    elseif(NUM_COMPILERS EQUAL 0)
 | 
			
		||||
        message(
 | 
			
		||||
            NOTICE "Sanitizers for target ${TARGET} may not be"
 | 
			
		||||
            " usable, because it uses no or an unknown compiler. "
 | 
			
		||||
            "This is a false warning for targets using only " "object lib(s) as input.")
 | 
			
		||||
        return()
 | 
			
		||||
    endif()
 | 
			
		||||
endmacro(sanitizer_check_target)
 | 
			
		||||
		Reference in New Issue
	
	Block a user