git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Add pcre2 support for cmake build system.
@ 2022-05-18  3:58 Yuyi Wang via GitGitGadget
  2022-05-18 22:02 ` Junio C Hamano
  2022-05-24  6:38 ` [PATCH v2 0/2] " Yuyi Wang via GitGitGadget
  0 siblings, 2 replies; 9+ messages in thread
From: Yuyi Wang via GitGitGadget @ 2022-05-18  3:58 UTC (permalink / raw)
  To: git; +Cc: Yuyi Wang, Yuyi Wang

From: Yuyi Wang <Strawberry_Str@hotmail.com>

This commit fixes one of the TODOs listed in the CMakeLists.txt.

There's also some small fix to ensure it builds successfully.

Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
---
    Add pcre2 support for cmake build system.
    
    Pcre2 is dealt with pkg-config.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1267%2FBerrysoft%2Fcmake%2Fpcre2-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1267/Berrysoft/cmake/pcre2-v1
Pull-Request: https://github.com/git/git/pull/1267

 contrib/buildsystems/CMakeLists.txt | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 185f56f414f..99d6cb963c4 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
 
 option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
 if(NOT WIN32)
-	set(USE_VCPKG OFF CACHE BOOL FORCE)
+	set(USE_VCPKG OFF CACHE BOOL "" FORCE)
 endif()
 
 if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
@@ -108,7 +108,6 @@ project(git
 
 #TODO gitk git-gui gitweb
 #TODO Enable NLS on windows natively
-#TODO Add pcre support
 
 #macros for parsing the Makefile for sources and scripts
 macro(parse_makefile_for_sources list_var regex)
@@ -160,6 +159,14 @@ if(NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_COMPILER_ID ST
 	find_package(Intl)
 endif()
 
+find_package(PkgConfig)
+if(PkgConfig_FOUND)
+	pkg_check_modules(PCRE2 libpcre2-8)
+	if(PCRE2_FOUND)
+		add_compile_definitions(USE_LIBPCRE2)
+	endif()
+endif()
+
 if(NOT Intl_FOUND)
 	add_compile_definitions(NO_GETTEXT)
 	if(NOT Iconv_FOUND)
@@ -180,6 +187,9 @@ endif()
 if(Intl_FOUND)
 	include_directories(SYSTEM ${Intl_INCLUDE_DIRS})
 endif()
+if(PCRE2_FOUND)
+	include_directories(SYSTEM ${PCRE2_INCLUDE_DIRS})
+endif()
 
 
 if(WIN32 AND NOT MSVC)#not required for visual studio builds
@@ -277,7 +287,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
 
 elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
-	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)
+	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)
 endif()
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
@@ -700,6 +710,9 @@ endif()
 if(Iconv_FOUND)
 	target_link_libraries(common-main ${Iconv_LIBRARIES})
 endif()
+if(PCRE2_FOUND)
+	target_link_libraries(common-main ${PCRE2_LIBRARIES})
+endif()
 if(WIN32)
 	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
 	add_dependencies(common-main git-rc)

base-commit: 277cf0bc36094f6dc4297d8c9cef79df045b735d
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add pcre2 support for cmake build system.
  2022-05-18  3:58 [PATCH] Add pcre2 support for cmake build system Yuyi Wang via GitGitGadget
@ 2022-05-18 22:02 ` Junio C Hamano
  2022-05-19 16:18   ` Yuyi Wang
  2022-05-23 18:36   ` Derrick Stolee
  2022-05-24  6:38 ` [PATCH v2 0/2] " Yuyi Wang via GitGitGadget
  1 sibling, 2 replies; 9+ messages in thread
From: Junio C Hamano @ 2022-05-18 22:02 UTC (permalink / raw)
  To: Yuyi Wang via GitGitGadget; +Cc: git, Yuyi Wang

"Yuyi Wang via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Yuyi Wang <Strawberry_Str@hotmail.com>
>
> This commit fixes one of the TODOs listed in the CMakeLists.txt.
>
> There's also some small fix to ensure it builds successfully.
>
> Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
> ---

I haven't worked on the CMakeLists but is the above description
sufficient to tell what is going on if given to those who are
familiar with it (I ask because it is not clear at all to me).

> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> index 185f56f414f..99d6cb963c4 100644
> --- a/contrib/buildsystems/CMakeLists.txt
> +++ b/contrib/buildsystems/CMakeLists.txt
> @@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
>  
>  option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
>  if(NOT WIN32)
> -	set(USE_VCPKG OFF CACHE BOOL FORCE)
> +	set(USE_VCPKG OFF CACHE BOOL "" FORCE)
>  endif()

Is this "small fix to ensure it builds successfully"?  To those who
do not need/want to use pcre2, is this hunk still needed to "build
successfully", or is this something that becomes necessary only
because we have other hunks in this patch to add support to pcre2?

If the former, then perhaps the change deserves to be its own patch
with own explanation why it is necessary, what breaks without it,
etc.

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add pcre2 support for cmake build system.
  2022-05-18 22:02 ` Junio C Hamano
@ 2022-05-19 16:18   ` Yuyi Wang
  2022-05-23 18:35     ` Derrick Stolee
  2022-05-23 18:36   ` Derrick Stolee
  1 sibling, 1 reply; 9+ messages in thread
From: Yuyi Wang @ 2022-05-19 16:18 UTC (permalink / raw)
  To: gitster; +Cc: git, gitgitgadget, Yuyi Wang

Junio C Hamano <gitster@pobox.com> wrote:

> Is this "small fix to ensure it builds successfully"?  To those who
> do not need/want to use pcre2, is this hunk still needed to "build
> successfully", or is this something that becomes necessary only
> because we have other hunks in this patch to add support to pcre2?
> 
> If the former, then perhaps the change deserves to be its own patch
> with own explanation why it is necessary, what breaks without it,
> etc.

There are 2 fixes. They are all needed no matter pcre2 is wanted. I'm
rather surprised that no one has noticed the CMakeLists.txt is broken.

> @@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
>  
>  option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
>  if(NOT WIN32)
> -	set(USE_VCPKG OFF CACHE BOOL FORCE)
> +	set(USE_VCPKG OFF CACHE BOOL "" FORCE)
>  endif()
>  
>  if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)

This is the first fix. The original line didn't follow the grammar
of `set`, and would simply fail.

> @@ -277,7 +287,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
>  
>  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
>  	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
> -	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)
> +	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)
>  endif()
>  
>  if(CMAKE_SYSTEM_NAME STREQUAL "Windows")

This is the second fix, to solve the linkage error on Linux.

You're right, Junio. These fixes should be their own patch.
Should I remove them? They are still small fixes, I think,
and could I submit the two together in a new patch?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add pcre2 support for cmake build system.
  2022-05-19 16:18   ` Yuyi Wang
@ 2022-05-23 18:35     ` Derrick Stolee
  0 siblings, 0 replies; 9+ messages in thread
From: Derrick Stolee @ 2022-05-23 18:35 UTC (permalink / raw)
  To: Yuyi Wang, gitster; +Cc: git, gitgitgadget

On 5/19/22 12:18 PM, Yuyi Wang wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
> 
>> Is this "small fix to ensure it builds successfully"?  To those who
>> do not need/want to use pcre2, is this hunk still needed to "build
>> successfully", or is this something that becomes necessary only
>> because we have other hunks in this patch to add support to pcre2?
>>
>> If the former, then perhaps the change deserves to be its own patch
>> with own explanation why it is necessary, what breaks without it,
>> etc.
> 
> There are 2 fixes. They are all needed no matter pcre2 is wanted. I'm
> rather surprised that no one has noticed the CMakeLists.txt is broken.
> 
>> @@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
>>  
>>  option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
>>  if(NOT WIN32)
>> -	set(USE_VCPKG OFF CACHE BOOL FORCE)
>> +	set(USE_VCPKG OFF CACHE BOOL "" FORCE)
>>  endif()
>>  
>>  if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
> 
> This is the first fix. The original line didn't follow the grammar
> of `set`, and would simply fail.
> 
>> @@ -277,7 +287,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
>>  
>>  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
>>  	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
>> -	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)
>> +	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)
>>  endif()
>>  
>>  if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
> 
> This is the second fix, to solve the linkage error on Linux.
> 
> You're right, Junio. These fixes should be their own patch.
> Should I remove them? They are still small fixes, I think,
> and could I submit the two together in a new patch?

You can rewrite your branch history to have two commits, force
push your branch, and the GGG pull request will then have two
commits. This will translate to two patches (along with a
cover letter) when you "/submit" again.

Here are some links that might help you in this process:

[1] https://www.youtube.com/watch?v=4qLtKx9S9a8
[2] https://render.com/blog/git-organized-a-better-git-flow

Thanks,
-Stolee

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add pcre2 support for cmake build system.
  2022-05-18 22:02 ` Junio C Hamano
  2022-05-19 16:18   ` Yuyi Wang
@ 2022-05-23 18:36   ` Derrick Stolee
  1 sibling, 0 replies; 9+ messages in thread
From: Derrick Stolee @ 2022-05-23 18:36 UTC (permalink / raw)
  To: Junio C Hamano, Yuyi Wang via GitGitGadget; +Cc: git, Yuyi Wang

On 5/18/22 6:02 PM, Junio C Hamano wrote:
> "Yuyi Wang via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> From: Yuyi Wang <Strawberry_Str@hotmail.com>
>>
>> This commit fixes one of the TODOs listed in the CMakeLists.txt.
>>
>> There's also some small fix to ensure it builds successfully.
>>
>> Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
>> ---
> 
> I haven't worked on the CMakeLists but is the above description
> sufficient to tell what is going on if given to those who are
> familiar with it (I ask because it is not clear at all to me).

I had the same confusion. Perhaps the message could indicate
how one could test this PCRE2 compilation so we could try it
out ourselves?

Thanks,
-Stolee

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 0/2] Add pcre2 support for cmake build system.
  2022-05-18  3:58 [PATCH] Add pcre2 support for cmake build system Yuyi Wang via GitGitGadget
  2022-05-18 22:02 ` Junio C Hamano
@ 2022-05-24  6:38 ` Yuyi Wang via GitGitGadget
  2022-05-24  6:38   ` [PATCH v2 1/2] Fix CMakeLists.txt on Linux Yuyi Wang via GitGitGadget
  2022-05-24  6:38   ` [PATCH v2 2/2] Add pcre2 support for cmake build system Yuyi Wang via GitGitGadget
  1 sibling, 2 replies; 9+ messages in thread
From: Yuyi Wang via GitGitGadget @ 2022-05-24  6:38 UTC (permalink / raw)
  To: git; +Cc: Derrick Stolee, Yuyi Wang

Pcre2 is dealt with pkg-config.

Yuyi Wang (2):
  Fix CMakeLists.txt on Linux.
  Add pcre2 support for cmake build system.

 contrib/buildsystems/CMakeLists.txt | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)


base-commit: 277cf0bc36094f6dc4297d8c9cef79df045b735d
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1267%2FBerrysoft%2Fcmake%2Fpcre2-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1267/Berrysoft/cmake/pcre2-v2
Pull-Request: https://github.com/git/git/pull/1267

Range-diff vs v1:

 -:  ----------- > 1:  29cb31e5c50 Fix CMakeLists.txt on Linux.
 1:  679e5dd46d0 ! 2:  b828585b205 Add pcre2 support for cmake build system.
     @@ Commit message
      
          This commit fixes one of the TODOs listed in the CMakeLists.txt.
      
     -    There's also some small fix to ensure it builds successfully.
     +    As pcre2 doesn't provide cmake find module, we find it with pkgconf.
     +    This patch also works with vcpkg on Windows, with pkgconf and pcre2
     +    installed.
     +
     +    Pkgconf and pcre2 is detected automatically just like curl, expat
     +    and iconv. The output of CMake indicates whether pcre2 is found.
      
          Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
      
       ## contrib/buildsystems/CMakeLists.txt ##
     -@@ contrib/buildsystems/CMakeLists.txt: set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
     - 
     - option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
     - if(NOT WIN32)
     --	set(USE_VCPKG OFF CACHE BOOL FORCE)
     -+	set(USE_VCPKG OFF CACHE BOOL "" FORCE)
     - endif()
     - 
     - if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
      @@ contrib/buildsystems/CMakeLists.txt: project(git
       
       #TODO gitk git-gui gitweb
     @@ contrib/buildsystems/CMakeLists.txt: endif()
       
       
       if(WIN32 AND NOT MSVC)#not required for visual studio builds
     -@@ contrib/buildsystems/CMakeLists.txt: if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
     - 
     - elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     - 	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
     --	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)
     -+	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)
     - endif()
     - 
     - if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
      @@ contrib/buildsystems/CMakeLists.txt: endif()
       if(Iconv_FOUND)
       	target_link_libraries(common-main ${Iconv_LIBRARIES})
       endif()
      +if(PCRE2_FOUND)
      +	target_link_libraries(common-main ${PCRE2_LIBRARIES})
     ++	target_link_directories(common-main PUBLIC ${PCRE2_LIBRARY_DIRS})
      +endif()
       if(WIN32)
       	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] Fix CMakeLists.txt on Linux.
  2022-05-24  6:38 ` [PATCH v2 0/2] " Yuyi Wang via GitGitGadget
@ 2022-05-24  6:38   ` Yuyi Wang via GitGitGadget
  2022-05-24 23:04     ` Junio C Hamano
  2022-05-24  6:38   ` [PATCH v2 2/2] Add pcre2 support for cmake build system Yuyi Wang via GitGitGadget
  1 sibling, 1 reply; 9+ messages in thread
From: Yuyi Wang via GitGitGadget @ 2022-05-24  6:38 UTC (permalink / raw)
  To: git; +Cc: Derrick Stolee, Yuyi Wang, Yuyi Wang

From: Yuyi Wang <Strawberry_Str@hotmail.com>

CMakeLists.txt didn't follow the grammar of `set`, and it will fail when
setting `USE_VCPKG` off on non-Windows platforms.

When the platform is Linux, the Makefile adds `compat/linux/procinfo.o`
to `COMPAT_OBJS`, but the CMakeLists.txt didn't add
`compat/linux/procinfo.c` to `compat_SOURCES`. It would cause linkage
error.

Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 185f56f414f..7f333e303c2 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
 
 option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
 if(NOT WIN32)
-	set(USE_VCPKG OFF CACHE BOOL FORCE)
+	set(USE_VCPKG OFF CACHE BOOL "" FORCE)
 endif()
 
 if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
@@ -277,7 +277,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
 
 elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
-	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)
+	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)
 endif()
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
-- 
gitgitgadget


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] Add pcre2 support for cmake build system.
  2022-05-24  6:38 ` [PATCH v2 0/2] " Yuyi Wang via GitGitGadget
  2022-05-24  6:38   ` [PATCH v2 1/2] Fix CMakeLists.txt on Linux Yuyi Wang via GitGitGadget
@ 2022-05-24  6:38   ` Yuyi Wang via GitGitGadget
  1 sibling, 0 replies; 9+ messages in thread
From: Yuyi Wang via GitGitGadget @ 2022-05-24  6:38 UTC (permalink / raw)
  To: git; +Cc: Derrick Stolee, Yuyi Wang, Yuyi Wang

From: Yuyi Wang <Strawberry_Str@hotmail.com>

This commit fixes one of the TODOs listed in the CMakeLists.txt.

As pcre2 doesn't provide cmake find module, we find it with pkgconf.
This patch also works with vcpkg on Windows, with pkgconf and pcre2
installed.

Pkgconf and pcre2 is detected automatically just like curl, expat
and iconv. The output of CMake indicates whether pcre2 is found.

Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 7f333e303c2..2844dd6c88d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -108,7 +108,6 @@ project(git
 
 #TODO gitk git-gui gitweb
 #TODO Enable NLS on windows natively
-#TODO Add pcre support
 
 #macros for parsing the Makefile for sources and scripts
 macro(parse_makefile_for_sources list_var regex)
@@ -160,6 +159,14 @@ if(NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_COMPILER_ID ST
 	find_package(Intl)
 endif()
 
+find_package(PkgConfig)
+if(PkgConfig_FOUND)
+	pkg_check_modules(PCRE2 libpcre2-8)
+	if(PCRE2_FOUND)
+		add_compile_definitions(USE_LIBPCRE2)
+	endif()
+endif()
+
 if(NOT Intl_FOUND)
 	add_compile_definitions(NO_GETTEXT)
 	if(NOT Iconv_FOUND)
@@ -180,6 +187,9 @@ endif()
 if(Intl_FOUND)
 	include_directories(SYSTEM ${Intl_INCLUDE_DIRS})
 endif()
+if(PCRE2_FOUND)
+	include_directories(SYSTEM ${PCRE2_INCLUDE_DIRS})
+endif()
 
 
 if(WIN32 AND NOT MSVC)#not required for visual studio builds
@@ -700,6 +710,10 @@ endif()
 if(Iconv_FOUND)
 	target_link_libraries(common-main ${Iconv_LIBRARIES})
 endif()
+if(PCRE2_FOUND)
+	target_link_libraries(common-main ${PCRE2_LIBRARIES})
+	target_link_directories(common-main PUBLIC ${PCRE2_LIBRARY_DIRS})
+endif()
 if(WIN32)
 	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
 	add_dependencies(common-main git-rc)
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] Fix CMakeLists.txt on Linux.
  2022-05-24  6:38   ` [PATCH v2 1/2] Fix CMakeLists.txt on Linux Yuyi Wang via GitGitGadget
@ 2022-05-24 23:04     ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2022-05-24 23:04 UTC (permalink / raw)
  To: Yuyi Wang via GitGitGadget; +Cc: git, Derrick Stolee, Yuyi Wang

"Yuyi Wang via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Subject: Re: [PATCH v2 1/2] Fix CMakeLists.txt on Linux.

Perhaps

	Subject: cmake: fix CMakeLists on Linux

i.e. with a short and meaningful <area>: prefix, no need to
capitalize the first word after the prefix, without the terminating
full-stop.

From: Yuyi Wang <Strawberry_Str@hotmail.com>
>
> CMakeLists.txt didn't follow the grammar of `set`, and it will fail when
> setting `USE_VCPKG` off on non-Windows platforms.

So any non-Windows, the use of set() here was broken.  It is
understandable because cmake support was added primarily for
Windows.  It is nevertheless good to see it corrected.

> When the platform is Linux, the Makefile adds `compat/linux/procinfo.o`
> to `COMPAT_OBJS`, but the CMakeLists.txt didn't add
> `compat/linux/procinfo.c` to `compat_SOURCES`. It would cause linkage
> error.

OK.  I didn't know anybody cared about using cmake on non-Windows
platforms for this project.

Thanks, will queue, together with the other two patches.



> Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
> ---
>  contrib/buildsystems/CMakeLists.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> index 185f56f414f..7f333e303c2 100644
> --- a/contrib/buildsystems/CMakeLists.txt
> +++ b/contrib/buildsystems/CMakeLists.txt
> @@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
>  
>  option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
>  if(NOT WIN32)
> -	set(USE_VCPKG OFF CACHE BOOL FORCE)
> +	set(USE_VCPKG OFF CACHE BOOL "" FORCE)
>  endif()
>  
>  if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
> @@ -277,7 +277,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
>  
>  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
>  	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
> -	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c)
> +	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)
>  endif()
>  
>  if(CMAKE_SYSTEM_NAME STREQUAL "Windows")

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-24 23:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18  3:58 [PATCH] Add pcre2 support for cmake build system Yuyi Wang via GitGitGadget
2022-05-18 22:02 ` Junio C Hamano
2022-05-19 16:18   ` Yuyi Wang
2022-05-23 18:35     ` Derrick Stolee
2022-05-23 18:36   ` Derrick Stolee
2022-05-24  6:38 ` [PATCH v2 0/2] " Yuyi Wang via GitGitGadget
2022-05-24  6:38   ` [PATCH v2 1/2] Fix CMakeLists.txt on Linux Yuyi Wang via GitGitGadget
2022-05-24 23:04     ` Junio C Hamano
2022-05-24  6:38   ` [PATCH v2 2/2] Add pcre2 support for cmake build system Yuyi Wang via GitGitGadget

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).