[cmake-developers] speed up package with mingw on Windows host

laurent laurent at mbdsys.com
Mon Jun 20 14:49:09 EDT 2016


Let’s make a demonstration by example :

// With grep
$ objdump -p /c/msys32/mingw32.exe | grep "^[[:blank:]]*DLL Name: "
	DLL Name: KERNEL32.dll
	DLL Name: msvcrt.dll
	DLL Name: USER32.dll

// With findstr
$ objdump -p /c/msys32/mingw32.exe | findstr "^[[:blank:]]*DLL Name: "
	DLL Name: KERNEL32.dll
	DLL Name: msvcrt.dll
	DLL Name: USER32.dll

Outputs are identical.

Attached a git patch against current cmake master branch. (I will make later another patch about *GET_PREREQUISITES_ANALYZED_${target}*)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-findstr-instead-of-grep-on-Windows-host-in-conjo.patch
Type: application/octet-stream
Size: 1067 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160620/725423d9/attachment.obj>
-------------- next part --------------



Laurent


> Le 20 juin 2016 à 16:48, Brad King <brad.king at kitware.com> a écrit :
> 
> On 06/18/2016 12:10 PM, laurent wrote:
>> I would like to share my experience about speed up package with BundleUtilities
>> on Windows host using mingw32 env.
> 
> Thanks.  Please provide a
> 
>  Full Name <email at address>
> 
> format name for the commit authorship record.
> 
>> -    find_program(gp_grep_cmd grep)
>> +    if(WIN32)
>> +      find_program(gp_grep_cmd findstr)
>> +    else()
>> +      find_program(gp_grep_cmd grep)
>> +    endif()
> 
> Good.  Is `findstr` command-line compatible with `grep` for the use case
> in question?
> 
>> +    GET_PROPERTY(MyLocalVariable GLOBAL PROPERTY MY_PREREQUISE)
>> +    list(APPEND analysed ${MyLocalVariable} ${target})
>> +    list(REMOVE_DUPLICATES analysed) 
>> +    SET_PROPERTY(GLOBAL PROPERTY MY_PREREQUISE ${analysed})
> 
> Rather than maintaining and searching a list in CMake code, please try
> recording each target in a dedicated variable or property name, e.g.
> `GET_PREREQUISITES_ANALYZED_${target}`.
> 
> Thanks,
> -Brad
> 



More information about the cmake-developers mailing list