Чистка
This commit is contained in:
parent
cfad412b21
commit
b3ad740ab8
@ -175,7 +175,7 @@ with section("markup"):
|
|||||||
with section("lint"):
|
with section("lint"):
|
||||||
|
|
||||||
# a list of lint codes to disable
|
# a list of lint codes to disable
|
||||||
disabled_codes = []
|
disabled_codes = ['C0111','C0113']
|
||||||
|
|
||||||
# regular expression pattern describing valid function names
|
# regular expression pattern describing valid function names
|
||||||
function_pattern = '[0-9a-z_]+'
|
function_pattern = '[0-9a-z_]+'
|
@ -49,9 +49,9 @@ if(CMLIB_CPACK_DEFAULT_SCHEME)
|
|||||||
|
|
||||||
set(CPACK_DEBIAN_LIBS-DEV_PACKAGE_DEPENDS "lib${CMLIB_PROJECT_NAME_LOWER}-base-dev")
|
set(CPACK_DEBIAN_LIBS-DEV_PACKAGE_DEPENDS "lib${CMLIB_PROJECT_NAME_LOWER}-base-dev")
|
||||||
|
|
||||||
foreach(_C ${CPACK_COMPONENTS_ALL})
|
foreach(component ${CPACK_COMPONENTS_ALL})
|
||||||
string(TOLOWER ${_C} _cl)
|
string(TOLOWER ${component} _cl)
|
||||||
string(TOUPPER ${_C} _cu)
|
string(TOUPPER ${component} _cu)
|
||||||
# Правила формирования имени пакета и файла для остальных компонентов
|
# Правила формирования имени пакета и файла для остальных компонентов
|
||||||
if(NOT ${_cl} STREQUAL main AND NOT ${_cl} STREQUAL base-dev AND NOT ${_cl} STREQUAL libs-dev)
|
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}_PACKAGE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${_cl}")
|
||||||
|
@ -5,15 +5,14 @@ function(add_common_library target)
|
|||||||
set(multiValueArgs SOURCES)
|
set(multiValueArgs SOURCES)
|
||||||
|
|
||||||
cmake_parse_arguments(_LOCAL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(_LOCAL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
set(SOURCES ${_LOCAL_SOURCES})
|
|
||||||
|
|
||||||
if(_LOCAL_OUTPUT_NAME)
|
if(_LOCAL_OUTPUT_NAME)
|
||||||
set(OUTNAME ${_LOCAL_OUTPUT_NAME})
|
set(output_name ${_LOCAL_OUTPUT_NAME})
|
||||||
else()
|
else()
|
||||||
set(OUTNAME ${target})
|
set(output_name ${target})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${target} OBJECT ${SOURCES})
|
add_library(${target} OBJECT ${_LOCAL_SOURCES})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/${target}>)
|
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/${target}>)
|
||||||
@ -22,7 +21,7 @@ function(add_common_library target)
|
|||||||
# cmake-format: off
|
# cmake-format: off
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
add_library(${target}_shared SHARED $<TARGET_OBJECTS:${target}>)
|
add_library(${target}_shared SHARED $<TARGET_OBJECTS:${target}>)
|
||||||
set_target_properties(${target}_shared PROPERTIES OUTPUT_NAME ${OUTNAME}
|
set_target_properties(${target}_shared PROPERTIES OUTPUT_NAME ${output_name}
|
||||||
VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}
|
VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||||
install(TARGETS ${target}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS ${target}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
@ -30,7 +29,7 @@ function(add_common_library target)
|
|||||||
|
|
||||||
if(NOT SKIP_STATIC_LIBS)
|
if(NOT SKIP_STATIC_LIBS)
|
||||||
add_library(${target}_static STATIC $<TARGET_OBJECTS:${target}>)
|
add_library(${target}_static STATIC $<TARGET_OBJECTS:${target}>)
|
||||||
set_target_properties(${target}_static PROPERTIES OUTPUT_NAME ${OUTNAME}
|
set_target_properties(${target}_static PROPERTIES OUTPUT_NAME ${output_name}
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||||
install(TARGETS ${target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS ${target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif()
|
endif()
|
||||||
|
@ -10,8 +10,8 @@ function(common_target_properties target)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_target_property(__sources ${target} SOURCES)
|
get_target_property(__sources ${target} SOURCES)
|
||||||
foreach(__src IN LISTS __sources)
|
foreach(src IN LISTS __sources)
|
||||||
string(REGEX MATCH ".*/qrc_.*\\.cpp$" __qrc ${__src})
|
string(REGEX MATCH ".*/qrc_.*\\.cpp$" __qrc ${src})
|
||||||
if(__qrc)
|
if(__qrc)
|
||||||
set_property(SOURCE ${__qrc} PROPERTY COTIRE_EXCLUDED ON)
|
set_property(SOURCE ${__qrc} PROPERTY COTIRE_EXCLUDED ON)
|
||||||
endif()
|
endif()
|
||||||
|
@ -68,9 +68,9 @@ if(LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" AND
|
|||||||
# cmake-format: on
|
# cmake-format: on
|
||||||
cmlib_set_cxx_standard(11)
|
cmlib_set_cxx_standard(11)
|
||||||
|
|
||||||
set(_CMAKE_TOOLCHAIN_PREFIX "x86_64-linux-gnu-")
|
set(_CMAKE_TOOLCHAIN_PREFIX "x86_64-linux-gnu-" CACHE INTERNAL "" FORCE)
|
||||||
set(_CMAKE_TOOLCHAIN_SUFFIX "-4.7")
|
set(_CMAKE_TOOLCHAIN_SUFFIX "-4.7" CACHE INTERNAL "" FORCE)
|
||||||
set(_CMAKE_TOOLCHAIN_LOCATION "/usr/bin")
|
set(_CMAKE_TOOLCHAIN_LOCATION "/usr/bin" CACHE INTERNAL "" FORCE)
|
||||||
else()
|
else()
|
||||||
cmlib_set_cxx_standard(17)
|
cmlib_set_cxx_standard(17)
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ endif()
|
|||||||
|
|
||||||
# Очистка от сгенерированных файлов
|
# Очистка от сгенерированных файлов
|
||||||
file(GLOB_RECURSE _cmakelists_files RELATIVE ${_source_realpath} CMakeLists.txt)
|
file(GLOB_RECURSE _cmakelists_files RELATIVE ${_source_realpath} CMakeLists.txt)
|
||||||
foreach(_it ${_cmakelists_files})
|
foreach(it ${_cmakelists_files})
|
||||||
get_filename_component(_file ${_it} REALPATH)
|
get_filename_component(_file ${it} REALPATH)
|
||||||
get_filename_component(_dir ${_file} DIRECTORY)
|
get_filename_component(_dir ${_file} DIRECTORY)
|
||||||
file(
|
file(
|
||||||
REMOVE_RECURSE
|
REMOVE_RECURSE
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
find_program(DISTCC_EXECUTABLE distcc)
|
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 ".*/distcc$")
|
if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND NOT CMAKE_${lang}_COMPILER MATCHES ".*/distcc$")
|
||||||
message(STATUS "Enabling distcc for ${LANG}")
|
message(STATUS "Enabling distcc for ${lang}")
|
||||||
set(CMAKE_${LANG}_COMPILER_LAUNCHER ${DISTCC_EXECUTABLE} CACHE STRING "")
|
set(CMAKE_${lang}_COMPILER_LAUNCHER ${DISTCC_EXECUTABLE} CACHE STRING "")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
@ -25,15 +25,15 @@ function(add_doxygen target)
|
|||||||
set(GENERATE_LATEX YES)
|
set(GENERATE_LATEX YES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(WORK_DIR ${CMAKE_BINARY_DIR}/doc/doxygen)
|
set(work_dir ${CMAKE_BINARY_DIR}/doc/doxygen)
|
||||||
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(
|
||||||
${target}
|
${target}
|
||||||
VERBATIM
|
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()
|
||||||
message(STATUS "CMLIB warning:")
|
message(STATUS "CMLIB warning:")
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#
|
#
|
||||||
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
|
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
|
||||||
#
|
#
|
||||||
|
# cmake-lint: disable=C0103
|
||||||
macro(remove_flag_from_target _target _flag)
|
macro(remove_flag_from_target _target _flag)
|
||||||
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
|
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
|
||||||
if(_target_cxx_flags)
|
if(_target_cxx_flags)
|
||||||
@ -22,6 +23,7 @@ endmacro()
|
|||||||
#
|
#
|
||||||
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
|
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
|
||||||
#
|
#
|
||||||
|
# cmake-lint: disable=C0103
|
||||||
macro(remove_flag_from_file _target _file _flag)
|
macro(remove_flag_from_file _target _file _flag)
|
||||||
get_target_property(_target_sources ${_target} SOURCES)
|
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.
|
# Check if a sync is required, in which case we'll force a rewrite of the cache variables.
|
||||||
|
@ -2,13 +2,13 @@ function(cmlib_generate_private_config_hpp)
|
|||||||
include(CMLibLargeFiles)
|
include(CMLibLargeFiles)
|
||||||
cmlib_test_large_files(HAVE_LARGEFILES)
|
cmlib_test_large_files(HAVE_LARGEFILES)
|
||||||
|
|
||||||
set(OUTPUT_FILE ${CMAKE_BINARY_DIR}/include/cmlib_private_config.hpp)
|
set(output_file ${CMAKE_BINARY_DIR}/include/cmlib_private_config.hpp)
|
||||||
if(CMLIB_GENERATED_HEADERS_PATH)
|
if(CMLIB_GENERATED_HEADERS_PATH)
|
||||||
set(OUTPUT_FILE ${CMLIB_GENERATED_HEADERS_PATH}/cmlib_private_config.hpp)
|
set(output_file ${CMLIB_GENERATED_HEADERS_PATH}/cmlib_private_config.hpp)
|
||||||
elseif(ARGV0)
|
elseif(ARGV0)
|
||||||
set(OUTPUT_FILE ${ARGV0})
|
set(output_file ${ARGV0})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
|
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
|
||||||
configure_file(${CMLIB_MODULE_DIR}/hpp/cmlib_private_config.hpp.in ${OUTPUT_FILE})
|
configure_file(${CMLIB_MODULE_DIR}/hpp/cmlib_private_config.hpp.in ${output_file})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
function(canonical_string INV OUTV)
|
function(canonical_string in_string out_string)
|
||||||
string(TOUPPER ${INV} _arg_uppercase)
|
string(TOUPPER ${in_string} _arg_uppercase)
|
||||||
string(REGEX REPLACE "[ -]" "_" _arg_fixed ${_arg_uppercase})
|
string(REGEX REPLACE "[ -]" "_" _arg_fixed ${_arg_uppercase})
|
||||||
set(${OUTV} ${_arg_fixed} PARENT_SCOPE)
|
set(${out_string} ${_arg_fixed} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Добавление общего префикса ко всем переменным в списке
|
# Добавление общего префикса ко всем переменным в списке
|
||||||
function(list_transform_prepend var prefix)
|
function(list_transform_prepend var prefix)
|
||||||
set(temp "")
|
set(temp "")
|
||||||
foreach(f ${${var}})
|
foreach(filename ${${var}})
|
||||||
list(APPEND temp "${prefix}${f}")
|
list(APPEND temp "${prefix}${filename}")
|
||||||
endforeach()
|
endforeach()
|
||||||
set(${var} "${temp}" PARENT_SCOPE)
|
set(${var} "${temp}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -8,9 +8,9 @@ string(TOUPPER ${CMLIB_ORGANIZATION_NAME_CANONICAL} CMLIB_ORGANIZATION_NAME_UPPE
|
|||||||
string(TOUPPER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_UPPER)
|
string(TOUPPER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_UPPER)
|
||||||
|
|
||||||
# CMLIB_MODULE_DIR
|
# CMLIB_MODULE_DIR
|
||||||
foreach(_m ${CMAKE_MODULE_PATH})
|
foreach(module ${CMAKE_MODULE_PATH})
|
||||||
if(EXISTS ${_m}/CMLibCommon.cmake)
|
if(EXISTS ${module}/CMLibCommon.cmake)
|
||||||
get_filename_component(CMLIB_MODULE_DIR ${_m}/CMLibCommon.cmake DIRECTORY)
|
get_filename_component(CMLIB_MODULE_DIR ${module}/CMLibCommon.cmake DIRECTORY)
|
||||||
break()
|
break()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -129,6 +129,7 @@ macro(cmlib_test_large_files VARIABLE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# cmake-lint: disable=C0103
|
||||||
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}" "${CMLIB_MODULE_DIR}/tests/TestWindowsFSeek.c")
|
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestWindowsFSeek.c")
|
||||||
|
@ -11,22 +11,22 @@ function(qt5_translation outfiles)
|
|||||||
set(_output_dir ${_QTTR_OUTPUT_DIR})
|
set(_output_dir ${_QTTR_OUTPUT_DIR})
|
||||||
set(_languages ${_QTTR_LANGUAGES})
|
set(_languages ${_QTTR_LANGUAGES})
|
||||||
|
|
||||||
set(L10N_QRC_BODY "")
|
set(_l10n_qrc_body "")
|
||||||
make_directory(${_output_dir})
|
make_directory(${_output_dir})
|
||||||
|
|
||||||
foreach(_lang ${_languages})
|
foreach(lang ${_languages})
|
||||||
set(_ts "${_base_name}_${_lang}.ts")
|
set(_ts "${_base_name}_${lang}.ts")
|
||||||
set(_qm "${_base_name}_${_lang}.qm")
|
set(_qm "${_base_name}_${lang}.qm")
|
||||||
list(APPEND _ts_list ${_output_dir}/${_ts})
|
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")
|
string(APPEND _l10n_qrc_body "<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${_base_name}_l10n_${_lang} COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources} -ts ${_output_dir}/${_ts}
|
${_base_name}_l10n_${lang} COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources} -ts ${_output_dir}/${_ts}
|
||||||
-target-language ${_lang} DEPENDS ${_sources})
|
-target-language ${lang} DEPENDS ${_sources})
|
||||||
|
|
||||||
if(NOT EXISTS "${_output_dir}/${_ts}")
|
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()
|
else()
|
||||||
add_custom_target(${_ts} COMMAND echo "Skipping lupdate for ${_ts}")
|
add_custom_target(${_ts} COMMAND echo "Skipping lupdate for ${_ts}")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user