Compare commits
12 Commits
9719383c86
...
c9c13df552
Author | SHA1 | Date | |
---|---|---|---|
c9c13df552 | |||
47581bd7b7 | |||
54cf15c7e0 | |||
16665a5a6f | |||
873e29592c | |||
7c62d755b9 | |||
0eb74fc971 | |||
4964b3a6f2 | |||
9d1ca3886b | |||
925c34b886 | |||
2d990c1747 | |||
0c02885f2c |
236
.cmake-format
236
.cmake-format
@@ -1,15 +1,59 @@
|
|||||||
|
# ----------------------------------
|
||||||
|
# Options affecting listfile parsing
|
||||||
|
# ----------------------------------
|
||||||
|
with section("parse"):
|
||||||
|
|
||||||
|
# Specify structure for custom cmake functions
|
||||||
|
additional_commands = {
|
||||||
|
'add_common_library': { 'flags': [],
|
||||||
|
'kwargs': { 'OUTPUT_NAME': '*',
|
||||||
|
'SOURCES': '*',
|
||||||
|
'TARGET': '*'}},
|
||||||
|
'foo': { 'flags': ['BAR', 'BAZ'],
|
||||||
|
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}},
|
||||||
|
'pvs_studio_add_target': { 'flags': [ 'COMPILE_COMMANDS',
|
||||||
|
'OUTPUT',
|
||||||
|
'HIDE_HELP'],
|
||||||
|
'kwargs': { 'ARGS': '*',
|
||||||
|
'CONFIG': '*',
|
||||||
|
'DEPENDS': '*',
|
||||||
|
'FORMAT': '*',
|
||||||
|
'MODE': '*',
|
||||||
|
'TARGET': '*'}},
|
||||||
|
'write_compiler_detection_header': { 'flags': [],
|
||||||
|
'kwargs': { 'COMPILERS': '*',
|
||||||
|
'FEATURES': '*',
|
||||||
|
'FILE': '*',
|
||||||
|
'PREFIX': '*'}}}
|
||||||
|
|
||||||
|
# Specify variable tags.
|
||||||
|
vartags = []
|
||||||
|
|
||||||
|
# Specify property tags.
|
||||||
|
proptags = []
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Options affecting formatting.
|
||||||
|
# -----------------------------
|
||||||
|
with section("format"):
|
||||||
|
|
||||||
# --------------------------
|
|
||||||
# General Formatting Options
|
|
||||||
# --------------------------
|
|
||||||
# How wide to allow formatted cmake files
|
# How wide to allow formatted cmake files
|
||||||
line_width = 100
|
line_width = 110
|
||||||
|
|
||||||
# How many spaces to tab for indent
|
# How many spaces to tab for indent
|
||||||
tab_size = 2
|
tab_size = 2
|
||||||
|
|
||||||
# If arglists are longer than this, break them always
|
# If an argument group contains more than this many sub-groups (parg or kwarg
|
||||||
max_subargs_per_line = 3
|
# groups) then force it to a vertical layout.
|
||||||
|
max_subgroups_hwrap = 2
|
||||||
|
|
||||||
|
# If a positional argument group contains more than this many arguments, then
|
||||||
|
# force it to a vertical layout.
|
||||||
|
max_pargs_hwrap = 6
|
||||||
|
|
||||||
|
# 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
|
# If true, separate flow control names from their parentheses with a space
|
||||||
separate_ctrl_name_with_space = False
|
separate_ctrl_name_with_space = False
|
||||||
@@ -18,16 +62,26 @@ separate_ctrl_name_with_space = False
|
|||||||
separate_fn_name_with_space = False
|
separate_fn_name_with_space = False
|
||||||
|
|
||||||
# If a statement is wrapped to more than one line, than dangle the closing
|
# If a statement is wrapped to more than one line, than dangle the closing
|
||||||
# parenthesis on it's own line
|
# parenthesis on its own line.
|
||||||
dangle_parens = False
|
dangle_parens = False
|
||||||
|
|
||||||
# If the statement spelling length (including space and parenthesis is larger
|
# If the trailing parenthesis must be 'dangled' on its on line, then align it
|
||||||
# than the tab width by more than this amoung, then force reject un-nested
|
# 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.
|
# layouts.
|
||||||
max_prefix_chars = 2
|
max_prefix_chars = 2
|
||||||
|
|
||||||
# If a candidate layout is wrapped horizontally but it exceeds this many lines,
|
# If a candidate layout is wrapped horizontally but it exceeds this many
|
||||||
# then reject the layout.
|
# lines, then reject the layout.
|
||||||
max_lines_hwrap = 2
|
max_lines_hwrap = 2
|
||||||
|
|
||||||
# What style line endings to use in the output.
|
# What style line endings to use in the output.
|
||||||
@@ -39,51 +93,9 @@ command_case = 'canonical'
|
|||||||
# Format keywords consistently as 'lower' or 'upper' case
|
# Format keywords consistently as 'lower' or 'upper' case
|
||||||
keyword_case = 'upper'
|
keyword_case = 'upper'
|
||||||
|
|
||||||
# Specify structure for custom cmake functions
|
|
||||||
additional_commands = {
|
|
||||||
"foo": {
|
|
||||||
"flags": [
|
|
||||||
"BAR",
|
|
||||||
"BAZ"
|
|
||||||
],
|
|
||||||
"kwargs": {
|
|
||||||
"HEADERS": "*",
|
|
||||||
"SOURCES": "*",
|
|
||||||
"DEPENDS": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pvs_studio_add_target" : {
|
|
||||||
"flags": [
|
|
||||||
"COMPILE_COMMANDS",
|
|
||||||
"OUTPUT",
|
|
||||||
"HIDE_HELP"
|
|
||||||
],
|
|
||||||
"kwargs": {
|
|
||||||
"TARGET": "*",
|
|
||||||
"DEPENDS": "*",
|
|
||||||
"FORMAT": "*",
|
|
||||||
"CONFIG": "*",
|
|
||||||
"ARGS": "*",
|
|
||||||
"MODE": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"write_compiler_detection_header" : {
|
|
||||||
"flags": [ ],
|
|
||||||
"kwargs": {
|
|
||||||
"FILE": "*",
|
|
||||||
"PREFIX": "*",
|
|
||||||
"COMPILERS": "*",
|
|
||||||
"FEATURES": "*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# A list of command names which should always be wrapped
|
# A list of command names which should always be wrapped
|
||||||
always_wrap = []
|
always_wrap = []
|
||||||
|
|
||||||
# Specify the order of wrapping algorithms during successive reflow attempts
|
|
||||||
algorithm_order = [0, 1, 2, 3, 4]
|
|
||||||
|
|
||||||
# If true, the argument lists which are known to be sortable will be sorted
|
# If true, the argument lists which are known to be sortable will be sorted
|
||||||
# lexicographicall
|
# lexicographicall
|
||||||
enable_sort = True
|
enable_sort = True
|
||||||
@@ -92,28 +104,27 @@ enable_sort = True
|
|||||||
# (without annotation).
|
# (without annotation).
|
||||||
autosort = False
|
autosort = False
|
||||||
|
|
||||||
# If a comment line starts with at least this many consecutive hash characters,
|
# By default, if cmake-format cannot successfully fit everything into the
|
||||||
# then don't lstrip() them off. This allows for lazy hash rulers where the first
|
# desired linewidth it will apply the last, most agressive attempt that it
|
||||||
# hash char is not separated by space
|
# made. If this flag is True, however, cmake-format will print error, exit
|
||||||
hashruler_min_length = 10
|
# with non-zero status code, and write-out nothing
|
||||||
|
require_valid_layout = False
|
||||||
|
|
||||||
# A dictionary containing any per-command configuration overrides. Currently
|
# A dictionary mapping layout nodes to a list of wrap decisions. See the
|
||||||
# only `command_case` is supported.
|
# documentation for more information.
|
||||||
per_command = {}
|
layout_passes = {}
|
||||||
|
|
||||||
|
# ------------------------------------------------
|
||||||
|
# Options affecting comment reflow and formatting.
|
||||||
|
# ------------------------------------------------
|
||||||
|
with section("markup"):
|
||||||
|
|
||||||
# --------------------------
|
|
||||||
# Comment Formatting Options
|
|
||||||
# --------------------------
|
|
||||||
# What character to use for bulleted lists
|
# What character to use for bulleted lists
|
||||||
bullet_char = '*'
|
bullet_char = '*'
|
||||||
|
|
||||||
# What character to use as punctuation after numerals in an enumerated list
|
# What character to use as punctuation after numerals in an enumerated list
|
||||||
enum_char = '.'
|
enum_char = '.'
|
||||||
|
|
||||||
# enable comment markup parsing and reflow
|
|
||||||
enable_markup = False
|
|
||||||
|
|
||||||
# If comment markup is enabled, don't reflow the first comment block in each
|
# If comment markup is enabled, don't reflow the first comment block in each
|
||||||
# listfile. Use this to preserve formatting of your copyright/license
|
# listfile. Use this to preserve formatting of your copyright/license
|
||||||
# statements.
|
# statements.
|
||||||
@@ -123,29 +134,104 @@ first_comment_is_literal = False
|
|||||||
# this (regex) pattern. Default is `None` (disabled).
|
# this (regex) pattern. Default is `None` (disabled).
|
||||||
literal_comment_pattern = None
|
literal_comment_pattern = None
|
||||||
|
|
||||||
# Regular expression to match preformat fences in comments
|
# Regular expression to match preformat fences in comments default=
|
||||||
# default=r'^\s*([`~]{3}[`~]*)(.*)$'
|
# ``r'^\s*([`~]{3}[`~]*)(.*)$'``
|
||||||
fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
|
fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
|
||||||
|
|
||||||
# Regular expression to match rulers in comments
|
# Regular expression to match rulers in comments default=
|
||||||
# default=r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'
|
# ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'``
|
||||||
ruler_pattern = '^\\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
|
# If true, then insert a space between the first hash char and remaining hash
|
||||||
# chars in a hash ruler, and normalize it's length to fill the column
|
# chars in a hash ruler, and normalize its length to fill the column
|
||||||
canonicalize_hashrulers = True
|
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 = []
|
||||||
|
|
||||||
|
# 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"):
|
||||||
|
|
||||||
# ---------------------------------
|
|
||||||
# Miscellaneous Options
|
|
||||||
# ---------------------------------
|
|
||||||
# If true, emit the unicode byte-order mark (BOM) at the start of the file
|
# If true, emit the unicode byte-order mark (BOM) at the start of the file
|
||||||
emit_byteorder_mark = False
|
emit_byteorder_mark = False
|
||||||
|
|
||||||
# Specify the encoding of the input file. Defaults to utf-8.
|
# Specify the encoding of the input file. Defaults to utf-8
|
||||||
input_encoding = 'utf-8'
|
input_encoding = 'utf-8'
|
||||||
|
|
||||||
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
|
# 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
|
# only claims to support utf-8 so be careful when using anything else
|
||||||
output_encoding = 'utf-8'
|
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 = {}
|
||||||
|
|
||||||
|
23
CMLibAuxilarySymlinks.cmake
Normal file
23
CMLibAuxilarySymlinks.cmake
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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/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/data
|
||||||
|
${CMAKE_BINARY_DIR}/files/data
|
||||||
|
# Ссылка на каталог настроек
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/etc
|
||||||
|
${CMAKE_BINARY_DIR}/etc)
|
||||||
|
endif()
|
||||||
|
endif()
|
@@ -50,16 +50,24 @@ elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|||||||
string(APPEND CMAKE_C_FLAGS_DEBUG " -ggdb")
|
string(APPEND CMAKE_C_FLAGS_DEBUG " -ggdb")
|
||||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -ggdb")
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -ggdb")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_VERBOSE_MAKEFILE 1)
|
set(CMAKE_VERBOSE_MAKEFILE
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
ON
|
||||||
|
CACHE BOOL "Enable verbose build file generation." FORCE)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS
|
||||||
|
ON
|
||||||
|
CACHE BOOL "Enable output of compile commands during generation." FORCE)
|
||||||
set(DEBUG 1)
|
set(DEBUG 1)
|
||||||
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
|
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||||
set(RELEASE 1)
|
set(RELEASE 1)
|
||||||
elseif(CMAKE_BUILD_TYPE STREQUAL None)
|
elseif(CMAKE_BUILD_TYPE STREQUAL None)
|
||||||
# Режим None используется для статического анализа кода
|
# Режим None используется для статического анализа кода
|
||||||
set(ANALYSIS 1)
|
set(ANALYSIS 1)
|
||||||
set(CMAKE_VERBOSE_MAKEFILE 1)
|
set(CMAKE_VERBOSE_MAKEFILE
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
ON
|
||||||
|
CACHE BOOL "Enable verbose build file generation." FORCE)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS
|
||||||
|
ON
|
||||||
|
CACHE BOOL "Enable output of compile commands during generation." FORCE)
|
||||||
# set(USE_CLANG_TIDY ON CACHE BOOL "Use clang-tidy")
|
# set(USE_CLANG_TIDY ON CACHE BOOL "Use clang-tidy")
|
||||||
# set(USE_CPPCHECK ON CACHE BOOL "Use cppcheck")
|
# set(USE_CPPCHECK ON CACHE BOOL "Use cppcheck")
|
||||||
set(USE_PVS_STUDIO
|
set(USE_PVS_STUDIO
|
||||||
|
@@ -1,13 +1,12 @@
|
|||||||
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
||||||
set(CPACK_SOURCE_GENERATOR TXZ)
|
set(CPACK_SOURCE_GENERATOR TXZ)
|
||||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}")
|
||||||
|
|
||||||
set(CPACK_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
set(CPACK_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
set(CPACK_TARGET_ARCH "amd64")
|
set(CPACK_TARGET_ARCH "amd64")
|
||||||
endif()
|
endif()
|
||||||
set(CPACK_PACKAGE_FILE_NAME
|
set(CPACK_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}")
|
||||||
"${CMAKE_PROJECT_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}")
|
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
|
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
find_program(CLANG_CHECK_EXE NAMES clang-check-10 clang-check-9 clang-check-8
|
find_program(CLANG_CHECK_EXE NAMES clang-check-10 clang-check-9 clang-check-8 clang-check-7 clang-check-6.0
|
||||||
clang-check-7 clang-check-6.0 clang-check)
|
clang-check)
|
||||||
if(CLANG_CHECK_EXE)
|
if(CLANG_CHECK_EXE)
|
||||||
option(CLANG_ANALYZE_FIX "Perform fixes for Clang-Check" OFF)
|
option(CLANG_ANALYZE_FIX "Perform fixes for Clang-Check" OFF)
|
||||||
endif()
|
endif()
|
||||||
@@ -19,8 +19,8 @@ function(add_clang_analyze_check)
|
|||||||
add_custom_target(
|
add_custom_target(
|
||||||
clang-analyze-check-${_target}
|
clang-analyze-check-${_target}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMAND ${CLANG_CHECK_EXE} -analyze -extra-arg="-Wno-unknown-warning-option" -p
|
COMMAND ${CLANG_CHECK_EXE} -analyze -extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_BINARY_DIR} ${_sources})
|
${_sources})
|
||||||
add_dependencies(clang-analyze-check-${_target} ${_target})
|
add_dependencies(clang-analyze-check-${_target} ${_target})
|
||||||
add_dependencies(clang-analyze-check clang-analyze-check-${_target})
|
add_dependencies(clang-analyze-check clang-analyze-check-${_target})
|
||||||
else()
|
else()
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
find_program(CLANG_TIDY_EXE NAMES clang-tidy-10 clang-tidy-9 clang-tidy-8 clang-tidy-7
|
find_program(CLANG_TIDY_EXE NAMES clang-tidy-10 clang-tidy-9 clang-tidy-8 clang-tidy-7 clang-tidy-6.0
|
||||||
clang-tidy-6.0 clang-tidy)
|
clang-tidy)
|
||||||
if(CLANG_TIDY_EXE)
|
if(CLANG_TIDY_EXE)
|
||||||
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
|
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
|
||||||
if(CLANG_TIDY_FIX)
|
if(CLANG_TIDY_FIX)
|
||||||
@@ -19,8 +19,7 @@ function(add_clang_tidy_check)
|
|||||||
add_custom_target(
|
add_custom_target(
|
||||||
clang-tidy-check-${_target}
|
clang-tidy-check-${_target}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMAND ${CLANG_TIDY_EXE} -extra-arg="-Wno-unknown-warning-option" -p
|
COMMAND ${CLANG_TIDY_EXE} -extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR} ${_sources})
|
||||||
${CMAKE_BINARY_DIR} ${_sources})
|
|
||||||
add_dependencies(clang-tidy-check-${_target} ${_target})
|
add_dependencies(clang-tidy-check-${_target} ${_target})
|
||||||
add_dependencies(clang-tidy-check clang-tidy-check-${_target})
|
add_dependencies(clang-tidy-check clang-tidy-check-${_target})
|
||||||
else()
|
else()
|
||||||
|
@@ -15,8 +15,8 @@ function(add_clazy_check)
|
|||||||
add_custom_target(
|
add_custom_target(
|
||||||
clazy-check-${_target}
|
clazy-check-${_target}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMAND ${CLAZY_EXE} -checks=level2,${clazy_checks}
|
COMMAND ${CLAZY_EXE} -checks=level2,${clazy_checks} -extra-arg="-Wno-unknown-warning-option" -p
|
||||||
-extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR} ${_sources})
|
${CMAKE_BINARY_DIR} ${_sources})
|
||||||
add_dependencies(clazy-check-${_target} ${_target})
|
add_dependencies(clazy-check-${_target} ${_target})
|
||||||
add_dependencies(clazy-check clazy-check-${_target})
|
add_dependencies(clazy-check clazy-check-${_target})
|
||||||
else()
|
else()
|
||||||
|
@@ -14,8 +14,7 @@ function(add_pvs_check)
|
|||||||
COMPILE_COMMANDS HIDE_HELP OUTPUT
|
COMPILE_COMMANDS HIDE_HELP OUTPUT
|
||||||
FORMAT errorfile
|
FORMAT errorfile
|
||||||
CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio-${_target}.cfg"
|
CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio-${_target}.cfg"
|
||||||
ARGS --analysis-mode 29 --exclude-path
|
ARGS --analysis-mode 29 --exclude-path ${CMAKE_CURRENT_BINARY_DIR}/${_target}_autogen
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${_target}_autogen
|
|
||||||
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
|
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
|
||||||
add_dependencies(pvs-check pvs-check-${_target})
|
add_dependencies(pvs-check pvs-check-${_target})
|
||||||
else()
|
else()
|
||||||
@@ -24,8 +23,6 @@ function(add_pvs_check)
|
|||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "CMLIB warning:")
|
message(STATUS "CMLIB warning:")
|
||||||
message(
|
message(STATUS " Option CMAKE_EXPORT_COMPILE_COMMANDS is not set. PVS checks will be disabled.")
|
||||||
STATUS
|
|
||||||
" Option CMAKE_EXPORT_COMPILE_COMMANDS is not set. PVS checks will be disabled.")
|
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -16,17 +16,15 @@ function(add_code_coverage)
|
|||||||
add_custom_target(
|
add_custom_target(
|
||||||
coverage-${_target}
|
coverage-${_target}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
COMMAND
|
COMMAND ${LCOV_EXE} --test-name ${_target} --output "${_target}.lcov" --capture --directory
|
||||||
${LCOV_EXE} --test-name ${_target} --output "${_target}.lcov" --capture
|
${CMAKE_BINARY_DIR})
|
||||||
--directory ${CMAKE_BINARY_DIR})
|
|
||||||
add_dependencies(coverage-${_target} ${_target})
|
add_dependencies(coverage-${_target} ${_target})
|
||||||
|
|
||||||
if(GENHTML_EXE)
|
if(GENHTML_EXE)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
coverage-report-${_target}
|
coverage-report-${_target}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
COMMAND ${GENHTML_EXE} --output-directory "report-${_target}"
|
COMMAND ${GENHTML_EXE} --output-directory "report-${_target}" "${_target}.lcov")
|
||||||
"${_target}.lcov")
|
|
||||||
add_dependencies(coverage-report-${_target} coverage-${_target})
|
add_dependencies(coverage-report-${_target} coverage-${_target})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@@ -19,6 +19,7 @@ include(CMLibProjectVersion)
|
|||||||
set_project_version()
|
set_project_version()
|
||||||
|
|
||||||
include(CMLibRequiredVariables)
|
include(CMLibRequiredVariables)
|
||||||
|
include(CMLibGlobalFunctions)
|
||||||
include(CMLibGlobalVariables)
|
include(CMLibGlobalVariables)
|
||||||
include(CMLibLSBInfo)
|
include(CMLibLSBInfo)
|
||||||
include(CMLibCompiler)
|
include(CMLibCompiler)
|
||||||
@@ -26,9 +27,9 @@ include(CMLibCompilerFlags)
|
|||||||
include(CMLibDistCC)
|
include(CMLibDistCC)
|
||||||
include(CMLibCompilerFeaturesHPPGenerate)
|
include(CMLibCompilerFeaturesHPPGenerate)
|
||||||
include(CMLibFlagRemove)
|
include(CMLibFlagRemove)
|
||||||
|
include(CMLibBuildTypes)
|
||||||
include(CMLibCommonTargetProperties)
|
include(CMLibCommonTargetProperties)
|
||||||
include(CMLibCommonLibraryTarget)
|
include(CMLibCommonLibraryTarget)
|
||||||
include(CMLibBuildTypes)
|
|
||||||
include(CMLibCodeAnalysisPvsStudio)
|
include(CMLibCodeAnalysisPvsStudio)
|
||||||
include(CMLibCodeAnalysisClangAnalyze)
|
include(CMLibCodeAnalysisClangAnalyze)
|
||||||
include(CMLibCodeAnalysisClangTidy)
|
include(CMLibCodeAnalysisClangTidy)
|
||||||
@@ -42,6 +43,7 @@ include(CMLibDocDoxygen)
|
|||||||
include(CMLibDocBreathe)
|
include(CMLibDocBreathe)
|
||||||
include(CMLibQtTranslation)
|
include(CMLibQtTranslation)
|
||||||
include(CMLibToday)
|
include(CMLibToday)
|
||||||
|
include(CMLibAuxilarySymlinks)
|
||||||
include(CMLibConfigHPPGenerate)
|
include(CMLibConfigHPPGenerate)
|
||||||
include(CMLibCPackSources)
|
include(CMLibCPackSources)
|
||||||
include(CMLibUninstall)
|
include(CMLibUninstall)
|
||||||
|
@@ -16,38 +16,26 @@ function(add_common_library)
|
|||||||
|
|
||||||
add_library(${LIBNAME} OBJECT ${SOURCES})
|
add_library(${LIBNAME} OBJECT ${SOURCES})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${LIBNAME}
|
${LIBNAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
PUBLIC
|
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/${LIBNAME}>)
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
|
|
||||||
$<INSTALL_INTERFACE:include/${LIBNAME}>)
|
|
||||||
set_target_properties(${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
set_target_properties(${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
|
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
${LIBNAME}_shared
|
${LIBNAME}_shared
|
||||||
PROPERTIES
|
PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} OUTPUT_NAME ${OUTNAME}
|
||||||
VERSION
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
|
||||||
${PROJECT_VERSION}
|
|
||||||
SOVERSION
|
|
||||||
${PROJECT_VERSION_MAJOR}
|
|
||||||
OUTPUT_NAME
|
|
||||||
${OUTNAME}
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY
|
|
||||||
${CMAKE_INSTALL_LIBDIR})
|
|
||||||
install(TARGETS ${LIBNAME}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS ${LIBNAME}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SKIP_STATIC_LIBS)
|
if(NOT SKIP_STATIC_LIBS)
|
||||||
add_library(${LIBNAME}_static STATIC $<TARGET_OBJECTS:${LIBNAME}>)
|
add_library(${LIBNAME}_static STATIC $<TARGET_OBJECTS:${LIBNAME}>)
|
||||||
set_target_properties(
|
set_target_properties(${LIBNAME}_static PROPERTIES OUTPUT_NAME ${OUTNAME} ARCHIVE_OUTPUT_DIRECTORY
|
||||||
${LIBNAME}_static PROPERTIES OUTPUT_NAME ${OUTNAME} ARCHIVE_OUTPUT_DIRECTORY
|
|
||||||
${CMAKE_INSTALL_LIBDIR})
|
${CMAKE_INSTALL_LIBDIR})
|
||||||
install(TARGETS ${LIBNAME}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS ${LIBNAME}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${LIBNAME}.pc)
|
configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${LIBNAME}.pc)
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/${LIBNAME}.pc
|
install(FILES ${CMAKE_BINARY_DIR}/${LIBNAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -7,19 +7,23 @@ function(common_target_properties Name)
|
|||||||
set(__interface 1)
|
set(__interface 1)
|
||||||
set(__visibility INTERFACE)
|
set(__visibility INTERFACE)
|
||||||
endif()
|
endif()
|
||||||
target_compile_features(${Name} ${__visibility} ${COMMON_CXX_FEATURES})
|
target_compile_features(
|
||||||
|
${Name}
|
||||||
|
${__visibility}
|
||||||
|
${COMMON_CXX_FEATURES})
|
||||||
get_target_property(_targetType ${Name} TYPE)
|
get_target_property(_targetType ${Name} TYPE)
|
||||||
if(_targetType STREQUAL "EXECUTABLE" AND CMAKE_CXX_COMPILE_OPTIONS_PIE)
|
if(_targetType STREQUAL "EXECUTABLE" AND CMAKE_CXX_COMPILE_OPTIONS_PIE)
|
||||||
target_compile_options(${Name} PUBLIC "${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
target_compile_options(${Name} PUBLIC "${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
||||||
endif()
|
endif()
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${Name}
|
${Name}
|
||||||
PUBLIC
|
PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_compile_definitions(${Name} ${__visibility} Darwin)
|
target_compile_definitions(
|
||||||
|
${Name}
|
||||||
|
${__visibility}
|
||||||
|
Darwin)
|
||||||
endif()
|
endif()
|
||||||
if(NOT __interface)
|
if(NOT __interface)
|
||||||
if(TARGET Qt5::Core)
|
if(TARGET Qt5::Core)
|
||||||
@@ -51,13 +55,11 @@ function(common_target_properties Name)
|
|||||||
if(CMAKE_CXX_COMPILER_IS_GCC AND CXX_HAS_LTO_FLAG)
|
if(CMAKE_CXX_COMPILER_IS_GCC AND CXX_HAS_LTO_FLAG)
|
||||||
find_program(
|
find_program(
|
||||||
CMAKE_GCC_AR
|
CMAKE_GCC_AR
|
||||||
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_TOOLCHAIN_SUFFIX}"
|
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_TOOLCHAIN_SUFFIX}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
|
||||||
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
|
|
||||||
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||||
find_program(
|
find_program(
|
||||||
CMAKE_GCC_NM
|
CMAKE_GCC_NM
|
||||||
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm${_CMAKE_TOOLCHAIN_SUFFIX}"
|
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm${_CMAKE_TOOLCHAIN_SUFFIX}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm"
|
||||||
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm"
|
|
||||||
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||||
find_program(
|
find_program(
|
||||||
CMAKE_GCC_RANLIB
|
CMAKE_GCC_RANLIB
|
||||||
@@ -75,10 +77,7 @@ function(common_target_properties Name)
|
|||||||
set(CMAKE_NM "${CMAKE_GCC_NM}")
|
set(CMAKE_NM "${CMAKE_GCC_NM}")
|
||||||
set(CMAKE_RANLIB "${CMAKE_GCC_RANLIB}")
|
set(CMAKE_RANLIB "${CMAKE_GCC_RANLIB}")
|
||||||
else()
|
else()
|
||||||
message(
|
message(WARNING "GCC indicates LTO support, but binutils wrappers could not be found. Disabling LTO.")
|
||||||
WARNING
|
|
||||||
"GCC indicates LTO support, but binutils wrappers could not be found. Disabling LTO."
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
check_enable_compiler_flag(-flto)
|
check_enable_compiler_flag(-flto)
|
||||||
@@ -86,4 +85,30 @@ function(common_target_properties Name)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL Profile)
|
||||||
|
target_compile_definitions(
|
||||||
|
${Name}
|
||||||
|
${__visibility}
|
||||||
|
PROFILE)
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
target_compile_definitions(
|
||||||
|
${Name}
|
||||||
|
${__visibility}
|
||||||
|
DEBUG)
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||||
|
target_compile_definitions(
|
||||||
|
${Name}
|
||||||
|
${__visibility}
|
||||||
|
RELEASE)
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL None)
|
||||||
|
target_compile_definitions(
|
||||||
|
${Name}
|
||||||
|
${__visibility}
|
||||||
|
ANALYSIS)
|
||||||
|
endif()
|
||||||
|
target_compile_definitions(
|
||||||
|
${Name}
|
||||||
|
${__visibility}
|
||||||
|
"TARGET_LSB_ID_${LSB_DISTRIBUTOR_ID}"
|
||||||
|
"TARGET_LSB_CODENAME_${LSB_CODENAME}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -12,8 +12,7 @@ endif()
|
|||||||
# C++ compiler name
|
# C++ compiler name
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
set(CMAKE_CXX_COMPILER_IS_INTEL ON)
|
set(CMAKE_CXX_COMPILER_IS_INTEL ON)
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
"AppleClang")
|
|
||||||
set(CMAKE_CXX_COMPILER_IS_CLANG ON)
|
set(CMAKE_CXX_COMPILER_IS_CLANG ON)
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(CMAKE_CXX_COMPILER_IS_GCC ON)
|
set(CMAKE_CXX_COMPILER_IS_GCC ON)
|
||||||
|
@@ -3,10 +3,6 @@ function(cmlib_config_hpp_generate)
|
|||||||
cmlib_test_large_files(HAVE_LARGEFILES)
|
cmlib_test_large_files(HAVE_LARGEFILES)
|
||||||
|
|
||||||
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
|
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
|
||||||
string(TOLOWER ${ORGANIZATION_NAME} ORGANIZATION_NAME_LOWER)
|
configure_file(${CMLIB_MODULE_DIR}/hpp/cmlib_private_config.hpp.in
|
||||||
string(TOUPPER ${ORGANIZATION_NAME} ORGANIZATION_NAME_UPPER)
|
${CMAKE_BINARY_DIR}/include/cmlib_private_config.hpp)
|
||||||
string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_LOWER)
|
|
||||||
string(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_UPPER)
|
|
||||||
configure_file(${CMLIB_MODULE_DIR}/hpp/cmlib_config.hpp.in
|
|
||||||
${CMAKE_BINARY_DIR}/include/cmlib_config.hpp)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -2,8 +2,7 @@ find_program(DISTCC_EXECUTABLE distcc)
|
|||||||
mark_as_advanced(DISTCC_EXECUTABLE)
|
mark_as_advanced(DISTCC_EXECUTABLE)
|
||||||
if(DISTCC_EXECUTABLE)
|
if(DISTCC_EXECUTABLE)
|
||||||
foreach(LANG C CXX)
|
foreach(LANG C CXX)
|
||||||
if(NOT DEFINED CMAKE_${LANG}_COMPILER_LAUNCHER AND NOT CMAKE_${LANG}_COMPILER MATCHES
|
if(NOT DEFINED CMAKE_${LANG}_COMPILER_LAUNCHER AND NOT CMAKE_${LANG}_COMPILER MATCHES ".*/distcc$")
|
||||||
".*/distcc$")
|
|
||||||
message(STATUS "Enabling distcc for ${LANG}")
|
message(STATUS "Enabling distcc for ${LANG}")
|
||||||
set(CMAKE_${LANG}_COMPILER_LAUNCHER
|
set(CMAKE_${LANG}_COMPILER_LAUNCHER
|
||||||
${DISTCC_EXECUTABLE}
|
${DISTCC_EXECUTABLE}
|
||||||
|
@@ -37,8 +37,7 @@ function(add_breathe_target)
|
|||||||
set(oneValueArgs TARGET_NAME COMMENT)
|
set(oneValueArgs TARGET_NAME COMMENT)
|
||||||
set(multiValueArgs)
|
set(multiValueArgs)
|
||||||
|
|
||||||
cmake_parse_arguments(_BREATHE "${options}" "${oneValueArgs}" "${multiValueArgs}"
|
cmake_parse_arguments(_BREATHE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
${ARGN})
|
|
||||||
if(BREATHE_FOUND)
|
if(BREATHE_FOUND)
|
||||||
set(WORK_DIR ${CMAKE_BINARY_DIR}/_breathe)
|
set(WORK_DIR ${CMAKE_BINARY_DIR}/_breathe)
|
||||||
set(BREATHE_DOCS_BUILD_DIR ${WORK_DIR})
|
set(BREATHE_DOCS_BUILD_DIR ${WORK_DIR})
|
||||||
@@ -53,9 +52,9 @@ function(add_breathe_target)
|
|||||||
configure_file(${DOXY_FILE} ${WORK_DIR}/Doxyfile @ONLY)
|
configure_file(${DOXY_FILE} ${WORK_DIR}/Doxyfile @ONLY)
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${_BREATHE_TARGET_NAME} VERBATIM
|
${_BREATHE_TARGET_NAME}
|
||||||
COMMAND
|
VERBATIM
|
||||||
${SPHINX_EXECUTABLE} -q -b html -c ${WORK_DIR} -d ${WORK_DIR}/cache ${WORK_DIR}
|
COMMAND ${SPHINX_EXECUTABLE} -q -b html -c ${WORK_DIR} -d ${WORK_DIR}/cache ${WORK_DIR}
|
||||||
${CMAKE_BINARY_DIR}/doc/breathe
|
${CMAKE_BINARY_DIR}/doc/breathe
|
||||||
COMMENT "Building ${_BREATHE_TARGET_NAME} documentation with Breathe")
|
COMMENT "Building ${_BREATHE_TARGET_NAME} documentation with Breathe")
|
||||||
|
|
||||||
@@ -65,7 +64,8 @@ function(add_breathe_target)
|
|||||||
file(GLOB MD_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.md)
|
file(GLOB MD_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.md)
|
||||||
if(MD_FILES)
|
if(MD_FILES)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${_BREATHE_TARGET_NAME} PRE_BUILD
|
TARGET ${_BREATHE_TARGET_NAME}
|
||||||
|
PRE_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MD_FILES} ${WORK_DIR})
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MD_FILES} ${WORK_DIR})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -76,13 +76,15 @@ function(add_breathe_target)
|
|||||||
file(GLOB RST_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.rst)
|
file(GLOB RST_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.rst)
|
||||||
if(RST_FILES)
|
if(RST_FILES)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${_BREATHE_TARGET_NAME} PRE_BUILD
|
TARGET ${_BREATHE_TARGET_NAME}
|
||||||
|
PRE_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RST_FILES} ${WORK_DIR})
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RST_FILES} ${WORK_DIR})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${_BREATHE_TARGET_NAME} VERBATIM
|
${_BREATHE_TARGET_NAME}
|
||||||
|
VERBATIM
|
||||||
COMMENT "Breathe is not found. Skipping target ${_BREATHE_TARGET_NAME} build")
|
COMMENT "Breathe is not found. Skipping target ${_BREATHE_TARGET_NAME} build")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -19,8 +19,7 @@ function(add_doxygen_target)
|
|||||||
set(oneValueArgs TARGET_NAME SQLITE LATEX HTML)
|
set(oneValueArgs TARGET_NAME SQLITE LATEX HTML)
|
||||||
set(multiValueArgs)
|
set(multiValueArgs)
|
||||||
|
|
||||||
cmake_parse_arguments(_DOXYGEN "${options}" "${oneValueArgs}" "${multiValueArgs}"
|
cmake_parse_arguments(_DOXYGEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
${ARGN})
|
|
||||||
if(DOXYGEN_FOUND)
|
if(DOXYGEN_FOUND)
|
||||||
set(GENERATE_XML NO)
|
set(GENERATE_XML NO)
|
||||||
set(GENERATE_HTML NO)
|
set(GENERATE_HTML NO)
|
||||||
@@ -40,14 +39,16 @@ function(add_doxygen_target)
|
|||||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/doc/Doxyfile.in ${WORK_DIR}/Doxyfile @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/cmake/doc/Doxyfile.in ${WORK_DIR}/Doxyfile @ONLY)
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${_DOXYGEN_TARGET_NAME} VERBATIM
|
${_DOXYGEN_TARGET_NAME}
|
||||||
|
VERBATIM
|
||||||
COMMAND "${CMAKE_COMMAND}" -E remove -f "${WORK_DIR}/doxygen_sqlite3.db"
|
COMMAND "${CMAKE_COMMAND}" -E remove -f "${WORK_DIR}/doxygen_sqlite3.db"
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} ${WORK_DIR}/Doxyfile
|
COMMAND ${DOXYGEN_EXECUTABLE} ${WORK_DIR}/Doxyfile
|
||||||
WORKING_DIRECTORY ${WORK_DIR}
|
WORKING_DIRECTORY ${WORK_DIR}
|
||||||
COMMENT "Generating API documentation with Doxygen")
|
COMMENT "Generating API documentation with Doxygen")
|
||||||
else()
|
else()
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${_DOXYGEN_TARGET_NAME} VERBATIM
|
${_DOXYGEN_TARGET_NAME}
|
||||||
|
VERBATIM
|
||||||
COMMENT "Doxygen is not found. Skipping target ${_DOXYGEN_TARGET_NAME} build")
|
COMMENT "Doxygen is not found. Skipping target ${_DOXYGEN_TARGET_NAME} build")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -51,8 +51,7 @@ macro(remove_flag_from_file _target _file _flag)
|
|||||||
endif()
|
endif()
|
||||||
# Apply the compile flags to the current source file.
|
# Apply the compile flags to the current source file.
|
||||||
string(REPLACE ";" " " _source_file_cxx_flags_string "${_source_file_cxx_flags}")
|
string(REPLACE ";" " " _source_file_cxx_flags_string "${_source_file_cxx_flags}")
|
||||||
set_source_files_properties(${_source_file} PROPERTIES COMPILE_FLAGS
|
set_source_files_properties(${_source_file} PROPERTIES COMPILE_FLAGS "${_source_file_cxx_flags_string}")
|
||||||
"${_source_file_cxx_flags_string}")
|
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
list(FIND _target_sources ${_file} _file_found_at)
|
list(FIND _target_sources ${_file} _file_found_at)
|
||||||
|
@@ -9,12 +9,12 @@ function(add_format_sources)
|
|||||||
|
|
||||||
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
|
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
|
||||||
if(UNCRUSTIFY_EXE)
|
if(UNCRUSTIFY_EXE)
|
||||||
list(APPEND UNCRUSTIFY_OPTS -lCPP --replace --no-backup)
|
list(APPEND UNCRUSTIFY_OPTS -lCPP --replace --no-backup --mtime)
|
||||||
if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg)
|
if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg)
|
||||||
list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg)
|
list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg)
|
||||||
endif()
|
endif()
|
||||||
add_custom_target(format-sources-uncrustify-${_target}
|
add_custom_target(format-sources-uncrustify-${_target} COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS}
|
||||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} ${_sources})
|
${_sources})
|
||||||
add_dependencies(format-sources format-sources-uncrustify-${_target})
|
add_dependencies(format-sources format-sources-uncrustify-${_target})
|
||||||
else()
|
else()
|
||||||
message(STATUS "CMLIB warning:")
|
message(STATUS "CMLIB warning:")
|
||||||
@@ -24,8 +24,7 @@ function(add_format_sources)
|
|||||||
find_program(DOS2UNIX_EXE NAMES dos2unix)
|
find_program(DOS2UNIX_EXE NAMES dos2unix)
|
||||||
if(DOS2UNIX_EXE)
|
if(DOS2UNIX_EXE)
|
||||||
list(APPEND DOS2UNIX_OPTS -k -r)
|
list(APPEND DOS2UNIX_OPTS -k -r)
|
||||||
add_custom_target(format-sources-dos2unix-${_target} COMMAND ${DOS2UNIX_EXE} ${DOS2UNIX_OPTS}
|
add_custom_target(format-sources-dos2unix-${_target} COMMAND ${DOS2UNIX_EXE} ${DOS2UNIX_OPTS} ${_sources})
|
||||||
${_sources})
|
|
||||||
add_dependencies(format-sources format-sources-dos2unix-${_target})
|
add_dependencies(format-sources format-sources-dos2unix-${_target})
|
||||||
else()
|
else()
|
||||||
message(STATUS "CMLIB warning:")
|
message(STATUS "CMLIB warning:")
|
||||||
|
7
CMLibGlobalFunctions.cmake
Normal file
7
CMLibGlobalFunctions.cmake
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
function(canonical_string INV OUTV)
|
||||||
|
string(TOUPPER ${INV} _arg_uppercase)
|
||||||
|
string(REGEX REPLACE "[ -]" "_" _arg_fixed ${_arg_uppercase})
|
||||||
|
set(${OUTV}
|
||||||
|
${_arg_fixed}
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
@@ -1,7 +1,8 @@
|
|||||||
# CMLIB_PROJECT_NAME_CANONICAL
|
canonical_string(${PROJECT_NAME} CMLIB_PROJECT_NAME_CANONICAL)
|
||||||
string(TOUPPER ${PROJECT_NAME} _project_name_uppercase)
|
canonical_string(${ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL)
|
||||||
string(REGEX REPLACE "[ -]" "_" _project_name_fixed ${_project_name_uppercase})
|
|
||||||
set(CMLIB_PROJECT_NAME_CANONICAL ${_project_name_fixed})
|
string(TOLOWER ${CMLIB_ORGANIZATION_NAME_CANONICAL} CMLIB_ORGANIZATION_NAME_LOWER)
|
||||||
|
string(TOLOWER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_LOWER)
|
||||||
|
|
||||||
# CMLIB_MODULE_DIR
|
# CMLIB_MODULE_DIR
|
||||||
foreach(_m ${CMAKE_MODULE_PATH})
|
foreach(_m ${CMAKE_MODULE_PATH})
|
||||||
|
@@ -20,19 +20,13 @@ if(EXISTS /etc/mcst_version)
|
|||||||
else()
|
else()
|
||||||
find_program(_lsb_release_executable lsb_release)
|
find_program(_lsb_release_executable lsb_release)
|
||||||
if(_lsb_release_executable)
|
if(_lsb_release_executable)
|
||||||
execute_process(
|
execute_process(COMMAND ${_lsb_release_executable} -si OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
|
||||||
COMMAND ${_lsb_release_executable} -si
|
|
||||||
OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
execute_process(
|
execute_process(COMMAND ${_lsb_release_executable} -sc OUTPUT_VARIABLE LSB_CODENAME
|
||||||
COMMAND ${_lsb_release_executable} -sc
|
|
||||||
OUTPUT_VARIABLE LSB_CODENAME
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
execute_process(
|
execute_process(COMMAND ${_lsb_release_executable} -sr OUTPUT_VARIABLE LSB_RELEASE
|
||||||
COMMAND ${_lsb_release_executable} -sr
|
|
||||||
OUTPUT_VARIABLE LSB_RELEASE
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@@ -61,16 +61,14 @@ macro(cmlib_test_large_files VARIABLE)
|
|||||||
message(STATUS "Checking for 64-bit off_t")
|
message(STATUS "Checking for 64-bit off_t")
|
||||||
|
|
||||||
# First check without any special flags
|
# First check without any special flags
|
||||||
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}"
|
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c")
|
||||||
"${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c")
|
|
||||||
if(FILE64_OK)
|
if(FILE64_OK)
|
||||||
message(STATUS "Checking for 64-bit off_t - present")
|
message(STATUS "Checking for 64-bit off_t - present")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT FILE64_OK)
|
if(NOT FILE64_OK)
|
||||||
# Test with _FILE_OFFSET_BITS=64
|
# Test with _FILE_OFFSET_BITS=64
|
||||||
try_compile(
|
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
|
||||||
FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
|
|
||||||
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
|
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
|
||||||
if(FILE64_OK)
|
if(FILE64_OK)
|
||||||
message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
|
message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
|
||||||
@@ -82,8 +80,7 @@ macro(cmlib_test_large_files VARIABLE)
|
|||||||
|
|
||||||
if(NOT FILE64_OK)
|
if(NOT FILE64_OK)
|
||||||
# Test with _LARGE_FILES
|
# Test with _LARGE_FILES
|
||||||
try_compile(
|
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
|
||||||
FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
|
|
||||||
COMPILE_DEFINITIONS "-D_LARGE_FILES")
|
COMPILE_DEFINITIONS "-D_LARGE_FILES")
|
||||||
if(FILE64_OK)
|
if(FILE64_OK)
|
||||||
message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
|
message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
|
||||||
@@ -95,8 +92,7 @@ macro(cmlib_test_large_files VARIABLE)
|
|||||||
|
|
||||||
if(NOT FILE64_OK)
|
if(NOT FILE64_OK)
|
||||||
# Test with _LARGEFILE_SOURCE
|
# Test with _LARGEFILE_SOURCE
|
||||||
try_compile(
|
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
|
||||||
FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
|
|
||||||
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
|
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
|
||||||
if(FILE64_OK)
|
if(FILE64_OK)
|
||||||
message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
|
message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
|
||||||
@@ -143,8 +139,7 @@ macro(cmlib_test_large_files VARIABLE)
|
|||||||
|
|
||||||
if(NOT FILE64_OK)
|
if(NOT FILE64_OK)
|
||||||
# now check for Windows stuff
|
# now check for Windows stuff
|
||||||
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}"
|
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestWindowsFSeek.c")
|
||||||
"${CMLIB_MODULE_DIR}/tests/TestWindowsFSeek.c")
|
|
||||||
if(FILE64_OK)
|
if(FILE64_OK)
|
||||||
message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
|
message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
|
||||||
set(HAVE__FSEEKI64
|
set(HAVE__FSEEKI64
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
# read file cmake/etc/organization.txt and set global property ORGANIZATION_NAME
|
|
||||||
|
|
||||||
function(set_organization_name)
|
|
||||||
set(_organization_file "${CMAKE_SOURCE_DIR}/cmake/etc/organization.txt")
|
|
||||||
if(NOT EXISTS "${_organization_file}")
|
|
||||||
message(FATAL_ERROR "File ${ORGANIZATION_FILE} doesn't exist")
|
|
||||||
endif()
|
|
||||||
file(READ "${_organization_file}" _org)
|
|
||||||
set_property(
|
|
||||||
DIRECTORY
|
|
||||||
APPEND
|
|
||||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${_organization_file})
|
|
||||||
|
|
||||||
if(NOT "${_org}" MATCHES "^([0-9A-Za-z ,.]+)\n")
|
|
||||||
message(FATAL_ERROR "File ${_organization_file} has wrong format")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(REGEX MATCH "^([0-9A-Za-z ,.]+)\n" _ ${_org})
|
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY ORGANIZATION_NAME ${CMAKE_MATCH_1})
|
|
||||||
endfunction()
|
|
@@ -3,10 +3,7 @@ function(set_project_version)
|
|||||||
message(FATAL_ERROR "Please set project version in X.Y.Z format")
|
message(FATAL_ERROR "Please set project version in X.Y.Z format")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
math(
|
math(EXPR _version_int
|
||||||
EXPR
|
"(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}")
|
||||||
_version_int
|
|
||||||
"(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}"
|
|
||||||
)
|
|
||||||
set_property(GLOBAL PROPERTY PROJECT_VERSION_INT ${_version_int})
|
set_property(GLOBAL PROPERTY PROJECT_VERSION_INT ${_version_int})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
function(qt_translation)
|
function(qt5_translation)
|
||||||
find_package(
|
find_package(
|
||||||
Qt5
|
Qt5
|
||||||
COMPONENTS LinguistTools
|
COMPONENTS LinguistTools
|
||||||
@@ -6,13 +6,13 @@ function(qt_translation)
|
|||||||
|
|
||||||
set(options)
|
set(options)
|
||||||
set(oneValueArgs TARGET TS_DIR)
|
set(oneValueArgs TARGET TS_DIR)
|
||||||
set(multiValueArgs LANGUAGES)
|
set(multiValueArgs SOURCES LANGUAGES)
|
||||||
|
|
||||||
cmake_parse_arguments(_QTTR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(_QTTR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
set(_target ${_QTTR_TARGET})
|
set(_target ${_QTTR_TARGET})
|
||||||
|
set(_sources ${_QTTR_SOURCES})
|
||||||
set(_ts_dir ${_QTTR_TS_DIR})
|
set(_ts_dir ${_QTTR_TS_DIR})
|
||||||
set(_languages ${_QTTR_LANGUAGES})
|
set(_languages ${_QTTR_LANGUAGES})
|
||||||
get_target_property(_sources ${_target} SOURCES)
|
|
||||||
|
|
||||||
set(L10N_QRC_BODY "")
|
set(L10N_QRC_BODY "")
|
||||||
make_directory(${_ts_dir})
|
make_directory(${_ts_dir})
|
||||||
@@ -22,13 +22,11 @@ function(qt_translation)
|
|||||||
set(_qm "${_target}_${_lang}.qm")
|
set(_qm "${_target}_${_lang}.qm")
|
||||||
list(APPEND _ts_list ${_ts_dir}/${_ts})
|
list(APPEND _ts_list ${_ts_dir}/${_ts})
|
||||||
list(APPEND _l10n_targets "${_target}_l10n_${_lang}")
|
list(APPEND _l10n_targets "${_target}_l10n_${_lang}")
|
||||||
string(APPEND L10N_QRC_BODY
|
string(APPEND L10N_QRC_BODY "<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
|
||||||
"<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
|
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${_target}_l10n_${_lang}
|
${_target}_l10n_${_lang}
|
||||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources} -ts ${_ts_dir}/${_ts} -target-language
|
COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources} -ts ${_ts_dir}/${_ts} -target-language ${_lang}
|
||||||
${_lang}
|
|
||||||
DEPENDS ${_sources})
|
DEPENDS ${_sources})
|
||||||
|
|
||||||
if(NOT EXISTS "${_ts_dir}/${_ts}")
|
if(NOT EXISTS "${_ts_dir}/${_ts}")
|
||||||
@@ -39,13 +37,11 @@ function(qt_translation)
|
|||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/${_qm}
|
OUTPUT ${CMAKE_BINARY_DIR}/${_qm}
|
||||||
COMMAND ${Qt5_LRELEASE_EXECUTABLE} ARGS ${_ts_dir}/${_ts} -qm
|
COMMAND ${Qt5_LRELEASE_EXECUTABLE} ARGS ${_ts_dir}/${_ts} -qm ${CMAKE_BINARY_DIR}/${_qm}
|
||||||
${CMAKE_BINARY_DIR}/${_qm}
|
|
||||||
DEPENDS ${_ts} ${_sources})
|
DEPENDS ${_ts} ${_sources})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
configure_file(${CMLIB_MODULE_DIR}/qrc/l10n.qrc.in
|
configure_file(${CMLIB_MODULE_DIR}/qrc/l10n.qrc.in ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
|
||||||
${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
|
|
||||||
qt5_add_resources(_qrc ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
|
qt5_add_resources(_qrc ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
|
||||||
add_custom_target(${_target}_qrc DEPENDS ${_qrc})
|
add_custom_target(${_target}_qrc DEPENDS ${_qrc})
|
||||||
add_custom_target(${_target}_l10n DEPENDS ${_l10n_targets})
|
add_custom_target(${_target}_l10n DEPENDS ${_l10n_targets})
|
||||||
|
@@ -19,8 +19,7 @@ if(NOT CPACK_PACKAGE_CONTACT)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||||
message(
|
message(FATAL_ERROR "Required variable CPACK_PACKAGE_DESCRIPTION_SUMMARY is not defined")
|
||||||
FATAL_ERROR "Required variable CPACK_PACKAGE_DESCRIPTION_SUMMARY is not defined")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
|
if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
if(NOT TARGET uninstall)
|
if(NOT TARGET uninstall)
|
||||||
configure_file("${CMLIB_MODULE_DIR}/CMLibUninstall.cmake.in"
|
configure_file("${CMLIB_MODULE_DIR}/CMLibUninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
IMMEDIATE @ONLY)
|
||||||
|
|
||||||
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P
|
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)
|
||||||
${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)
|
|
||||||
endif()
|
endif()
|
||||||
|
@@ -1,31 +0,0 @@
|
|||||||
#ifndef @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_
|
|
||||||
#define @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_
|
|
||||||
|
|
||||||
#define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_STR "@PROJECT_VERSION@"
|
|
||||||
#define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_INT @PROJECT_VERSION_INT@
|
|
||||||
#define ORGANIZATION_NAME "@ORGANIZATION_NAME@"
|
|
||||||
#define ORGANIZATION_NAME_LOWER "@ORGANIZATION_NAME_LOWER@"
|
|
||||||
#define ORGANIZATION_NAME_UPPER "@ORGANIZATION_NAME_UPPER@"
|
|
||||||
#define PROJECT_NAME "@CMAKE_PROJECT_NAME@"
|
|
||||||
#define PROJECT_NAME_LOWER "@CMAKE_PROJECT_NAME_LOWER@"
|
|
||||||
#define PROJECT_NAME_UPPER "@CMAKE_PROJECT_NAME_UPPER@"
|
|
||||||
#define BUILD_TYPE "@CMAKE_BUILD_TYPE@"
|
|
||||||
#define BUILD_DATE "@TODAY@"
|
|
||||||
#cmakedefine PROFILE @PROFILE@
|
|
||||||
#cmakedefine DEBUG @DEBUG@
|
|
||||||
#cmakedefine RELEASE @RELEASE@
|
|
||||||
#cmakedefine ANALYSIS @ANALYSIS@
|
|
||||||
|
|
||||||
#cmakedefine _LARGEFILE_SOURCE
|
|
||||||
#cmakedefine _LARGE_FILES
|
|
||||||
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
|
|
||||||
#cmakedefine HAVE_FSEEKO
|
|
||||||
#cmakedefine HAVE__FSEEKI64
|
|
||||||
#cmakedefine HAVE_LARGEFILES @HAVE_LARGEFILES@
|
|
||||||
|
|
||||||
#define TARGET_LSB_ID_@LSB_DISTRIBUTOR_ID@
|
|
||||||
#define TARGET_LSB_CODENAME_@LSB_CODENAME@
|
|
||||||
#define TARGET_LSB_RELEASE "@LSB_RELEASE@"
|
|
||||||
|
|
||||||
#endif /* @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_ */
|
|
||||||
|
|
58
hpp/cmlib_private_config.hpp.in
Normal file
58
hpp/cmlib_private_config.hpp.in
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#ifndef @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_
|
||||||
|
#define @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_STR "@PROJECT_VERSION@"
|
||||||
|
#define @CMLIB_PROJECT_NAME_CANONICAL@_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@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (CMLIB_ORGANIZATION_NAME_LOWER)
|
||||||
|
#error "Duplicate definition of macros CMLIB_ORGANIZATION_NAME_LOWER"
|
||||||
|
#else
|
||||||
|
#define CMLIB_ORGANIZATION_NAME_LOWER "@ORGANIZATION_NAME_LOWER@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (CMLIB_ORGANIZATION_NAME_UPPER)
|
||||||
|
#error "Duplicate definition of macros CMLIB_ORGANIZATION_NAME_UPPER"
|
||||||
|
#else
|
||||||
|
#define CMLIB_ORGANIZATION_NAME_UPPER "@ORGANIZATION_NAME_UPPER@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (CMLIB_PROJECT_NAME)
|
||||||
|
#error "Duplicate definition of macros CMLIB_PROJECT_NAME"
|
||||||
|
#else
|
||||||
|
#define CMLIB_PROJECT_NAME "@CMAKE_PROJECT_NAME@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (CMLIB_PROJECT_NAME_LOWER)
|
||||||
|
#error "Duplicate definition of macros CMLIB_PROJECT_NAME_LOWER"
|
||||||
|
#else
|
||||||
|
#define CMLIB_PROJECT_NAME_LOWER "@CMAKE_PROJECT_NAME_LOWER@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (CMLIB_PROJECT_NAME_UPPER)
|
||||||
|
#error "Duplicate definition of macros CMLIB_PROJECT_NAME_UPPER"
|
||||||
|
#else
|
||||||
|
#define CMLIB_PROJECT_NAME_UPPER "@CMAKE_PROJECT_NAME_UPPER@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (CMLIB_BUILD_TYPE)
|
||||||
|
#error "Duplicate definition of macros CMLIB_BUILD_TYPE"
|
||||||
|
#else
|
||||||
|
#define CMLIB_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (CMLIB_BUILD_DATE)
|
||||||
|
#error "Duplicate definition of macros CMLIB_BUILD_DATE"
|
||||||
|
#else
|
||||||
|
#define CMLIB_BUILD_DATE "@TODAY@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* @CMLIB_PROJECT_NAME_CANONICAL@_CMLIB_CONFIG_HPP_ */
|
||||||
|
|
Reference in New Issue
Block a user