Vc icon indicating copy to clipboard operation
Vc copied to clipboard

Include vcpkg patch

Open bernhardmgruber opened this issue 2 years ago • 1 comments

vcpkg contains the following patch when building/installing Vc:

diff --git a/cmake/VcConfig.cmake.in b/cmake/VcConfig.cmake.in
index 36de476..5cb0e5b 100644
--- a/cmake/VcConfig.cmake.in
+++ b/cmake/VcConfig.cmake.in
@@ -4,7 +4,7 @@
 set_and_check(@PROJECT_NAME@_INSTALL_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@)
 set_and_check(@PROJECT_NAME@_INCLUDE_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@/include)
 set_and_check(@PROJECT_NAME@_LIB_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@)
-set_and_check(@PROJECT_NAME@_CMAKE_MODULES_DIR ${@PROJECT_NAME@_LIB_DIR}/cmake/Vc)
+set_and_check(@PROJECT_NAME@_CMAKE_MODULES_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@/share/vc)
 set(@PROJECT_NAME@_VERSION_STRING "@PROJECT_VERSION@")
 
 ### Setup @PROJECT_NAME@ defaults
@@ -20,7 +20,7 @@ list(APPEND @PROJECT_NAME@_ALL_FLAGS ${@PROJECT_NAME@_COMPILE_FLAGS})
 list(APPEND @PROJECT_NAME@_ALL_FLAGS ${@PROJECT_NAME@_ARCHITECTURE_FLAGS})
 
 ### Import targets
-include("@PACKAGE_CMAKE_INSTALL_PREFIX@/@PACKAGE_INSTALL_DESTINATION@/@[email protected]")
+include(${@PROJECT_NAME@_CMAKE_MODULES_DIR}/@[email protected])
 
 ### Define @PROJECT_NAME@_LIBRARIES for backwards compatibility
 get_target_property(vc_lib_location @PROJECT_NAME@::Vc INTERFACE_LOCATION)

If the changes are correct, we should include the patch.

bernhardmgruber avatar May 23 '22 13:05 bernhardmgruber

This patch is only correct when combined with this line: https://github.com/microsoft/vcpkg/blob/62d01b70df227850b728f5050418b917ad6d2b32/ports/vc/portfile.cmake#L19

Basically, CMake allows a lot of locations for the CMake package to be installed to: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure. Usually, packagers will have to shift the location around in order to satisfy their own polices or some operating system's policy which may be stricter than CMake in this aspect.

Vc could certainly adopt to install its CMake package to <prefix>/share/vc by default or to make https://github.com/VcDevel/Vc/blob/d4b8109647d688e7292c150468c9ab7e848f2c54/CMakeLists.txt#L213-L215 configurable via e.g. -DVc_PACKAGE_INSTALL_DESTINATION=... to ease a package maintainer's life.

dennisklein avatar Nov 27 '22 04:11 dennisklein