From 039bb4e22da5012eefbb7f02c5f79fc6e9dede0f Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Thu, 22 Dec 2022 18:26:40 +0100 Subject: [PATCH] Utilities: Rename special target binaries only if they exist Before 6490529ef76ebf37f9e58bf76c6271be6842afa1, all programs in the SPECIAL_TARGETS list were built because they didn't have an EXCLUDE_FROM_ALL property set. That commit set the property for all targets, but because of this, the minimal "Required" build configuration no longer built, as CMake failed to rename every special target. Even the not built ones. This commit makes the rename action run only if the executable exists, which makes us build Serenity without the `install` utility, and also by using the minimal configuration set. :^) :^) --- Userland/Utilities/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index 21e1d1534e..d05c679111 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -46,7 +46,10 @@ foreach(CMD_SRC ${CMD_SOURCES}) install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin OPTIONAL) if (CMD_NAME IN_LIST SPECIAL_TARGETS) - install(CODE "file(RENAME ${CMAKE_INSTALL_PREFIX}/bin/${CMD_NAME}-bin ${CMAKE_INSTALL_PREFIX}/bin/${CMD_NAME})") + install(CODE + "if (EXISTS ${CMAKE_INSTALL_PREFIX}/bin/${CMD_NAME}-bin) + file(RENAME ${CMAKE_INSTALL_PREFIX}/bin/${CMD_NAME}-bin ${CMAKE_INSTALL_PREFIX}/bin/${CMD_NAME}) + endif()") endif() endforeach()