From 0c7f8be44e783bec93e1f0d591f0740441c63e12 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Wed, 25 Jan 2023 12:42:42 -0500 Subject: [PATCH] Restore rm_precomp_header custom target for makefile / ninja command line builds --- neo/CMakeLists.txt | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index f9c7b6d3..e1d81c01 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -1817,13 +1817,24 @@ else() set(remove_command "rm") endif() - # make sure precompiled header is deleted after executable is compiled - add_custom_command(TARGET RBDoom3BFG POST_BUILD - COMMAND ${remove_command} "idlib/precompiled.h.gch" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "remove idlib/precompiled.h.gch" - ) - endif() + # delete precompiled header file after executable is compiled: command line build case + if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + add_custom_target(rm_precomp_header ALL + COMMAND ${remove_command} "idlib/precompiled.h.gch" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "remove idlib/precompiled.h.gch" + ) + add_dependencies(rm_precomp_header RBDoom3BFG) + + # delete precompiled header file after executable is compiled: IDE build case (e.g. Xcode) + else() + add_custom_command(TARGET RBDoom3BFG POST_BUILD + COMMAND ${remove_command} "idlib/precompiled.h.gch" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "remove idlib/precompiled.h.gch" + ) + endif() + endif() if(NOT WIN32) if(NOT APPLE)