From: Phillip Wood Date: Fri, 21 Oct 2022 14:18:16 GMT Subject: Re: [PATCH 2/9] cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4 Message-ID: <0fda0e54-0432-7690-74a7-3d1a59923e0c@dunelm.org.uk> In-Reply-To: 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 time Best Wishes Phillip