Fix some Wine detection errors

This commit is contained in:
Hyunjin Song
2020-12-25 12:43:17 +09:00
parent eeec3f8664
commit a5dc3fee6a
4 changed files with 11 additions and 18 deletions

View File

@@ -3,7 +3,6 @@
#
# WINE_FOUND - System has wine
# WINE_INCLUDE_DIRS - The wine include directories
# WINE_LIBRARIES - The libraries needed to use wine
# WINE_DEFINITIONS - Compiler switches required for using wine
#
@@ -60,16 +59,16 @@ IF(WINE_CXX)
# WineHQ (/opt/wine-stable, /opt/wine-devel, /opt/wine-staging)
STRING(REGEX REPLACE "/lib64/wine/$" "/lib/wine/" WINE_32_LIBRARY_DIR "${WINE_32_LIBRARY_DIR}")
STRING(REGEX REPLACE "/lib/wine/$" "/lib64/wine/" WINE_64_LIBRARY_DIR "${WINE_64_LIBRARY_DIR}")
ELSEIF(WINE_32_LIBRARY_DIR MATCHES "/lib32/.*/wine/")
ELSEIF(WINE_32_LIBRARY_DIR MATCHES "/lib32/")
# Systems with old multilib layout
STRING(REPLACE "/lib32/" "/lib/" WINE_64_LIBRARY_DIR "${WINE_32_LIBRARY_DIR}")
ELSEIF(WINE_32_LIBRARY_DIR MATCHES "/lib64/.*/wine/")
ELSEIF(WINE_32_LIBRARY_DIR MATCHES "/lib64/")
# We need to test if the corresponding 64bit library directory is lib or lib32
STRING(REPLACE "/lib64/" "/lib32/" WINE_32_LIBRARY_DIR "${WINE_64_LIBRARY_DIR}")
IF(NOT EXISTS "${WINE_32_LIBRARY_DIR}")
STRING(REPLACE "/lib64/" "/lib/" WINE_32_LIBRARY_DIR "${WINE_64_LIBRARY_DIR}")
ENDIF()
ELSEIF(WINE_32_LIBRARY_DIR MATCHES "/lib/.*/wine/")
ELSEIF(WINE_32_LIBRARY_DIR MATCHES "/lib/")
# Test if this directory is for 32bit or 64bit
STRING(REPLACE "/lib/" "/lib32/" WINE_32_LIBRARY_DIR "${WINE_64_LIBRARY_DIR}")
IF(NOT EXISTS "${WINE_32_LIBRARY_DIR}")
@@ -89,18 +88,12 @@ FIND_PATH(WINE_INCLUDE_DIR wine/exception.h
SET(_ARCHITECTURE ${CMAKE_LIBRARY_ARCHITECTURE})
FIND_LIBRARY(WINE_LIBRARY NAMES wine
PATH_SUFFIXES wine i386-linux-gnu/wine
HINTS "${WINE_32_LIBRARY_DIR}" "${WINE_64_LIBRARY_DIR}"
)
SET(CMAKE_LIBRARY_ARCHITECTURE ${_ARCHITECTURE})
SET(WINE_INCLUDE_DIRS ${WINE_INCLUDE_DIR} )
SET(WINE_LIBRARIES ${WINE_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Wine DEFAULT_MSG WINE_CXX WINE_LIBRARIES WINE_INCLUDE_DIRS)
find_package_handle_standard_args(Wine DEFAULT_MSG WINE_CXX WINE_INCLUDE_DIRS)
mark_as_advanced(WINE_INCLUDE_DIR WINE_LIBRARY WINE_CXX WINE_BUILD)
@@ -109,8 +102,8 @@ IF(WINE_32_LIBRARY_DIR)
SET(WINE_32_FLAGS "-L${WINE_32_LIBRARY_DIR} -L${WINE_32_LIBRARY_DIR}../")
SET(WINE_32_LIBRARY_DIRS "${WINE_32_LIBRARY_DIR}:${WINE_32_LIBRARY_DIR}/..")
ELSE()
SET(WINE_32_FLAGS "-L${WINE_32_LIBRARY_DIR}")
SET(WINE_32_LIBRARY_DIRS "${WINE_32_LIBRARY_DIR}")
SET(WINE_32_FLAGS "-L${WINE_32_LIBRARY_DIR} -L${WINE_32_LIBRARY_DIR}wine/")
SET(WINE_32_LIBRARY_DIRS "${WINE_32_LIBRARY_DIR}:${WINE_32_LIBRARY_DIR}wine/")
ENDIF()
ENDIF()
@@ -119,8 +112,8 @@ IF(WINE_64_LIBRARY_DIR)
SET(WINE_64_FLAGS "-L${WINE_64_LIBRARY_DIR} -L${WINE_64_LIBRARY_DIR}../")
SET(WINE_64_LIBRARY_DIRS "${WINE_64_LIBRARY_DIR}:${WINE_64_LIBRARY_DIR}/..")
ELSE()
SET(WINE_64_FLAGS "-L${WINE_64_LIBRARY_DIR}")
SET(WINE_64_LIBRARY_DIRS "${WINE_64_LIBRARY_DIR}")
SET(WINE_64_FLAGS "-L${WINE_64_LIBRARY_DIR} -L${WINE_64_LIBRARY_DIR}wine/")
SET(WINE_64_LIBRARY_DIRS "${WINE_64_LIBRARY_DIR}:${WINE_64_LIBRARY_DIR}wine/")
ENDIF()
ENDIF()