From 496d82d6cf9fc6b402bb648bfe6ea03054d5277b Mon Sep 17 00:00:00 2001 From: SteelT Date: Tue, 2 Jan 2024 06:10:01 -0500 Subject: [PATCH] CMake cleanup and fixes (#1644) * Replace calls to depercated exec_program with execute_process when using uninstall target * Add comment for uninstall target * Only install slade.pk3 if BUILD_PK3 is enabled --- cmake/cmake_uninstall.cmake.in | 8 ++++---- cmake/unix.cmake | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in index 4457d1bd7..0cb64893e 100644 --- a/cmake/cmake_uninstall.cmake.in +++ b/cmake/cmake_uninstall.cmake.in @@ -7,10 +7,10 @@ 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}\"" + execute_process( + COMMAND "${CMAKE_COMMAND}" -E remove "$ENV{DESTDIR}${file}" OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval + RESULT_VARIABLE rm_retval ) if(NOT "${rm_retval}" STREQUAL 0) message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") @@ -18,4 +18,4 @@ foreach(file ${files}) 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) \ No newline at end of file +endforeach(file) diff --git a/cmake/unix.cmake b/cmake/unix.cmake index eb82679e8..94b809b09 100644 --- a/cmake/unix.cmake +++ b/cmake/unix.cmake @@ -215,9 +215,11 @@ else(APPLE) RUNTIME DESTINATION bin ) +if (BUILD_PK3) install(FILES "${SLADE_OUTPUT_DIR}/slade.pk3" DESTINATION share/slade3 ) +endif() install(FILES "${PROJECT_SOURCE_DIR}/dist/res/logo_icon.png" DESTINATION share/icons/ @@ -242,7 +244,7 @@ if(NOT TARGET uninstall) IMMEDIATE @ONLY) add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake COMMENT "Uninstall the project...") endif() if (NOT NO_COTIRE)