Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include vcpkg patch #345

Open
bernhardmgruber opened this issue May 23, 2022 · 1 comment
Open

Include vcpkg patch #345

bernhardmgruber opened this issue May 23, 2022 · 1 comment

Comments

@bernhardmgruber
Copy link
Collaborator

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.

@dennisklein
Copy link
Contributor

dennisklein commented Nov 27, 2022

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

Vc/CMakeLists.txt

Lines 213 to 215 in d4b8109

set(PACKAGE_INSTALL_DESTINATION
lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}
)
configurable via e.g. -DVc_PACKAGE_INSTALL_DESTINATION=... to ease a package maintainer's life.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants