Форматирование кода
This commit is contained in:
parent
16665a5a6f
commit
54cf15c7e0
@ -38,7 +38,7 @@ with section("parse"):
|
|||||||
with section("format"):
|
with section("format"):
|
||||||
|
|
||||||
# How wide to allow formatted cmake files
|
# How wide to allow formatted cmake files
|
||||||
line_width = 90
|
line_width = 110
|
||||||
|
|
||||||
# How many spaces to tab for indent
|
# How many spaces to tab for indent
|
||||||
tab_size = 2
|
tab_size = 2
|
||||||
@ -204,7 +204,7 @@ with section("lint"):
|
|||||||
min_statement_spacing = 1
|
min_statement_spacing = 1
|
||||||
|
|
||||||
# Require no more than this many newlines between statements
|
# Require no more than this many newlines between statements
|
||||||
max_statement_spacing = 1
|
max_statement_spacing = 2
|
||||||
max_returns = 6
|
max_returns = 6
|
||||||
max_branches = 12
|
max_branches = 12
|
||||||
max_arguments = 5
|
max_arguments = 5
|
||||||
|
@ -6,8 +6,7 @@ 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}")
|
||||||
"${CMLIB_PROJECT_NAME_LOWER}_${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,16 +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 ${LCOV_EXE} --test-name ${_target} --output "${_target}.lcov" --capture
|
COMMAND ${LCOV_EXE} --test-name ${_target} --output "${_target}.lcov" --capture --directory
|
||||||
--directory ${CMAKE_BINARY_DIR})
|
${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()
|
||||||
|
@ -16,33 +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 ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} OUTPUT_NAME
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
|
||||||
${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()
|
||||||
|
@ -17,10 +17,8 @@ function(common_target_properties Name)
|
|||||||
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(
|
target_compile_definitions(
|
||||||
${Name}
|
${Name}
|
||||||
@ -57,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
|
||||||
@ -81,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)
|
||||||
@ -114,8 +107,8 @@ function(common_target_properties Name)
|
|||||||
ANALYSIS)
|
ANALYSIS)
|
||||||
endif()
|
endif()
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
${Name}
|
${Name}
|
||||||
${__visibility}
|
${__visibility}
|
||||||
"TARGET_LSB_ID_${LSB_DISTRIBUTOR_ID}"
|
"TARGET_LSB_ID_${LSB_DISTRIBUTOR_ID}"
|
||||||
"TARGET_LSB_CODENAME_${LSB_CODENAME}")
|
"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)
|
||||||
|
@ -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})
|
||||||
@ -55,8 +54,8 @@ function(add_breathe_target)
|
|||||||
add_custom_target(
|
add_custom_target(
|
||||||
${_BREATHE_TARGET_NAME}
|
${_BREATHE_TARGET_NAME}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
COMMAND ${SPHINX_EXECUTABLE} -q -b html -c ${WORK_DIR} -d ${WORK_DIR}/cache
|
COMMAND ${SPHINX_EXECUTABLE} -q -b html -c ${WORK_DIR} -d ${WORK_DIR}/cache ${WORK_DIR}
|
||||||
${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")
|
||||||
|
|
||||||
set(INDEX_MD_FILE ${CMAKE_SOURCE_DIR}/doc/breathe/index.md.in)
|
set(INDEX_MD_FILE ${CMAKE_SOURCE_DIR}/doc/breathe/index.md.in)
|
||||||
|
@ -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)
|
||||||
|
@ -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(
|
set_source_files_properties(${_source_file} PROPERTIES COMPILE_FLAGS "${_source_file_cxx_flags_string}")
|
||||||
${_source_file} PROPERTIES COMPILE_FLAGS "${_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)
|
||||||
@ -70,7 +69,7 @@ macro(remove_flag_from_file _target _file _flag)
|
|||||||
list(REMOVE_ITEM _cached_${_target}_${_file}_cxx_flags ${_flag})
|
list(REMOVE_ITEM _cached_${_target}_${_file}_cxx_flags ${_flag})
|
||||||
string(REPLACE ";" " " _cached_${_target}_${_file}_cxx_flags_string
|
string(REPLACE ";" " " _cached_${_target}_${_file}_cxx_flags_string
|
||||||
"${_cached_${_target}_${_file}_cxx_flags}")
|
"${_cached_${_target}_${_file}_cxx_flags}")
|
||||||
set_source_files_properties(
|
set_source_files_properties(${_file} PROPERTIES COMPILE_FLAGS
|
||||||
${_file} PROPERTIES COMPILE_FLAGS "${_cached_${_target}_${_file}_cxx_flags_string}")
|
"${_cached_${_target}_${_file}_cxx_flags_string}")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
@ -13,8 +13,8 @@ function(add_format_sources)
|
|||||||
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}
|
add_custom_target(format-sources-dos2unix-${_target} COMMAND ${DOS2UNIX_EXE} ${DOS2UNIX_OPTS} ${_sources})
|
||||||
COMMAND ${DOS2UNIX_EXE} ${DOS2UNIX_OPTS} ${_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:")
|
||||||
|
@ -20,13 +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(COMMAND ${_lsb_release_executable} -si
|
execute_process(COMMAND ${_lsb_release_executable} -si OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
|
||||||
OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
execute_process(COMMAND ${_lsb_release_executable} -sc
|
execute_process(COMMAND ${_lsb_release_executable} -sc OUTPUT_VARIABLE LSB_CODENAME
|
||||||
OUTPUT_VARIABLE LSB_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
execute_process(COMMAND ${_lsb_release_executable} -sr
|
execute_process(COMMAND ${_lsb_release_executable} -sr OUTPUT_VARIABLE LSB_RELEASE
|
||||||
OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -61,17 +61,15 @@ 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")
|
||||||
set(_FILE_OFFSET_BITS
|
set(_FILE_OFFSET_BITS
|
||||||
@ -82,9 +80,8 @@ 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")
|
||||||
set(_LARGE_FILES
|
set(_LARGE_FILES
|
||||||
@ -95,9 +92,8 @@ 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")
|
||||||
set(_LARGEFILE_SOURCE
|
set(_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
|
||||||
|
@ -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()
|
||||||
|
@ -22,13 +22,11 @@ function(qt5_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(qt5_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()
|
||||||
|
Loading…
Reference in New Issue
Block a user