[CMake] FindMKL.cmake

Michael Wild themiwi at gmail.com
Thu Feb 10 10:01:56 EST 2011


On 02/10/2011 04:00 PM, David Cole wrote:
> On Thu, Feb 10, 2011 at 8:01 AM, Michael Wild <themiwi at gmail.com> wrote:
> 
>> On 02/10/2011 01:52 PM, David Cole wrote:
>>> On Thu, Feb 10, 2011 at 2:50 AM, Robert Bielik <robert.bielik at xponaut.se
>>> wrote:
>>> Michael Wild skrev 2011-02-09 16:48:
>>>
>>>>
>>>>  what about this:
>>>>>
>>>>> file(GLOB_RECURSE glob_results "/some/pattern*")
>>>>> set(dirs)
>>>>> foreach(f IN LISTS glob_results)
>>>>>   get_filename_component(d "${f}" PATH)
>>>>>   list(APPEND dirs "${d}")
>>>>> endforeach()
>>>>> list(REMOVE_DUPLICATES dirs)
>>>>>
>>>>
>>>> Yeah, works fine but it seems to be a lot slower than using the nested
>>>> file(GLOB...) macro approach, but I don't know why.
>>>>
>>>
>>>
>>> Probably because there are thousands of files, but only tens of
>> directories.
>>> Bang! 100x slower.
>>>
>>
>> But the other macro also touches every file and directory and is even
>> recursive. I think the real cost is in the list(REMOVE_DUPLICATES) call.
>>
> 
> 
> Absolutely. But the number of elements in that list will be the number of
> files encountered in the full recursive glob, which is probably much larger
> than the number of elements conditionally added to the list involved in the
> macro approach.
> 

Correct, that's what I was getting at.


More information about the CMake mailing list