Skip to content

Commit

Permalink
CMake cleanup and fixes (#1644)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
SteelT1 authored Jan 2, 2024
1 parent a283ade commit 496d82d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmake/cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ 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}")
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)
endforeach(file)
4 changes: 3 additions & 1 deletion cmake/unix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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)
Expand Down

0 comments on commit 496d82d

Please # to comment.