From dbcf4840062ca8ed1a73ae6f13bdeda564dc5d3f Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Tue, 19 Nov 2019 08:36:12 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=92=D1=8B=D0=B7=D0=BE=D0=B2=20dos2unix?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=B8=D1=81?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibFormatSources.cmake | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/CMLibFormatSources.cmake b/CMLibFormatSources.cmake index d9748b1..91458ca 100644 --- a/CMLibFormatSources.cmake +++ b/CMLibFormatSources.cmake @@ -1,24 +1,37 @@ -function(add_uncrustify_format) +function(add_format_sources) list(GET ARGN 0 _target) set(_sources ${ARGN}) list(REMOVE_AT _sources 0) + if(NOT TARGET format-sources) + add_custom_target(format-sources) + endif() + find_program(UNCRUSTIFY_EXE NAMES uncrustify) if(UNCRUSTIFY_EXE) - if(NOT TARGET uncrustify-format) - add_custom_target(uncrustify-format) - endif() - list(APPEND OPTS + list(APPEND UNCRUSTIFY_OPTS -lCPP --replace --no-backup) if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg) - list(APPEND OPTS -c ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg) + list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg) endif() - add_custom_target(uncrustify-format-${_target} COMMAND ${UNCRUSTIFY_EXE} ${OPTS} ${_sources}) - add_dependencies(uncrustify-format uncrustify-format-${_target}) + add_custom_target(format-sources-uncrustify-${_target} COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} ${_sources}) + add_dependencies(format-sources format-sources-uncrustify-${_target}) else() message(STATUS "CMLIB warning:") - message(STATUS " Uncrustify is not found") + message(STATUS " uncrustify executable is not found") + endif() + + find_program(DOS2UNIX_EXE NAMES dos2unix) + if(DOS2UNIX_EXE) + list(APPEND DOS2UNIX_OPTS + -k + -r) + add_custom_target(format-sources-dos2unix-${_target} COMMAND ${DOS2UNIX_EXE} ${OPTS} ${_sources}) + add_dependencies(format-sources format-sources-dos2unix-${_target}) + else() + message(STATUS "CMLIB warning:") + message(STATUS " dos2unix executable is not found") endif() endfunction() From 9002b99e3ec498c0cd431a985807b1df81590cd0 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Tue, 19 Nov 2019 09:26:05 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=94=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c235a0..97350cc 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,19 @@ В каталоге проекта выполнить команду ```sh -git submodule add ssh://git@host/user/cmlib cmake/cmlib +git submodule add git@host:user/cmlib cmake/cmlib ``` заменив `host` и `user` на нужные значения. +Кроме того желательно установить библиотеки `find` и `generators`. + +```sh +git submodule add git@host:user/cmake-find cmake/find +git submodule add git@host:user/cmake-generators cmake/generators +``` + + ## Использование В основном для проекта файле `CMakeLists.txt` добавить: @@ -49,4 +57,3 @@ set(CPACK_SOURCE_IGNORE_FILES \\\\..*\\\\.swp$) ``` -