Форматирование кода

This commit is contained in:
Andrei Astafev 2020-04-14 12:20:01 +03:00
parent 8730aba9bf
commit 3c0fd214b9
7 changed files with 11 additions and 14 deletions

View File

@ -31,7 +31,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} ARCHIVE_OUTPUT_DIRECTORY set_target_properties(${target}_static PROPERTIES OUTPUT_NAME ${OUTNAME} ARCHIVE_OUTPUT_DIRECTORY
${CMAKE_INSTALL_LIBDIR}) ${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS ${target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()

View File

@ -11,7 +11,7 @@ function(common_target_properties target)
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()
endforeach() endforeach()

View File

@ -54,8 +54,8 @@ function(add_breathe target)
configure_file(${INDEX_MD_FILE} ${WORK_DIR}/index.md @ONLY) configure_file(${INDEX_MD_FILE} ${WORK_DIR}/index.md @ONLY)
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(TARGET ${target} PRE_BUILD add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MD_FILES} ${WORK_DIR}) ${MD_FILES} ${WORK_DIR})
endif() endif()
endif() endif()
@ -64,13 +64,12 @@ function(add_breathe target)
configure_file(${INDEX_RST_FILE} ${WORK_DIR}/index.rst @ONLY) configure_file(${INDEX_RST_FILE} ${WORK_DIR}/index.rst @ONLY)
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(TARGET ${target} PRE_BUILD add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RST_FILES} ${WORK_DIR}) ${RST_FILES} ${WORK_DIR})
endif() endif()
endif() endif()
else() else()
message(STATUS "CMLIB warning:") message(STATUS "CMLIB warning:")
add_custom_target(${target} VERBATIM add_custom_target(${target} VERBATIM COMMENT " Breathe is not found. Skipping target ${target} build")
COMMENT " Breathe is not found. Skipping target ${target} build")
endif() endif()
endfunction() endfunction()

View File

@ -37,7 +37,6 @@ function(add_doxygen target)
COMMENT "Generating API documentation with Doxygen") COMMENT "Generating API documentation with Doxygen")
else() else()
message(STATUS "CMLIB warning:") message(STATUS "CMLIB warning:")
add_custom_target(${target} VERBATIM add_custom_target(${target} VERBATIM COMMENT " Doxygen is not found. Skipping target ${target} build")
COMMENT " Doxygen is not found. Skipping target ${target} build")
endif() endif()
endfunction() endfunction()

View File

@ -18,7 +18,7 @@ function(add_format_sources target)
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} COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} add_custom_target(format-sources-uncrustify-${target} 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:")

View File

@ -4,7 +4,6 @@
# Таким образом можно выполнять команду make, даже если правила # Таким образом можно выполнять команду make, даже если правила
# сборки проекта сгенерированы для ninja. # сборки проекта сгенерированы для ninja.
if ("${CMAKE_GENERATOR}" MATCHES ".*Ninja$") if("${CMAKE_GENERATOR}" MATCHES ".*Ninja$")
file(WRITE ${CMAKE_BINARY_DIR}/Makefile ".PHONY: build\n%:\n\t@ninja \$@\nbuild:\n\t@ninja\n") file(WRITE ${CMAKE_BINARY_DIR}/Makefile ".PHONY: build\n%:\n\t@ninja \$@\nbuild:\n\t@ninja\n")
endif() endif()

View File

@ -23,7 +23,7 @@ function(qt5_translation outfiles)
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})