{"thread":{"id":"57891","subject":"[PATCH] Add pcre2 support for cmake build system.","startedAt":"2022-05-18T04:03:55Z","lastAt":"2022-05-24T23:04:54Z","messageCount":9,"participants":["Yuyi Wang via GitGitGadget","Junio C Hamano","Yuyi Wang","Derrick Stolee"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"455399","messageId":"pull.1267.git.git.1652846305514.gitgitgadget@gmail.com","threadId":"57891","inReplyTo":null,"subject":"[PATCH] Add pcre2 support for cmake build system.","fromName":"Yuyi Wang via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-05-18T03:58:25Z","receivedAt":"2022-05-18T04:03:55Z","isPatch":true,"sender":{"key":"strawberry_str@hotmail.com","avatar":"https://avatars.githubusercontent.com/u/37586447?v=4"},"body":"From: Yuyi Wang <Strawberry_Str@hotmail.com>\n\nThis commit fixes one of the TODOs listed in the CMakeLists.txt.\n\nThere's also some small fix to ensure it builds successfully.\n\nSigned-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>\n---\n    Add pcre2 support for cmake build system.\n    \n    Pcre2 is dealt with pkg-config.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1267%2FBerrysoft%2Fcmake%2Fpcre2-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1267/Berrysoft/cmake/pcre2-v1\nPull-Request: https://github.com/git/git/pull/1267\n\n contrib/buildsystems/CMakeLists.txt | 19 ++++++++++++++++---\n 1 file changed, 16 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex 185f56f414f..99d6cb963c4 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)\n \n option(USE_VCPKG \"Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms\" ON)\n if(NOT WIN32)\n-\tset(USE_VCPKG OFF CACHE BOOL FORCE)\n+\tset(USE_VCPKG OFF CACHE BOOL \"\" FORCE)\n endif()\n \n if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)\n@@ -108,7 +108,6 @@ project(git\n \n #TODO gitk git-gui gitweb\n #TODO Enable NLS on windows natively\n-#TODO Add pcre support\n \n #macros for parsing the Makefile for sources and scripts\n macro(parse_makefile_for_sources list_var regex)\n@@ -160,6 +159,14 @@ if(NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL \"MSVC\" OR CMAKE_C_COMPILER_ID ST\n \tfind_package(Intl)\n endif()\n \n+find_package(PkgConfig)\n+if(PkgConfig_FOUND)\n+\tpkg_check_modules(PCRE2 libpcre2-8)\n+\tif(PCRE2_FOUND)\n+\t\tadd_compile_definitions(USE_LIBPCRE2)\n+\tendif()\n+endif()\n+\n if(NOT Intl_FOUND)\n \tadd_compile_definitions(NO_GETTEXT)\n \tif(NOT Iconv_FOUND)\n@@ -180,6 +187,9 @@ endif()\n if(Intl_FOUND)\n \tinclude_directories(SYSTEM ${Intl_INCLUDE_DIRS})\n endif()\n+if(PCRE2_FOUND)\n+\tinclude_directories(SYSTEM ${PCRE2_INCLUDE_DIRS})\n+endif()\n \n \n if(WIN32 AND NOT MSVC)#not required for visual studio builds\n@@ -277,7 +287,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n \n elseif(CMAKE_SYSTEM_NAME STREQUAL \"Linux\")\n \tadd_compile_definitions(PROCFS_EXECUTABLE_PATH=\"/proc/self/exe\" HAVE_DEV_TTY )\n-\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)\n+\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)\n endif()\n \n if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n@@ -700,6 +710,9 @@ endif()\n if(Iconv_FOUND)\n \ttarget_link_libraries(common-main ${Iconv_LIBRARIES})\n endif()\n+if(PCRE2_FOUND)\n+\ttarget_link_libraries(common-main ${PCRE2_LIBRARIES})\n+endif()\n if(WIN32)\n \ttarget_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)\n \tadd_dependencies(common-main git-rc)\n\nbase-commit: 277cf0bc36094f6dc4297d8c9cef79df045b735d\n-- \ngitgitgadget\n"},{"id":"455431","messageId":"xmqq1qwqts6w.fsf@gitster.g","threadId":"57891","inReplyTo":"pull.1267.git.git.1652846305514.gitgitgadget@gmail.com","subject":"Re: [PATCH] Add pcre2 support for cmake build system.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-05-18T22:02:47Z","receivedAt":"2022-05-18T22:05:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Yuyi Wang via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Yuyi Wang <Strawberry_Str@hotmail.com>\n>\n> This commit fixes one of the TODOs listed in the CMakeLists.txt.\n>\n> There's also some small fix to ensure it builds successfully.\n>\n> Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>\n> ---\n\nI haven't worked on the CMakeLists but is the above description\nsufficient to tell what is going on if given to those who are\nfamiliar with it (I ask because it is not clear at all to me).\n\n> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\n> index 185f56f414f..99d6cb963c4 100644\n> --- a/contrib/buildsystems/CMakeLists.txt\n> +++ b/contrib/buildsystems/CMakeLists.txt\n> @@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)\n>  \n>  option(USE_VCPKG \"Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms\" ON)\n>  if(NOT WIN32)\n> -\tset(USE_VCPKG OFF CACHE BOOL FORCE)\n> +\tset(USE_VCPKG OFF CACHE BOOL \"\" FORCE)\n>  endif()\n\nIs this \"small fix to ensure it builds successfully\"?  To those who\ndo not need/want to use pcre2, is this hunk still needed to \"build\nsuccessfully\", or is this something that becomes necessary only\nbecause we have other hunks in this patch to add support to pcre2?\n\nIf the former, then perhaps the change deserves to be its own patch\nwith own explanation why it is necessary, what breaks without it,\netc.\n\nThanks.\n"},{"id":"455494","messageId":"OSYP286MB02627C53ECF2C03B397556E3F8D09@OSYP286MB0262.JPNP286.PROD.OUTLOOK.COM","threadId":"57891","inReplyTo":"xmqq1qwqts6w.fsf@gitster.g","subject":"Re: [PATCH] Add pcre2 support for cmake build system.","fromName":"Yuyi Wang","fromEmail":"strawberry_str@hotmail.com","sentAt":"2022-05-19T16:18:26Z","receivedAt":"2022-05-19T16:19:38Z","isPatch":true,"sender":{"key":"strawberry_str@hotmail.com","avatar":"https://avatars.githubusercontent.com/u/37586447?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n\n> Is this \"small fix to ensure it builds successfully\"?  To those who\n> do not need/want to use pcre2, is this hunk still needed to \"build\n> successfully\", or is this something that becomes necessary only\n> because we have other hunks in this patch to add support to pcre2?\n> \n> If the former, then perhaps the change deserves to be its own patch\n> with own explanation why it is necessary, what breaks without it,\n> etc.\n\nThere are 2 fixes. They are all needed no matter pcre2 is wanted. I'm\nrather surprised that no one has noticed the CMakeLists.txt is broken.\n\n> @@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)\n>  \n>  option(USE_VCPKG \"Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms\" ON)\n>  if(NOT WIN32)\n> -\tset(USE_VCPKG OFF CACHE BOOL FORCE)\n> +\tset(USE_VCPKG OFF CACHE BOOL \"\" FORCE)\n>  endif()\n>  \n>  if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)\n\nThis is the first fix. The original line didn't follow the grammar\nof `set`, and would simply fail.\n\n> @@ -277,7 +287,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n>  \n>  elseif(CMAKE_SYSTEM_NAME STREQUAL \"Linux\")\n>  \tadd_compile_definitions(PROCFS_EXECUTABLE_PATH=\"/proc/self/exe\" HAVE_DEV_TTY )\n> -\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)\n> +\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)\n>  endif()\n>  \n>  if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n\nThis is the second fix, to solve the linkage error on Linux.\n\nYou're right, Junio. These fixes should be their own patch.\nShould I remove them? They are still small fixes, I think,\nand could I submit the two together in a new patch?\n"},{"id":"455803","messageId":"555356a1-147c-71d1-ebab-f3151e37a960@github.com","threadId":"57891","inReplyTo":"OSYP286MB02627C53ECF2C03B397556E3F8D09@OSYP286MB0262.JPNP286.PROD.OUTLOOK.COM","subject":"Re: [PATCH] Add pcre2 support for cmake build system.","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2022-05-23T18:35:20Z","receivedAt":"2022-05-23T18:50:55Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 5/19/22 12:18 PM, Yuyi Wang wrote:\n> Junio C Hamano <gitster@pobox.com> wrote:\n> \n>> Is this \"small fix to ensure it builds successfully\"?  To those who\n>> do not need/want to use pcre2, is this hunk still needed to \"build\n>> successfully\", or is this something that becomes necessary only\n>> because we have other hunks in this patch to add support to pcre2?\n>>\n>> If the former, then perhaps the change deserves to be its own patch\n>> with own explanation why it is necessary, what breaks without it,\n>> etc.\n> \n> There are 2 fixes. They are all needed no matter pcre2 is wanted. I'm\n> rather surprised that no one has noticed the CMakeLists.txt is broken.\n> \n>> @@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)\n>>  \n>>  option(USE_VCPKG \"Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms\" ON)\n>>  if(NOT WIN32)\n>> -\tset(USE_VCPKG OFF CACHE BOOL FORCE)\n>> +\tset(USE_VCPKG OFF CACHE BOOL \"\" FORCE)\n>>  endif()\n>>  \n>>  if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)\n> \n> This is the first fix. The original line didn't follow the grammar\n> of `set`, and would simply fail.\n> \n>> @@ -277,7 +287,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n>>  \n>>  elseif(CMAKE_SYSTEM_NAME STREQUAL \"Linux\")\n>>  \tadd_compile_definitions(PROCFS_EXECUTABLE_PATH=\"/proc/self/exe\" HAVE_DEV_TTY )\n>> -\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)\n>> +\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)\n>>  endif()\n>>  \n>>  if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n> \n> This is the second fix, to solve the linkage error on Linux.\n> \n> You're right, Junio. These fixes should be their own patch.\n> Should I remove them? They are still small fixes, I think,\n> and could I submit the two together in a new patch?\n\nYou can rewrite your branch history to have two commits, force\npush your branch, and the GGG pull request will then have two\ncommits. This will translate to two patches (along with a\ncover letter) when you \"/submit\" again.\n\nHere are some links that might help you in this process:\n\n[1] https://www.youtube.com/watch?v=4qLtKx9S9a8\n[2] https://render.com/blog/git-organized-a-better-git-flow\n\nThanks,\n-Stolee\n"},{"id":"455804","messageId":"75aa1726-dca2-5e4b-387e-229e1501209e@github.com","threadId":"57891","inReplyTo":"xmqq1qwqts6w.fsf@gitster.g","subject":"Re: [PATCH] Add pcre2 support for cmake build system.","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2022-05-23T18:36:20Z","receivedAt":"2022-05-23T18:52:19Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 5/18/22 6:02 PM, Junio C Hamano wrote:\n> \"Yuyi Wang via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n>> From: Yuyi Wang <Strawberry_Str@hotmail.com>\n>>\n>> This commit fixes one of the TODOs listed in the CMakeLists.txt.\n>>\n>> There's also some small fix to ensure it builds successfully.\n>>\n>> Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>\n>> ---\n> \n> I haven't worked on the CMakeLists but is the above description\n> sufficient to tell what is going on if given to those who are\n> familiar with it (I ask because it is not clear at all to me).\n\nI had the same confusion. Perhaps the message could indicate\nhow one could test this PCRE2 compilation so we could try it\nout ourselves?\n\nThanks,\n-Stolee\n"},{"id":"455871","messageId":"pull.1267.v2.git.git.1653374328.gitgitgadget@gmail.com","threadId":"57891","inReplyTo":"pull.1267.git.git.1652846305514.gitgitgadget@gmail.com","subject":"[PATCH v2 0/2] Add pcre2 support for cmake build system.","fromName":"Yuyi Wang via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-05-24T06:38:46Z","receivedAt":"2022-05-24T06:38:54Z","isPatch":true,"sender":{"key":"strawberry_str@hotmail.com","avatar":"https://avatars.githubusercontent.com/u/37586447?v=4"},"body":"Pcre2 is dealt with pkg-config.\n\nYuyi Wang (2):\n  Fix CMakeLists.txt on Linux.\n  Add pcre2 support for cmake build system.\n\n contrib/buildsystems/CMakeLists.txt | 20 +++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)\n\n\nbase-commit: 277cf0bc36094f6dc4297d8c9cef79df045b735d\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1267%2FBerrysoft%2Fcmake%2Fpcre2-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1267/Berrysoft/cmake/pcre2-v2\nPull-Request: https://github.com/git/git/pull/1267\n\nRange-diff vs v1:\n\n -:  ----------- > 1:  29cb31e5c50 Fix CMakeLists.txt on Linux.\n 1:  679e5dd46d0 ! 2:  b828585b205 Add pcre2 support for cmake build system.\n     @@ Commit message\n      \n          This commit fixes one of the TODOs listed in the CMakeLists.txt.\n      \n     -    There's also some small fix to ensure it builds successfully.\n     +    As pcre2 doesn't provide cmake find module, we find it with pkgconf.\n     +    This patch also works with vcpkg on Windows, with pkgconf and pcre2\n     +    installed.\n     +\n     +    Pkgconf and pcre2 is detected automatically just like curl, expat\n     +    and iconv. The output of CMake indicates whether pcre2 is found.\n      \n          Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>\n      \n       ## contrib/buildsystems/CMakeLists.txt ##\n     -@@ contrib/buildsystems/CMakeLists.txt: set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)\n     - \n     - option(USE_VCPKG \"Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms\" ON)\n     - if(NOT WIN32)\n     --\tset(USE_VCPKG OFF CACHE BOOL FORCE)\n     -+\tset(USE_VCPKG OFF CACHE BOOL \"\" FORCE)\n     - endif()\n     - \n     - if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)\n      @@ contrib/buildsystems/CMakeLists.txt: project(git\n       \n       #TODO gitk git-gui gitweb\n     @@ contrib/buildsystems/CMakeLists.txt: endif()\n       \n       \n       if(WIN32 AND NOT MSVC)#not required for visual studio builds\n     -@@ contrib/buildsystems/CMakeLists.txt: if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n     - \n     - elseif(CMAKE_SYSTEM_NAME STREQUAL \"Linux\")\n     - \tadd_compile_definitions(PROCFS_EXECUTABLE_PATH=\"/proc/self/exe\" HAVE_DEV_TTY )\n     --\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)\n     -+\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)\n     - endif()\n     - \n     - if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n      @@ contrib/buildsystems/CMakeLists.txt: endif()\n       if(Iconv_FOUND)\n       \ttarget_link_libraries(common-main ${Iconv_LIBRARIES})\n       endif()\n      +if(PCRE2_FOUND)\n      +\ttarget_link_libraries(common-main ${PCRE2_LIBRARIES})\n     ++\ttarget_link_directories(common-main PUBLIC ${PCRE2_LIBRARY_DIRS})\n      +endif()\n       if(WIN32)\n       \ttarget_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)\n\n-- \ngitgitgadget\n"},{"id":"455872","messageId":"29cb31e5c502149192c6beb56bf8b372a40711e0.1653374328.git.gitgitgadget@gmail.com","threadId":"57891","inReplyTo":"pull.1267.v2.git.git.1653374328.gitgitgadget@gmail.com","subject":"[PATCH v2 1/2] Fix CMakeLists.txt on Linux.","fromName":"Yuyi Wang via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-05-24T06:38:47Z","receivedAt":"2022-05-24T06:38:58Z","isPatch":true,"sender":{"key":"strawberry_str@hotmail.com","avatar":"https://avatars.githubusercontent.com/u/37586447?v=4"},"body":"From: Yuyi Wang <Strawberry_Str@hotmail.com>\n\nCMakeLists.txt didn't follow the grammar of `set`, and it will fail when\nsetting `USE_VCPKG` off on non-Windows platforms.\n\nWhen the platform is Linux, the Makefile adds `compat/linux/procinfo.o`\nto `COMPAT_OBJS`, but the CMakeLists.txt didn't add\n`compat/linux/procinfo.c` to `compat_SOURCES`. It would cause linkage\nerror.\n\nSigned-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>\n---\n contrib/buildsystems/CMakeLists.txt | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex 185f56f414f..7f333e303c2 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)\n \n option(USE_VCPKG \"Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms\" ON)\n if(NOT WIN32)\n-\tset(USE_VCPKG OFF CACHE BOOL FORCE)\n+\tset(USE_VCPKG OFF CACHE BOOL \"\" FORCE)\n endif()\n \n if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)\n@@ -277,7 +277,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n \n elseif(CMAKE_SYSTEM_NAME STREQUAL \"Linux\")\n \tadd_compile_definitions(PROCFS_EXECUTABLE_PATH=\"/proc/self/exe\" HAVE_DEV_TTY )\n-\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)\n+\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)\n endif()\n \n if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n-- \ngitgitgadget\n\n"},{"id":"455873","messageId":"b828585b2050b3ce114abf304a60bb7eaecd8b14.1653374328.git.gitgitgadget@gmail.com","threadId":"57891","inReplyTo":"pull.1267.v2.git.git.1653374328.gitgitgadget@gmail.com","subject":"[PATCH v2 2/2] Add pcre2 support for cmake build system.","fromName":"Yuyi Wang via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-05-24T06:38:48Z","receivedAt":"2022-05-24T06:39:01Z","isPatch":true,"sender":{"key":"strawberry_str@hotmail.com","avatar":"https://avatars.githubusercontent.com/u/37586447?v=4"},"body":"From: Yuyi Wang <Strawberry_Str@hotmail.com>\n\nThis commit fixes one of the TODOs listed in the CMakeLists.txt.\n\nAs pcre2 doesn't provide cmake find module, we find it with pkgconf.\nThis patch also works with vcpkg on Windows, with pkgconf and pcre2\ninstalled.\n\nPkgconf and pcre2 is detected automatically just like curl, expat\nand iconv. The output of CMake indicates whether pcre2 is found.\n\nSigned-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>\n---\n contrib/buildsystems/CMakeLists.txt | 16 +++++++++++++++-\n 1 file changed, 15 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex 7f333e303c2..2844dd6c88d 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -108,7 +108,6 @@ project(git\n \n #TODO gitk git-gui gitweb\n #TODO Enable NLS on windows natively\n-#TODO Add pcre support\n \n #macros for parsing the Makefile for sources and scripts\n macro(parse_makefile_for_sources list_var regex)\n@@ -160,6 +159,14 @@ if(NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL \"MSVC\" OR CMAKE_C_COMPILER_ID ST\n \tfind_package(Intl)\n endif()\n \n+find_package(PkgConfig)\n+if(PkgConfig_FOUND)\n+\tpkg_check_modules(PCRE2 libpcre2-8)\n+\tif(PCRE2_FOUND)\n+\t\tadd_compile_definitions(USE_LIBPCRE2)\n+\tendif()\n+endif()\n+\n if(NOT Intl_FOUND)\n \tadd_compile_definitions(NO_GETTEXT)\n \tif(NOT Iconv_FOUND)\n@@ -180,6 +187,9 @@ endif()\n if(Intl_FOUND)\n \tinclude_directories(SYSTEM ${Intl_INCLUDE_DIRS})\n endif()\n+if(PCRE2_FOUND)\n+\tinclude_directories(SYSTEM ${PCRE2_INCLUDE_DIRS})\n+endif()\n \n \n if(WIN32 AND NOT MSVC)#not required for visual studio builds\n@@ -700,6 +710,10 @@ endif()\n if(Iconv_FOUND)\n \ttarget_link_libraries(common-main ${Iconv_LIBRARIES})\n endif()\n+if(PCRE2_FOUND)\n+\ttarget_link_libraries(common-main ${PCRE2_LIBRARIES})\n+\ttarget_link_directories(common-main PUBLIC ${PCRE2_LIBRARY_DIRS})\n+endif()\n if(WIN32)\n \ttarget_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)\n \tadd_dependencies(common-main git-rc)\n-- \ngitgitgadget\n"},{"id":"455985","messageId":"xmqqtu9ecz1w.fsf@gitster.g","threadId":"57891","inReplyTo":"29cb31e5c502149192c6beb56bf8b372a40711e0.1653374328.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 1/2] Fix CMakeLists.txt on Linux.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-05-24T23:04:43Z","receivedAt":"2022-05-24T23:04:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Yuyi Wang via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> Subject: Re: [PATCH v2 1/2] Fix CMakeLists.txt on Linux.\n\nPerhaps\n\n\tSubject: cmake: fix CMakeLists on Linux\n\ni.e. with a short and meaningful <area>: prefix, no need to\ncapitalize the first word after the prefix, without the terminating\nfull-stop.\n\nFrom: Yuyi Wang <Strawberry_Str@hotmail.com>\n>\n> CMakeLists.txt didn't follow the grammar of `set`, and it will fail when\n> setting `USE_VCPKG` off on non-Windows platforms.\n\nSo any non-Windows, the use of set() here was broken.  It is\nunderstandable because cmake support was added primarily for\nWindows.  It is nevertheless good to see it corrected.\n\n> When the platform is Linux, the Makefile adds `compat/linux/procinfo.o`\n> to `COMPAT_OBJS`, but the CMakeLists.txt didn't add\n> `compat/linux/procinfo.c` to `compat_SOURCES`. It would cause linkage\n> error.\n\nOK.  I didn't know anybody cared about using cmake on non-Windows\nplatforms for this project.\n\nThanks, will queue, together with the other two patches.\n\n\n\n> Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>\n> ---\n>  contrib/buildsystems/CMakeLists.txt | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\n> index 185f56f414f..7f333e303c2 100644\n> --- a/contrib/buildsystems/CMakeLists.txt\n> +++ b/contrib/buildsystems/CMakeLists.txt\n> @@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)\n>  \n>  option(USE_VCPKG \"Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms\" ON)\n>  if(NOT WIN32)\n> -\tset(USE_VCPKG OFF CACHE BOOL FORCE)\n> +\tset(USE_VCPKG OFF CACHE BOOL \"\" FORCE)\n>  endif()\n>  \n>  if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)\n> @@ -277,7 +277,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n>  \n>  elseif(CMAKE_SYSTEM_NAME STREQUAL \"Linux\")\n>  \tadd_compile_definitions(PROCFS_EXECUTABLE_PATH=\"/proc/self/exe\" HAVE_DEV_TTY )\n> -\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)\n> +\tlist(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)\n>  endif()\n>  \n>  if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n"}]}