diff --git a/ports/gflags/fix-install.patch b/ports/gflags/fix-install.patch new file mode 100644 index 0000000000..a2e6061f8a --- /dev/null +++ b/ports/gflags/fix-install.patch @@ -0,0 +1,46 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3fd9d70..0debb89 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -397,11 +397,11 @@ endif () + # ---------------------------------------------------------------------------- + # installation directories + if (OS_WINDOWS) +- set (RUNTIME_INSTALL_DIR Bin) +- set (LIBRARY_INSTALL_DIR Lib) +- set (INCLUDE_INSTALL_DIR Include) +- set (CONFIG_INSTALL_DIR CMake) +- set (PKGCONFIG_INSTALL_DIR) ++ set (RUNTIME_INSTALL_DIR "bin") ++ set (LIBRARY_INSTALL_DIR "lib") ++ set (INCLUDE_INSTALL_DIR "include") ++ set (CONFIG_INSTALL_DIR "share/${PACKAGE_NAME}") ++ set (PKGCONFIG_INSTALL_DIR "") + else () + set (RUNTIME_INSTALL_DIR bin) + # The LIB_INSTALL_DIR and LIB_SUFFIX variables are used by the Fedora +@@ -501,14 +501,22 @@ configure_file (cmake/version.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-co + if (BUILD_SHARED_LIBS AND INSTALL_SHARED_LIBS) + foreach (opts IN ITEMS "" _nothreads) + if (BUILD_gflags${opts}_LIB) +- install (TARGETS gflags${opts}_shared DESTINATION ${LIBRARY_INSTALL_DIR} EXPORT ${EXPORT_NAME}) ++ install (TARGETS gflags${opts}_shared ++ EXPORT ${EXPORT_NAME} ++ RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} ++ LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ++ ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}) + endif () + endforeach () + endif () + if (BUILD_STATIC_LIBS AND INSTALL_STATIC_LIBS) + foreach (opts IN ITEMS "" _nothreads) + if (BUILD_gflags${opts}_LIB) +- install (TARGETS gflags${opts}_static DESTINATION ${LIBRARY_INSTALL_DIR} EXPORT ${EXPORT_NAME}) ++ install (TARGETS gflags${opts}_static ++ EXPORT ${EXPORT_NAME} ++ RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} ++ LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ++ ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}) + endif () + endforeach () + endif () diff --git a/ports/gflags/portfile.cmake b/ports/gflags/portfile.cmake index b4efd2e44a..463b6d9b29 100644 --- a/ports/gflags/portfile.cmake +++ b/ports/gflags/portfile.cmake @@ -11,11 +11,13 @@ vcpkg_from_github( vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-install.patch" PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-static-linking.patch" ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DGFLAGS_REGISTER_BUILD_DIR:BOOL=OFF -DGFLAGS_REGISTER_INSTALL_PREFIX:BOOL=OFF @@ -23,40 +25,11 @@ vcpkg_configure_cmake( ) vcpkg_install_cmake() +vcpkg_fixup_cmake_targets() -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gflags.dll ${CURRENT_PACKAGES_DIR}/bin/gflags.dll) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gflags.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gflags.dll) -endif() - -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) -file(RENAME ${CURRENT_PACKAGES_DIR}/cmake ${CURRENT_PACKAGES_DIR}/share/gflags) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - -file(READ ${CURRENT_PACKAGES_DIR}/debug/cmake/gflags-targets-debug.cmake GFLAGS_DEBUG_MODULE) -string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" GFLAGS_DEBUG_MODULE "${GFLAGS_DEBUG_MODULE}") -string(REPLACE "/Lib/gflags.dll" "/bin/gflags.dll" GFLAGS_DEBUG_MODULE "${GFLAGS_DEBUG_MODULE}") -string(REPLACE "/Lib/gflags_nothreads.dll" "/bin/gflags_nothreads.dll" GFLAGS_DEBUG_MODULE "${GFLAGS_DEBUG_MODULE}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets-debug.cmake "${GFLAGS_DEBUG_MODULE}") - -file(READ ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets-release.cmake GFLAGS_RELEASE_MODULE) -string(REPLACE "/Lib/gflags.dll" "/bin/gflags.dll" GFLAGS_RELEASE_MODULE "${GFLAGS_RELEASE_MODULE}") -string(REPLACE "/Lib/gflags_nothreads.dll" "/bin/gflags_nothreads.dll" GFLAGS_RELEASE_MODULE "${GFLAGS_RELEASE_MODULE}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets-release.cmake "${GFLAGS_RELEASE_MODULE}") - -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) - -file(READ ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets.cmake GFLAGS_CONFIG_MODULE) -string(REPLACE "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)" - "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)" - GFLAGS_CONFIG_MODULE "${GFLAGS_CONFIG_MODULE}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets.cmake "${GFLAGS_CONFIG_MODULE}") +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/gflags RENAME copyright) -file(RENAME ${CURRENT_PACKAGES_DIR}/Include ${CURRENT_PACKAGES_DIR}/include) -file(RENAME ${CURRENT_PACKAGES_DIR}/Lib ${CURRENT_PACKAGES_DIR}/lib) -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/Lib ${CURRENT_PACKAGES_DIR}/debug/lib) - vcpkg_copy_pdbs()