From 39783383142364e11ce7dc77d547e38686218ee1 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 6 Oct 2022 16:15:46 +0300 Subject: [PATCH] 2.0.0 --- MyxCMake/MyxCMakeConfig.cmake | 2 ++ MyxCMake/MyxCMakeConfigVersion.cmake | 2 +- MyxCMake/lib/DirectoriesGuards.cmake | 21 +++++++++++++++++++ MyxCMake/lib/Uninstall.cmake | 13 ++++++++++++ MyxCMake/lib/uninstall.cmake.in | 31 ++++++++++++++++++++++++++++ README.md | 2 +- VERSION | 2 +- debian/CMakeLists.txt | 2 +- debian/changelog | 2 +- myx_setup.cmake | 4 ++-- 10 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 MyxCMake/lib/Uninstall.cmake create mode 100644 MyxCMake/lib/uninstall.cmake.in diff --git a/MyxCMake/MyxCMakeConfig.cmake b/MyxCMake/MyxCMakeConfig.cmake index 27b091f..25eba8f 100644 --- a/MyxCMake/MyxCMakeConfig.cmake +++ b/MyxCMake/MyxCMakeConfig.cmake @@ -47,6 +47,8 @@ include(${MYX_CMAKE_LIB_DIR}/doc/Doxygen.cmake) include(${MYX_CMAKE_LIB_DIR}/generators/PrivateConfigHeader.cmake) include(${MYX_CMAKE_LIB_DIR}/generators/GitInfoHeader.cmake) +include(${MYX_CMAKE_LIB_DIR}/Uninstall.cmake) + unset(MYX_CMAKE_SOURCE_DIR) unset(MYX_CMAKE_BACKPORTS_DIR) unset(MYX_CMAKE_LIB_DIR) diff --git a/MyxCMake/MyxCMakeConfigVersion.cmake b/MyxCMake/MyxCMakeConfigVersion.cmake index cd17f81..670e725 100644 --- a/MyxCMake/MyxCMakeConfigVersion.cmake +++ b/MyxCMake/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "1.99.99") +set(MYX_CMAKE_PACKAGE_VERSION "2.0.0") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/MyxCMake/lib/DirectoriesGuards.cmake b/MyxCMake/lib/DirectoriesGuards.cmake index ce679be..57b9531 100644 --- a/MyxCMake/lib/DirectoriesGuards.cmake +++ b/MyxCMake/lib/DirectoriesGuards.cmake @@ -46,6 +46,27 @@ if(project_binary_dir STREQUAL project_source_dir) "Myx: Cannot build in source directory ${CMAKE_SOURCE_DIR}") endif() +# Очистка от сгенерированных файлов +file(GLOB_RECURSE cmakelists_files RELATIVE ${cmake_source_dir} CMakeLists.txt) +foreach(it ${cmakelists_files}) + get_filename_component(file ${it} REALPATH) + get_filename_component(dir ${file} DIRECTORY) + file(REMOVE_RECURSE + ${dir}/.cmake + ${dir}/CMakeFiles) + file(REMOVE + ${dir}/CMakeFiles + ${dir}/CMakeCache.txt + ${dir}/cmake_install.cmake + ${dir}/compile_commands.json + ${dir}/Makefile + ${dir}/.ninja_deps + ${dir}/.ninja_logs + ${dir}/build.ninja + ${dir}/rules.ninja) +endforeach() + +unset(cmakelists_files) unset(cmake_source_dir) unset(cmake_binary_dir) unset(project_source_dir) diff --git a/MyxCMake/lib/Uninstall.cmake b/MyxCMake/lib/Uninstall.cmake new file mode 100644 index 0000000..f5082a6 --- /dev/null +++ b/MyxCMake/lib/Uninstall.cmake @@ -0,0 +1,13 @@ +#[=======================================================================[.rst: +Цель для удаления файлов, установленных выполнением цели `install`. +Если при установке использовалась переменная `DESTDIR`, то при удалении +файлов нужно указать то же значение. +#]=======================================================================] + +include_guard(GLOBAL) + +if(NOT TARGET uninstall) + configure_file(${CMAKE_CURRENT_LIST_DIR}/uninstall.cmake.in + ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) + add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake) +endif() diff --git a/MyxCMake/lib/uninstall.cmake.in b/MyxCMake/lib/uninstall.cmake.in new file mode 100644 index 0000000..0f747a1 --- /dev/null +++ b/MyxCMake/lib/uninstall.cmake.in @@ -0,0 +1,31 @@ +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) + +# Удаление пустых каталогов +foreach(_file ${files}) + set(_res 0) + while(_res EQUAL 0) + get_filename_component(_file ${_file} DIRECTORY) + execute_process(COMMAND rmdir ${_file} RESULT_VARIABLE _res OUTPUT_QUIET ERROR_QUIET) + endwhile() +endforeach() + diff --git a/README.md b/README.md index bbdb24d..5123cb8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Установка В корневом каталоге проекта создать каталог `cmake` и распаковать в него -[архив](../../../releases/download/1.99.99/myx-cmake-local-1.99.99.tar.xz ). +[архив](../../../releases/download/2.0.0/myx-cmake-local-2.0.0.tar.xz ). ## Использование diff --git a/VERSION b/VERSION index da2709e..227cea2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.99.99 +2.0.0 diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index 0af855d..8c8fa7f 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.99 LANGUAGES) +project(myx-cmake VERSION 2.0.0 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/debian/changelog b/debian/changelog index c111910..6837552 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -myx-cmake (1.99.99) unstable; urgency=medium +myx-cmake (2.0.0) unstable; urgency=medium * New version. diff --git a/myx_setup.cmake b/myx_setup.cmake index ab11dbd..a0956d5 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.99 REQUIRED CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH) + find_package(MyxCMake 2.0.0 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.99 REQUIRED) + find_package(MyxCMake 2.0.0 REQUIRED) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)