game-music-emu: CMake: Fixed the wrong header search result

From ec54b2b63a4a186644cd298710bf59d7e876bf00 Mon Sep 17 00:00:00 2001
From: Wohlstand <[EMAIL REDACTED]>
Date: Fri, 6 Oct 2023 00:30:00 +0300
Subject: [PATCH] CMake: Fixed the wrong header search result

---
 cmake/FindUNRAR.cmake | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/cmake/FindUNRAR.cmake b/cmake/FindUNRAR.cmake
index 5eafdcc..462cd2b 100644
--- a/cmake/FindUNRAR.cmake
+++ b/cmake/FindUNRAR.cmake
@@ -21,16 +21,18 @@ set(UNRAR_NAMES_DEBUG unrar)
 
 # Try each search configuration.
 foreach(search ${_UNRAR_SEARCHES})
-  find_path(UNRAR_INCLUDE_DIR NAMES unrar.h ${${search}} PATH_SUFFIXES include unrar)
+  find_path(UNRAR_INCLUDE_DIR_UNRAR_H NAMES unrar.h ${${search}} PATH_SUFFIXES include unrar)
 endforeach()
-if(UNRAR_INCLUDE_DIR)
+if(UNRAR_INCLUDE_DIR_UNRAR_H)
   set(RAR_HDR_UNRAR_H 1)
+  set(UNRAR_INCLUDE_DIR ${UNRAR_INCLUDE_DIR_UNRAR_H})
 else()
   foreach(search ${_UNRAR_SEARCHES})
-    find_path(UNRAR_INCLUDE_DIR NAMES dll.hpp ${${search}} PATH_SUFFIXES include unrar)
+    find_path(UNRAR_INCLUDE_DIR_DLL_HPP NAMES dll.hpp ${${search}} PATH_SUFFIXES include unrar)
   endforeach()
-  if(UNRAR_INCLUDE_DIR)
+  if(UNRAR_INCLUDE_DIR_DLL_HPP)
     set(RAR_HDR_DLL_HPP 1)
+    set(UNRAR_INCLUDE_DIR ${UNRAR_INCLUDE_DIR_DLL_HPP})
   endif()
 endif()
 
@@ -48,7 +50,7 @@ endif()
 unset(UNRAR_NAMES)
 unset(UNRAR_NAMES_DEBUG)
 
-mark_as_advanced(UNRAR_INCLUDE_DIR)
+mark_as_advanced(UNRAR_INCLUDE_DIR UNRAR_INCLUDE_DIR_UNRAR_H UNRAR_INCLUDE_DIR_DLL_HPP)
 
 if(UNRAR_INCLUDE_DIR AND EXISTS "${UNRAR_INCLUDE_DIR}/version.hpp")
     file(STRINGS "${UNRAR_INCLUDE_DIR}/version.hpp" UNRAR_H REGEX "^#define RARVER_.*$")