<div><div dir="auto">Latest CMake documentation can be found here:</div></div><div dir="auto"><br></div><div dir="auto"><div><a href="https://cmake.org/cmake/help/latest/">https://cmake.org/cmake/help/latest/</a></div><br></div><div dir="auto">Searching for GLOB_RECURSE there leads to this page:</div><div dir="auto"><br></div><div dir="auto"><div><a href="https://cmake.org/cmake/help/latest/command/file.html">https://cmake.org/cmake/help/latest/command/file.html</a></div><div dir="auto"><br></div><div dir="auto">Which is the command you are using. Docs for the command and option you are using are here:</div><div dir="auto"><br></div><div dir="auto"><div><a href="https://cmake.org/cmake/help/latest/command/file.html?highlight=glob_recurse#glob-recurse">https://cmake.org/cmake/help/latest/command/file.html?highlight=glob_recurse#glob-recurse</a></div><br></div><div dir="auto">As for your issue, you are misunderstanding the purpose of RELATIVE. That means the paths you get path will be relative to that path, not that it searches from that path. So you are just searching for “*.cpp” and “*.c” in the CURRENT directory. That is why you are getting files in all the subdirs. As @frodak pointed out in his first example, you need to remove the RELATIVE and put the dir name you want like “./dir/*.cpp”.</div><div dir="auto"><br></div><div dir="auto">Once you do that, you should be good to go. All of the above is explained pretty clearly in the linked docs.</div><div dir="auto"><br></div><div dir="auto">-Caleb</div></div><div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 25, 2018 at 9:57 PM Michael Hennebry <<a href="mailto:michael.hennebry@rivieranexus.com">michael.hennebry@rivieranexus.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---------- Forwarded message ----------<br>
From: Michael Hennebry <<a href="mailto:michael.hennebry@rivieranexus.com" target="_blank">michael.hennebry@rivieranexus.com</a>><br>
Date: Wed, Jul 25, 2018 at 8:55 PM<br>
Subject: Re: [CMake] GLOB_RECURSE<br>
To: Andrew Bell <<a href="mailto:andrew.bell.ia@gmail.com" target="_blank">andrew.bell.ia@gmail.com</a>><br>
<br>
<br>
I'd thought I was clear.<br>
I want two lists of files, one from each of two directory trees.<br>
Maybe GLOB_RECURSE does not do that.<br>
If not, I can live without.<br>
<br>
What does it do?<br>
<br>
Maybe you have used cmake long enough for the answer to be obvious.<br>
I have to read documentation or ask people.<br>
The former has not been all that helpful.<br>
<br>
What I have been getting is what appears to be the same list twice.<br>
It includes files from three directory trees.<br>
<br>
On Wed, Jul 25, 2018 at 8:19 PM, Andrew Bell <<a href="mailto:andrew.bell.ia@gmail.com" target="_blank">andrew.bell.ia@gmail.com</a>> wrote:<br>
> Michael,<br>
><br>
> It's not clear what you're asking. You need to say what you're trying to<br>
> achieve, your expected result, and the result that you believe incorrect.<br>
><br>
> On Wed, Jul 25, 2018, 9:02 PM Michael Hennebry<br>
> <<a href="mailto:michael.hennebry@rivieranexus.com" target="_blank">michael.hennebry@rivieranexus.com</a>> wrote:<br>
>><br>
>> frodak wrote:<br>
>> I think you want to try for absolute paths:<br>
>> file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)<br>
>> file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)<br>
>><br>
>> relative paths from those directories:<br>
>> file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/<br>
>> ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)<br>
>> file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp<br>
>> ./SensorUnit/*.c)<br>
>> :frodak<br>
>><br>
>> I do not understand either your constructions or mine.<br>
>> I do not know how cmake interprets any of them,<br>
>> nor how anyone would know.<br>
>> What documentation I can find, <a href="http://cmake.org" rel="noreferrer" target="_blank">cmake.org</a>, has not been helpful..<br>
>><br>
>> Mike<br>
>><br>
>><br>
>> On Wed, Jul 25, 2018 at 7:02 PM, frodak <<a href="mailto:frodak17@gmail.com" target="_blank">frodak17@gmail.com</a>> wrote:<br>
>> > I think you want to try for absolute paths:<br>
>> > file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)<br>
>> > file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)<br>
>> ><br>
>> > relative paths from those directories:<br>
>> > file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/<br>
>> > ./ArduinoCore/src/*.cpp<br>
>> > ./ArduinoCore/src/*.c)<br>
>> > file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp<br>
>> > ./SensorUnit/*.c)<br>
>> ><br>
>> ><br>
>> ><br>
>> > On Wed, Jul 25, 2018 at 6:47 PM, Michael Hennebry<br>
>> > <<a href="mailto:michael.hennebry@rivieranexus.com" target="_blank">michael.hennebry@rivieranexus.com</a>> wrote:<br>
>> >><br>
>> >> Emphasis on curse.<br>
>> >><br>
>> >> from CMakeLists.txt:<br>
>> >><br>
>> >> file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)<br>
>> >> file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)<br>
>> >><br>
>> >> message("apps:;${apps};:apps")<br>
>> >> message("ards:;${ards};:ards")<br>
>> >><br>
>> >> Both lists have ArduinoCore and SensorUnit sources.<br>
>> >> They both have precisely 57 entries.<br>
>> >> They both have three entries from sb-build.<br>
>> >><br>
>> >> What is going on?<br>
>> >><br>
>> >> From the siblings' parent:<br>
>> >> $ ls -F<br>
>> >> ArduinoCore/    SensorUnit/              generic-gcc-avr.cmake<br>
>> >> CMakeLists.txt  from-build-directory.sh  sb-build/<br>
>> >><br>
>> >> I tried RELATIVE.<br>
>> >> I tried replacing the dot with ${CMAKE_SOURCE_DIR}.<br>
>> >> All to no avail.<br>
>> >><br>
>> >> I'm stumped.<br>
>> >> --<br>
>> >><br>
>> >> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>> >><br>
>> >> Please keep messages on-topic and check the CMake FAQ at:<br>
>> >> <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>> >><br>
>> >> Kitware offers various services to support the CMake community. For<br>
>> >> more<br>
>> >> information on each offering, please visit:<br>
>> >><br>
>> >> CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
>> >> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
>> >> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
>> >><br>
>> >> Visit other Kitware open-source projects at<br>
>> >> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >><br>
>> >> Follow this link to subscribe/unsubscribe:<br>
>> >> <a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
>> ><br>
>> ><br>
>> --<br>
>><br>
>> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>><br>
>> Please keep messages on-topic and check the CMake FAQ at:<br>
>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>><br>
>> Kitware offers various services to support the CMake community. For more<br>
>> information on each offering, please visit:<br>
>><br>
>> CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
>> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Sent from my iPhone 4s</div>