Warning, /graphics/digikam/project/bundles/3rdparty/ext_lensfun/lensfun_fixbuild_vcpkg.patch is written in an unsupported language. File is not indexed.

0001 diff --git a/CMakeLists.txt b/CMakeLists.txt
0002 index 75f0ae6a..0bf05711 100644
0003 --- a/CMakeLists.txt
0004 +++ b/CMakeLists.txt
0005 @@ -94,7 +94,7 @@ IF(BUILD_FOR_SSE2)
0006    ENDIF()
0007  ENDIF()
0008  
0009 -IF(WIN32)
0010 +IF(0)
0011    # base path for searching for glib on windows
0012    IF(NOT GLIB2_BASE_DIR)
0013      SET(GLIB2_BASE_DIR "${SOURCE_BASE_DIR}/glib-2.28.1" CACHE STRING "Base path of glib2 dir." FORCE)
0014 @@ -116,7 +116,7 @@ ELSE()
0015    FIND_PACKAGE(GLIB2 REQUIRED)
0016  ENDIF()
0017  
0018 -INCLUDE_DIRECTORIES(SYSTEM ${GLIB2_INCLUDE_DIRS})
0019 +INCLUDE_DIRECTORIES(SYSTEM ${GLIB2_INCLUDE_DIR})
0020  LINK_DIRECTORIES(${GLIB2_LIBRARY_DIRS})
0021  
0022  
0023 @@ -193,7 +193,7 @@ IF(BUILD_DOC)
0024    ADD_SUBDIRECTORY(docs)
0025  ENDIF()
0026  
0027 -IF(WIN32 AND NOT BUILD_STATIC)
0028 +IF(0)
0029    FIND_FILE(GLIB2_DLL
0030              NAMES glib-2.0-0.dll glib-2.dll glib-2-vs9.dll
0031              PATHS "${GLIB2_BASE_DIR}/bin"
0032 @@ -221,7 +221,7 @@ MESSAGE(STATUS "Build with support for SSE2: ${BUILD_FOR_SSE2}")
0033  MESSAGE(STATUS "Install helper scripts: ${INSTALL_HELPER_SCRIPTS}")
0034  MESSAGE(STATUS "\nInstall prefix: ${CMAKE_INSTALL_PREFIX}")
0035  MESSAGE(STATUS "\nUsing: ")
0036 -MESSAGE(STATUS "GLIB2 include dir: ${GLIB2_INCLUDE_DIRS}")
0037 +MESSAGE(STATUS "GLIB2 include dir: ${GLIB2_INCLUDE_DIR}")
0038  MESSAGE(STATUS "GLIB2 library: ${GLIB2_LIBRARIES}")
0039  IF(GLIB2_DLL)
0040  MESSAGE(STATUS "GLIB2 DLL: ${GLIB2_DLL}")
0041 diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake
0042 index db07ba27..f6bad1b1 100644
0043 --- a/cmake/modules/FindGLIB2.cmake
0044 +++ b/cmake/modules/FindGLIB2.cmake
0045 @@ -1,70 +1,51 @@
0046 -IF (NOT MSVC)
0047 -    FIND_PACKAGE(PkgConfig)
0048 -    PKG_SEARCH_MODULE(GLIB2 glib-2.0)
0049 -    IF(WIN32 AND NOT BUILD_STATIC)
0050 -        FIND_FILE(GLIB2_DLL 
0051 -                NAMES glib-2.dll glib-2-vs9.dll libglib-2.0-0.dll
0052 -                PATHS "${GLIB2_LIBRARY_DIRS}/../bin"
0053 -                NO_SYSTEM_ENVIRONMENT_PATH)
0054 -    ENDIF()
0055 -ENDIF()
0056 +# - Try to find the GLIB2 libraries
0057 +# Once done this will define
0058 +#
0059 +#  GLIB2_FOUND       - system has glib2
0060 +#  GLIB2_INCLUDE_DIR - the glib2 include directory
0061 +#  GLIB2_LIBRARIES   - glib2 library
0062 +#
0063 +# SPDX-FileCopyrightText: 2008 by Laurent Montel, <montel@kde.org>
0064 +#
0065 +# SPDX-License-Identifier: BSD-3-Clause
0066 +#
0067  
0068 -IF (NOT GLIB2_FOUND OR NOT PKG_CONFIG_FOUND)
0069 -    FIND_PATH(GLIB2_GLIB2CONFIG_INCLUDE_PATH
0070 -        NAMES glibconfig.h
0071 -        PATHS
0072 -          /usr/local/lib
0073 -          /usr/lib
0074 -          /usr/lib64
0075 -          /opt/local/lib
0076 -          ${GLIB2_BASE_DIR}/lib
0077 -          ${GLIB2_BASE_DIR}/include
0078 -          ${CMAKE_LIBRARY_PATH}
0079 -        PATH_SUFFIXES glib-2.0/include
0080 -    )
0081 +if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
0082 +    # Already in cache, be silent
0083 +    set(GLIB2_FIND_QUIETLY TRUE)
0084 +endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
0085  
0086 +find_package(PkgConfig)
0087 +pkg_check_modules(PC_LibGLIB2 QUIET glib-2.0)
0088  
0089 -    FIND_PATH(GLIB2_INCLUDE_DIRS
0090 -        NAMES glib.h
0091 -        PATHS
0092 -            /usr/local/include
0093 -            /usr/include
0094 -            /opt/local/include
0095 -            ${GLIB2_BASE_DIR}/include
0096 -        PATH_SUFFIXES gtk-2.0 glib-2.0 glib20 
0097 -    )
0098 +find_path(GLIB2_MAIN_INCLUDE_DIR
0099 +          NAMES glib.h
0100 +          HINTS ${PC_LibGLIB2_INCLUDEDIR}
0101 +          PATH_SUFFIXES glib-2.0)
0102  
0103 -    FIND_LIBRARY(GLIB2_LIBRARIES
0104 -        NAMES  glib-2.0 glib20 glib
0105 -        PATHS  
0106 -            /usr/local/lib
0107 -            /usr/lib
0108 -            /usr/lib64
0109 -            /opt/local/lib
0110 -            ${GLIB2_BASE_DIR}/lib
0111 -    )
0112 -    
0113 -    IF(GLIB2_GLIB2CONFIG_INCLUDE_PATH AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
0114 -        SET( GLIB2_INCLUDE_DIRS  ${GLIB2_GLIB2CONFIG_INCLUDE_PATH} ${GLIB2_INCLUDE_DIRS} )
0115 -        SET( GLIB2_LIBRARIES ${GLIB2_LIBRARIES} )
0116 -        SET( GLIB2_FOUND 1 )
0117 -    ELSE()
0118 -        SET( GLIB2_INCLUDE_DIRS )
0119 -        SET( GLIB2_LIBRARIES )
0120 -        SET( GLIB2_FOUND 0)
0121 -    ENDIF()    
0122 -    
0123 -    IF(WIN32 AND NOT BUILD_STATIC)
0124 -        FIND_FILE(GLIB2_DLL 
0125 -                NAMES glib-2.dll glib-2-vs9.dll libglib-2.0-0.dll
0126 -                PATHS "${GLIB2_BASE_DIR}/bin"
0127 -                NO_SYSTEM_ENVIRONMENT_PATH)
0128 -    ENDIF()    
0129 -ENDIF ()
0130 +find_library(GLIB2_LIBRARY 
0131 +             NAMES glib-2.0 
0132 +             HINTS ${PC_LibGLIB2_LIBDIR}
0133 +)
0134  
0135 -#INCLUDE( FindPackageHandleStandardArgs )
0136 -#FIND_PACKAGE_HANDLE_STANDARD_ARGS( GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_GLIB2CONFIG_INCLUDE_PATH GLIB2_GLIB2_INCLUDE_PATH )
0137 +set(GLIB2_LIBRARIES ${GLIB2_LIBRARY})
0138  
0139 -IF (NOT GLIB2_FOUND AND GLIB2_FIND_REQUIRED)
0140 -        MESSAGE(FATAL_ERROR "Could not find glib2")
0141 -ENDIF()
0142 +# search the glibconfig.h include dir under the same root where the library is found
0143 +get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH)
0144 +
0145 +find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
0146 +          PATH_SUFFIXES glib-2.0/include
0147 +          HINTS ${PC_LibGLIB2_INCLUDEDIR} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH})
0148 +
0149 +set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}")
0150 +
0151 +# not sure if this include dir is optional or required
0152 +# for now it is optional
0153 +if(GLIB2_INTERNAL_INCLUDE_DIR)
0154 +  set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}")
0155 +endif(GLIB2_INTERNAL_INCLUDE_DIR)
0156 +
0157 +include(FindPackageHandleStandardArgs)
0158 +find_package_handle_standard_args(GLIB2  DEFAULT_MSG  GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
0159 +
0160 +mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES)