Re: [PATCH 2/9] cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4
On Fri, Oct 21 2022, Phillip Wood wrote:
Show 27 quoted lines
> Hi Ævar
>
> On 21/10/2022 10:44, Ævar Arnfjörð Bjarmason wrote:
>> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
>> index fd0c6ef4971..464c41a1fdf 100644
>> --- a/contrib/buildsystems/CMakeLists.txt
>> +++ b/contrib/buildsystems/CMakeLists.txt
>> @@ -836,6 +836,7 @@ foreach(script ${git_shell_scripts})
>> string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
>> string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
>> file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
>> + execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/${script})
>
> I think it would be nicer to add a write_script function
>
> function(write_script path content)
> file(WRITE ${path} ${content})
> file(CHMOD ${path} FILE_PERMISSIONS OWNER_READ OWNER_WRITE
> OWNER_EXECUTE)
> endfunction()
>
> and then do
>
> - file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
> + write_script(${CMAKE_BINARY_DIR}/${script} "${content}")
>
> rather than executing chmod each timeThanks, I'll use that. It looks much nicer.