vcpkg/ports/forge/cmake_config.patch
pradeep 48678ea8b2
[Forge] update version to 1.0.7 (#17099)
* [forge] Update forge to v1.0.7 tag

- Use explicit cmake files install path
- Use REF option in vcpkg_from_github command to fetch tag

* [forge] Update version in baseline
2021-05-11 10:39:03 -07:00

60 lines
2.0 KiB
Diff

diff --git a/CMakeModules/ForgeConfig.cmake.in b/CMakeModules/ForgeConfig.cmake.in
index e4c7737..5a3b000 100644
--- a/CMakeModules/ForgeConfig.cmake.in
+++ b/CMakeModules/ForgeConfig.cmake.in
@@ -57,16 +57,24 @@ if (NOT TARGET Forge::forge AND
endif ()
if (TARGET Forge::forge)
- get_property(config TARGET Forge::forge PROPERTY IMPORTED_CONFIGURATIONS)
- if(NOT config)
- set(config "NOCONFIG")
+ get_property(configs TARGET Forge::forge PROPERTY IMPORTED_CONFIGURATIONS)
+ if(NOT configs)
+ set(configs "NOCONFIG")
endif()
- get_property(loc TARGET Forge::forge PROPERTY IMPORTED_LOCATION_${config})
+ foreach(config IN LISTS configs)
+ get_property(loc TARGET Forge::forge PROPERTY IMPORTED_LOCATION_${config})
+
+ # break if any of the imported configurations exist. All configs write to the same
+ # location so they are not working as CMake intended. Its fine for single config
+ # installers like ours.
+ if(EXISTS ${loc})
+ set(Forge_BINARY_EXISTS TRUE)
+ break()
+ endif()
+ endforeach()
endif ()
-if ((TARGET Forge::forge AND EXISTS ${loc})
- OR
- TARGET forge)
+if ((TARGET Forge::forge AND Forge_BINARY_EXISTS) OR TARGET forge)
set(Forge_FOUND ON)
if (TARGET forge AND NOT TARGET Forge::forge)
add_library(Forge::forge ALIAS forge)
@@ -75,3 +83,22 @@ if ((TARGET Forge::forge AND EXISTS ${loc})
else ()
set(Forge_FOUND OFF)
endif ()
+
+if(Forge_FOUND)
+ # Check for dependencies when Forge binary and cmake files are found
+ include(CMakeFindDependencyMacro)
+
+ find_dependency(glad CONFIG)
+ find_dependency(glfw3 CONFIG)
+ find_dependency(freetype CONFIG)
+ find_dependency(freeimage CONFIG)
+ find_dependency(OpenGL)
+
+ if(NOT WIN32)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(fontconfig REQUIRED)
+ if(NOT fontconfig_FOUND)
+ message(FATAL_ERROR "Please install Fontconfig dependency")
+ endif()
+ endif()
+endif()