CMake: Explicitly mark LibC TARGET custom commands as POST_BUILD

This avoids a warning for CMake policy CMP0175, which is new with CMake
3.31. The warning is as follows:

Exactly one of PRE_BUILD, PRE_LINK, or POST_BUILD must be given.
Assuming POST_BUILD to preserve backward compatibility.

To preserve behavior, mark these as POST_BUILD. It might not be the
ideal way to have the custom commands run, but it is behavior-preserving
This commit is contained in:
Andrew Kaster 2024-12-26 10:28:03 -07:00 committed by Sönke Holz
parent e1e44a820d
commit 8bfca36415

View file

@ -234,7 +234,7 @@ endforeach()
add_library(crt0 STATIC crt0.cpp)
target_link_libraries(crt0 PRIVATE NoCoverage)
add_custom_command(
TARGET crt0
TARGET crt0 POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_OBJECTS:crt0> ${CMAKE_INSTALL_PREFIX}/usr/lib/crt0.o
)
@ -244,21 +244,21 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_library(crt0_shared STATIC crt0_shared.cpp)
target_link_libraries(crt0_shared PRIVATE NoCoverage)
add_custom_command(
TARGET crt0_shared
TARGET crt0_shared POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_OBJECTS:crt0_shared> ${CMAKE_INSTALL_PREFIX}/usr/lib/crt0_shared.o
)
add_library(crti STATIC arch/${SERENITY_ARCH}/crti.S)
target_link_libraries(crti PRIVATE NoCoverage)
add_custom_command(
TARGET crti
TARGET crti POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_OBJECTS:crti> ${CMAKE_INSTALL_PREFIX}/usr/lib/crti.o
)
add_library(crtn STATIC arch/${SERENITY_ARCH}/crtn.S)
target_link_libraries(crtn PRIVATE NoCoverage)
add_custom_command(
TARGET crtn
TARGET crtn POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_OBJECTS:crtn> ${CMAKE_INSTALL_PREFIX}/usr/lib/crtn.o
)
endif()