Skip to content

Truly independent web browser

UI: Refuse to install unstripped binaries without a strip tool

Jelle Raaijmakersd8e64748f4cb
diff --git a/UI/cmake/InstallRules.cmake b/UI/cmake/InstallRules.cmake
index 15892940b6b..200fba6f264 100644
--- a/UI/cmake/InstallRules.cmake
+++ b/UI/cmake/InstallRules.cmake
@@ -14,6 +14,18 @@ endif()
set(ladybird_applications ladybird WebDriver ${ladybird_helper_processes})
+# CMake installs the binaries unstripped when it has no strip tool, or ignores the failure to run it, for instance when
+# packaging in a different environment than the build. Refuse to install anything in that case. MSVC-style toolchains
+# have no strip tool to begin with.
+if (NOT MSVC)
+ install(CODE "
+ if (CMAKE_INSTALL_DO_STRIP AND NOT EXISTS \"${CMAKE_STRIP}\")
+ message(FATAL_ERROR \"Cannot strip the installed binaries, since the strip tool '${CMAKE_STRIP}' does not exist\")
+ endif()
+ "
+ COMPONENT ladybird_Runtime)
+endif()
+
install(TARGETS ladybird WebDriver
EXPORT ladybirdTargets
RUNTIME