SDL: fs: Follow up to the initial getexecpath() support

From 5723590ffc9158fccdf3b14e0b59d2bf14e6a9c1 Mon Sep 17 00:00:00 2001
From: Brad Smith <[EMAIL REDACTED]>
Date: Fri, 11 Sep 2026 02:09:13 -0400
Subject: [PATCH] fs: Follow up to the initial getexecpath() support

- Add missing CMake piece
- Fix logic to quiet warning
---
 include/build_config/SDL_build_config.h.cmake | 1 +
 src/filesystem/unix/SDL_sysfilesystem.c       | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake
index 4507d436153bf..7c2f1162be222 100644
--- a/include/build_config/SDL_build_config.h.cmake
+++ b/include/build_config/SDL_build_config.h.cmake
@@ -73,6 +73,7 @@
 #cmakedefine HAVE_DLOPEN 1
 #cmakedefine HAVE_MALLOC 1
 #cmakedefine HAVE_FDATASYNC 1
+#cmakedefine HAVE_GETEXECPATH 1
 #cmakedefine HAVE_GETENV 1
 #cmakedefine HAVE_GETHOSTNAME 1
 #cmakedefine HAVE_SETENV 1
diff --git a/src/filesystem/unix/SDL_sysfilesystem.c b/src/filesystem/unix/SDL_sysfilesystem.c
index d24dff6169b34..82fc77fb400cf 100644
--- a/src/filesystem/unix/SDL_sysfilesystem.c
+++ b/src/filesystem/unix/SDL_sysfilesystem.c
@@ -71,7 +71,7 @@ static char *readSymLink(const char *path)
     return NULL;
 }
 
-#ifdef SDL_PLATFORM_OPENBSD
+#if defined(SDL_PLATFORM_OPENBSD) && !defined(HAVE_GETEXECPATH)
 static char *search_path_for_binary(const char *bin)
 {
     const char *envr_real = SDL_getenv("PATH");