diff --git a/MyxCMake/MyxCMakeConfig.cmake b/MyxCMake/MyxCMakeConfig.cmake index 067f5a2..27b091f 100644 --- a/MyxCMake/MyxCMakeConfig.cmake +++ b/MyxCMake/MyxCMakeConfig.cmake @@ -41,7 +41,7 @@ include(${MYX_CMAKE_LIB_DIR}/AddLibrary.cmake) include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake) include(${MYX_CMAKE_LIB_DIR}/Qt5TargetSetup.cmake) -include(${MYX_CMAKE_LIB_DIR}/Uncrustify.cmake) +include(${MYX_CMAKE_LIB_DIR}/uncrustify/Uncrustify.cmake) include(${MYX_CMAKE_LIB_DIR}/doc/Doxygen.cmake) include(${MYX_CMAKE_LIB_DIR}/generators/PrivateConfigHeader.cmake) diff --git a/MyxCMake/MyxCMakeConfigVersion.cmake b/MyxCMake/MyxCMakeConfigVersion.cmake index f8edb84..cd17f81 100644 --- a/MyxCMake/MyxCMakeConfigVersion.cmake +++ b/MyxCMake/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "1.99.98") +set(MYX_CMAKE_PACKAGE_VERSION "1.99.99") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/MyxCMake/lib/Uncrustify.cmake b/MyxCMake/lib/uncrustify/Uncrustify.cmake similarity index 67% rename from MyxCMake/lib/Uncrustify.cmake rename to MyxCMake/lib/uncrustify/Uncrustify.cmake index 5c57896..489dbf8 100644 --- a/MyxCMake/lib/Uncrustify.cmake +++ b/MyxCMake/lib/uncrustify/Uncrustify.cmake @@ -1,47 +1,19 @@ include_guard(GLOBAL) +if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + set(MYX_CMAKE_LIB_UNCRUSTIFY_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") +endif() + find_program(UNCRUSTIFY_EXE NAMES uncrustify) -if(UNCRUSTIFY_EXE) - if(NOT EXISTS ${PROJECT_BINARY_DIR}/uncrustify-classheader.txt) - file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-classheader.txt CONTENT -"/** - * @class $(fclass) - * @brief TODO - * @details TODO - */") - endif() - - if(NOT EXISTS ${PROJECT_BINARY_DIR}/uncrustify-filefooter.txt) - file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-filefooter.txt CONTENT - "// EOF $(filename)") - endif() - - if(NOT EXISTS ${PROJECT_BINARY_DIR}/uncrustify-fileheader.txt) - file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-fileheader.txt CONTENT -"/** - * @file $(filename) - * @brief TODO - * @details TODO - */") - endif() - - if(NOT EXISTS ${PROJECT_BINARY_DIR}/uncrustify-funcheader.txt) - file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-funcheader.txt CONTENT -"/** - * @fn $(fclass)::$(function) - * $(javaparam) - * @details TODO - */") - endif() -endif() - - function(myx_uncrustify target) + if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_UNCRUSTIFY_DIR_BACKPORT}) + endif() + set(options) set(oneValueArgs CONFIG) set(multiValueArgs) - cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(NOT ARG_CONFIG) @@ -61,6 +33,8 @@ function(myx_uncrustify target) return() endif() + + if(NOT TARGET myx-uncrustify) add_custom_target(myx-uncrustify) endif() @@ -97,10 +71,10 @@ function(myx_uncrustify target) add_custom_target(${target}-uncrustify-append-comments DEPENDS ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} - --set cmt_insert_class_header=${PROJECT_BINARY_DIR}/uncrustify-classheader.txt - --set cmt_insert_file_footer=${PROJECT_BINARY_DIR}/uncrustify-filefooter.txt - --set cmt_insert_file_header=${PROJECT_BINARY_DIR}/uncrustify-fileheader.txt - --set cmt_insert_func_header=${PROJECT_BINARY_DIR}/uncrustify-funcheader.txt + --set cmt_insert_class_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/classheader.txt + --set cmt_insert_file_footer=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/filefooter.txt + --set cmt_insert_file_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/fileheader.txt + --set cmt_insert_func_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/funcheader.txt --set cmt_insert_before_ctor_dtor=true --mtime ${src}) # cmake-format: on diff --git a/MyxCMake/lib/uncrustify/classheader.txt b/MyxCMake/lib/uncrustify/classheader.txt new file mode 100644 index 0000000..c82b16e --- /dev/null +++ b/MyxCMake/lib/uncrustify/classheader.txt @@ -0,0 +1,5 @@ +/** + * @class $(fclass) + * @brief TODO + * @details TODO + */ diff --git a/MyxCMake/lib/uncrustify/filefooter.txt b/MyxCMake/lib/uncrustify/filefooter.txt new file mode 100644 index 0000000..56a3f8b --- /dev/null +++ b/MyxCMake/lib/uncrustify/filefooter.txt @@ -0,0 +1 @@ +// EOF $(filename) diff --git a/MyxCMake/lib/uncrustify/fileheader.txt b/MyxCMake/lib/uncrustify/fileheader.txt new file mode 100644 index 0000000..c5b9665 --- /dev/null +++ b/MyxCMake/lib/uncrustify/fileheader.txt @@ -0,0 +1,6 @@ +// -*- C++ -*- +/** + * @file $(filename) + * @brief TODO + * @details TODO + */ diff --git a/MyxCMake/lib/uncrustify/funcheader.txt b/MyxCMake/lib/uncrustify/funcheader.txt new file mode 100644 index 0000000..3fb62e7 --- /dev/null +++ b/MyxCMake/lib/uncrustify/funcheader.txt @@ -0,0 +1,5 @@ +/** + * @fn $(fclass)::$(function) + * $(javaparam) + * @details TODO + */ diff --git a/README.md b/README.md index b3cd98e..bbdb24d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Установка В корневом каталоге проекта создать каталог `cmake` и распаковать в него -[архив](../../../releases/download/1.99.98/myx-cmake-local-1.99.98.tar.xz ). +[архив](../../../releases/download/1.99.99/myx-cmake-local-1.99.99.tar.xz ). ## Использование diff --git a/VERSION b/VERSION index 168576e..da2709e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.99.98 +1.99.99 diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index ab36233..0af855d 100644 --- a/debian/CMakeLists.txt +++ b/debian/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.6 FATAL_ERROR) -project(myx-cmake VERSION 1.99.98 LANGUAGES) +project(myx-cmake VERSION 1.99.99 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/debian/changelog b/debian/changelog index c4b5d84..c111910 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -myx-cmake (1.99.98) unstable; urgency=medium +myx-cmake (1.99.99) unstable; urgency=medium * New version. diff --git a/myx_setup.cmake b/myx_setup.cmake index 899867c..ab11dbd 100644 --- a/myx_setup.cmake +++ b/myx_setup.cmake @@ -20,11 +20,11 @@ if(MYX_CMAKE_DIR) set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR}) endif() if(DEFINED ENV{MYX_CMAKE_DIR}) - find_package(MyxCMake 1.99.98 REQUIRED CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH) + find_package(MyxCMake 1.99.99 REQUIRED CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() if(MYX_CMAKE_USE_SYSTEM) - find_package(MyxCMake 1.99.98 REQUIRED) + find_package(MyxCMake 1.99.99 REQUIRED) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)