This commit is contained in:
Andrei Astafev 2022-10-06 16:15:46 +03:00
parent 900bfe307b
commit 3978338314
10 changed files with 74 additions and 7 deletions

View File

@ -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/PrivateConfigHeader.cmake)
include(${MYX_CMAKE_LIB_DIR}/generators/GitInfoHeader.cmake) include(${MYX_CMAKE_LIB_DIR}/generators/GitInfoHeader.cmake)
include(${MYX_CMAKE_LIB_DIR}/Uninstall.cmake)
unset(MYX_CMAKE_SOURCE_DIR) unset(MYX_CMAKE_SOURCE_DIR)
unset(MYX_CMAKE_BACKPORTS_DIR) unset(MYX_CMAKE_BACKPORTS_DIR)
unset(MYX_CMAKE_LIB_DIR) unset(MYX_CMAKE_LIB_DIR)

View File

@ -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) if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE)
else() else()

View File

@ -46,6 +46,27 @@ if(project_binary_dir STREQUAL project_source_dir)
"Myx: Cannot build in source directory ${CMAKE_SOURCE_DIR}") "Myx: Cannot build in source directory ${CMAKE_SOURCE_DIR}")
endif() 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_source_dir)
unset(cmake_binary_dir) unset(cmake_binary_dir)
unset(project_source_dir) unset(project_source_dir)

View File

@ -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()

View File

@ -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()

View File

@ -3,7 +3,7 @@
## Установка ## Установка
В корневом каталоге проекта создать каталог `cmake` и распаковать в него В корневом каталоге проекта создать каталог `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 ).
## Использование ## Использование

View File

@ -1 +1 @@
1.99.99 2.0.0

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.6 FATAL_ERROR) 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) include(GNUInstallDirs)
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
myx-cmake (1.99.99) unstable; urgency=medium myx-cmake (2.0.0) unstable; urgency=medium
* New version. * New version.

View File

@ -20,11 +20,11 @@ if(MYX_CMAKE_DIR)
set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR}) set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR})
endif() endif()
if(DEFINED ENV{MYX_CMAKE_DIR}) 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} ===") myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
else() else()
if(MYX_CMAKE_USE_SYSTEM) 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} ===") myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
else() else()
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake) include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)