Utilities: Rename special target binaries only if they exist

Before 6490529ef7, 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. :^) :^)
This commit is contained in:
Karol Kosek 2022-12-22 18:26:40 +01:00 committed by Andrew Kaster
parent bc587b89d8
commit 039bb4e22d

View file

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