GLOB_RECURSE

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

GLOB_RECURSE

Michael Hennebry
Emphasis on curse.

from CMakeLists.txt:

file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)
file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)

message("apps:;${apps};:apps")
message("ards:;${ards};:ards")

Both lists have ArduinoCore and SensorUnit sources.
They both have precisely 57 entries.
They both have three entries from sb-build.

What is going on?

From the siblings' parent:
$ ls -F
ArduinoCore/    SensorUnit/              generic-gcc-avr.cmake
CMakeLists.txt  from-build-directory.sh  sb-build/

I tried RELATIVE.
I tried replacing the dot with ${CMAKE_SOURCE_DIR}.
All to no avail.

I'm stumped.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: GLOB_RECURSE

frodak
I think you want to try for absolute paths:
file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)

relative paths from those directories:
file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/ ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp ./SensorUnit/*.c)



On Wed, Jul 25, 2018 at 6:47 PM, Michael Hennebry <[hidden email]> wrote:
Emphasis on curse.

from CMakeLists.txt:

file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)
file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)

message("apps:;${apps};:apps")
message("ards:;${ards};:ards")

Both lists have ArduinoCore and SensorUnit sources.
They both have precisely 57 entries.
They both have three entries from sb-build.

What is going on?

From the siblings' parent:
$ ls -F
ArduinoCore/    SensorUnit/              generic-gcc-avr.cmake
CMakeLists.txt  from-build-directory.sh  sb-build/

I tried RELATIVE.
I tried replacing the dot with ${CMAKE_SOURCE_DIR}.
All to no avail.

I'm stumped.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: GLOB_RECURSE

Michael Hennebry
frodak wrote:
I think you want to try for absolute paths:
file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)

relative paths from those directories:
file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/
./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
./SensorUnit/*.c)
:frodak

I do not understand either your constructions or mine.
I do not know how cmake interprets any of them,
nor how anyone would know.
What documentation I can find, cmake.org, has not been helpful..

Mike


On Wed, Jul 25, 2018 at 7:02 PM, frodak <[hidden email]> wrote:

> I think you want to try for absolute paths:
> file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
> file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)
>
> relative paths from those directories:
> file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/ ./ArduinoCore/src/*.cpp
> ./ArduinoCore/src/*.c)
> file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
> ./SensorUnit/*.c)
>
>
>
> On Wed, Jul 25, 2018 at 6:47 PM, Michael Hennebry
> <[hidden email]> wrote:
>>
>> Emphasis on curse.
>>
>> from CMakeLists.txt:
>>
>> file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)
>> file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)
>>
>> message("apps:;${apps};:apps")
>> message("ards:;${ards};:ards")
>>
>> Both lists have ArduinoCore and SensorUnit sources.
>> They both have precisely 57 entries.
>> They both have three entries from sb-build.
>>
>> What is going on?
>>
>> From the siblings' parent:
>> $ ls -F
>> ArduinoCore/    SensorUnit/              generic-gcc-avr.cmake
>> CMakeLists.txt  from-build-directory.sh  sb-build/
>>
>> I tried RELATIVE.
>> I tried replacing the dot with ${CMAKE_SOURCE_DIR}.
>> All to no avail.
>>
>> I'm stumped.
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
>
>
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: GLOB_RECURSE

Andrew Bell
Michael,

It's not clear what you're asking. You need to say what you're trying to achieve, your expected result, and the result that you believe incorrect.

On Wed, Jul 25, 2018, 9:02 PM Michael Hennebry <[hidden email]> wrote:
frodak wrote:
I think you want to try for absolute paths:
file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)

relative paths from those directories:
file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/
./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
./SensorUnit/*.c)
:frodak

I do not understand either your constructions or mine.
I do not know how cmake interprets any of them,
nor how anyone would know.
What documentation I can find, cmake.org, has not been helpful..

Mike


On Wed, Jul 25, 2018 at 7:02 PM, frodak <[hidden email]> wrote:
> I think you want to try for absolute paths:
> file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
> file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)
>
> relative paths from those directories:
> file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/ ./ArduinoCore/src/*.cpp
> ./ArduinoCore/src/*.c)
> file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
> ./SensorUnit/*.c)
>
>
>
> On Wed, Jul 25, 2018 at 6:47 PM, Michael Hennebry
> <[hidden email]> wrote:
>>
>> Emphasis on curse.
>>
>> from CMakeLists.txt:
>>
>> file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)
>> file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)
>>
>> message("apps:;${apps};:apps")
>> message("ards:;${ards};:ards")
>>
>> Both lists have ArduinoCore and SensorUnit sources.
>> They both have precisely 57 entries.
>> They both have three entries from sb-build.
>>
>> What is going on?
>>
>> From the siblings' parent:
>> $ ls -F
>> ArduinoCore/    SensorUnit/              generic-gcc-avr.cmake
>> CMakeLists.txt  from-build-directory.sh  sb-build/
>>
>> I tried RELATIVE.
>> I tried replacing the dot with ${CMAKE_SOURCE_DIR}.
>> All to no avail.
>>
>> I'm stumped.
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
>
>
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Fwd: GLOB_RECURSE

Michael Hennebry
---------- Forwarded message ----------
From: Michael Hennebry <[hidden email]>
Date: Wed, Jul 25, 2018 at 8:55 PM
Subject: Re: [CMake] GLOB_RECURSE
To: Andrew Bell <[hidden email]>


I'd thought I was clear.
I want two lists of files, one from each of two directory trees.
Maybe GLOB_RECURSE does not do that.
If not, I can live without.

What does it do?

Maybe you have used cmake long enough for the answer to be obvious.
I have to read documentation or ask people.
The former has not been all that helpful.

What I have been getting is what appears to be the same list twice.
It includes files from three directory trees.

On Wed, Jul 25, 2018 at 8:19 PM, Andrew Bell <[hidden email]> wrote:

> Michael,
>
> It's not clear what you're asking. You need to say what you're trying to
> achieve, your expected result, and the result that you believe incorrect.
>
> On Wed, Jul 25, 2018, 9:02 PM Michael Hennebry
> <[hidden email]> wrote:
>>
>> frodak wrote:
>> I think you want to try for absolute paths:
>> file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
>> file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)
>>
>> relative paths from those directories:
>> file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/
>> ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
>> file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
>> ./SensorUnit/*.c)
>> :frodak
>>
>> I do not understand either your constructions or mine.
>> I do not know how cmake interprets any of them,
>> nor how anyone would know.
>> What documentation I can find, cmake.org, has not been helpful..
>>
>> Mike
>>
>>
>> On Wed, Jul 25, 2018 at 7:02 PM, frodak <[hidden email]> wrote:
>> > I think you want to try for absolute paths:
>> > file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
>> > file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)
>> >
>> > relative paths from those directories:
>> > file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/
>> > ./ArduinoCore/src/*.cpp
>> > ./ArduinoCore/src/*.c)
>> > file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
>> > ./SensorUnit/*.c)
>> >
>> >
>> >
>> > On Wed, Jul 25, 2018 at 6:47 PM, Michael Hennebry
>> > <[hidden email]> wrote:
>> >>
>> >> Emphasis on curse.
>> >>
>> >> from CMakeLists.txt:
>> >>
>> >> file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)
>> >> file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)
>> >>
>> >> message("apps:;${apps};:apps")
>> >> message("ards:;${ards};:ards")
>> >>
>> >> Both lists have ArduinoCore and SensorUnit sources.
>> >> They both have precisely 57 entries.
>> >> They both have three entries from sb-build.
>> >>
>> >> What is going on?
>> >>
>> >> From the siblings' parent:
>> >> $ ls -F
>> >> ArduinoCore/    SensorUnit/              generic-gcc-avr.cmake
>> >> CMakeLists.txt  from-build-directory.sh  sb-build/
>> >>
>> >> I tried RELATIVE.
>> >> I tried replacing the dot with ${CMAKE_SOURCE_DIR}.
>> >> All to no avail.
>> >>
>> >> I'm stumped.
>> >> --
>> >>
>> >> Powered by www.kitware.com
>> >>
>> >> Please keep messages on-topic and check the CMake FAQ at:
>> >> http://www.cmake.org/Wiki/CMake_FAQ
>> >>
>> >> Kitware offers various services to support the CMake community. For
>> >> more
>> >> information on each offering, please visit:
>> >>
>> >> CMake Support: http://cmake.org/cmake/help/support.html
>> >> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> >> CMake Training Courses: http://cmake.org/cmake/help/training.html
>> >>
>> >> Visit other Kitware open-source projects at
>> >> http://www.kitware.com/opensource/opensource.html
>> >>
>> >> Follow this link to subscribe/unsubscribe:
>> >> https://cmake.org/mailman/listinfo/cmake
>> >
>> >
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: GLOB_RECURSE

J. Caleb Wherry
Latest CMake documentation can be found here:

Searching for GLOB_RECURSE there leads to this page:


Which is the command you are using. Docs for the command and option you are using are here:

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”.

Once you do that, you should be good to go. All of the above is explained pretty clearly in the linked docs.

-Caleb

On Wed, Jul 25, 2018 at 9:57 PM Michael Hennebry <[hidden email]> wrote:
---------- Forwarded message ----------
From: Michael Hennebry <[hidden email]>
Date: Wed, Jul 25, 2018 at 8:55 PM
Subject: Re: [CMake] GLOB_RECURSE
To: Andrew Bell <[hidden email]>


I'd thought I was clear.
I want two lists of files, one from each of two directory trees.
Maybe GLOB_RECURSE does not do that.
If not, I can live without.

What does it do?

Maybe you have used cmake long enough for the answer to be obvious.
I have to read documentation or ask people.
The former has not been all that helpful.

What I have been getting is what appears to be the same list twice.
It includes files from three directory trees.

On Wed, Jul 25, 2018 at 8:19 PM, Andrew Bell <[hidden email]> wrote:
> Michael,
>
> It's not clear what you're asking. You need to say what you're trying to
> achieve, your expected result, and the result that you believe incorrect.
>
> On Wed, Jul 25, 2018, 9:02 PM Michael Hennebry
> <[hidden email]> wrote:
>>
>> frodak wrote:
>> I think you want to try for absolute paths:
>> file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
>> file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)
>>
>> relative paths from those directories:
>> file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/
>> ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
>> file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
>> ./SensorUnit/*.c)
>> :frodak
>>
>> I do not understand either your constructions or mine.
>> I do not know how cmake interprets any of them,
>> nor how anyone would know.
>> What documentation I can find, cmake.org, has not been helpful..
>>
>> Mike
>>
>>
>> On Wed, Jul 25, 2018 at 7:02 PM, frodak <[hidden email]> wrote:
>> > I think you want to try for absolute paths:
>> > file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
>> > file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)
>> >
>> > relative paths from those directories:
>> > file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/
>> > ./ArduinoCore/src/*.cpp
>> > ./ArduinoCore/src/*.c)
>> > file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
>> > ./SensorUnit/*.c)
>> >
>> >
>> >
>> > On Wed, Jul 25, 2018 at 6:47 PM, Michael Hennebry
>> > <[hidden email]> wrote:
>> >>
>> >> Emphasis on curse.
>> >>
>> >> from CMakeLists.txt:
>> >>
>> >> file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)
>> >> file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)
>> >>
>> >> message("apps:;${apps};:apps")
>> >> message("ards:;${ards};:ards")
>> >>
>> >> Both lists have ArduinoCore and SensorUnit sources.
>> >> They both have precisely 57 entries.
>> >> They both have three entries from sb-build.
>> >>
>> >> What is going on?
>> >>
>> >> From the siblings' parent:
>> >> $ ls -F
>> >> ArduinoCore/    SensorUnit/              generic-gcc-avr.cmake
>> >> CMakeLists.txt  from-build-directory.sh  sb-build/
>> >>
>> >> I tried RELATIVE.
>> >> I tried replacing the dot with ${CMAKE_SOURCE_DIR}.
>> >> All to no avail.
>> >>
>> >> I'm stumped.
>> >> --
>> >>
>> >> Powered by www.kitware.com
>> >>
>> >> Please keep messages on-topic and check the CMake FAQ at:
>> >> http://www.cmake.org/Wiki/CMake_FAQ
>> >>
>> >> Kitware offers various services to support the CMake community. For
>> >> more
>> >> information on each offering, please visit:
>> >>
>> >> CMake Support: http://cmake.org/cmake/help/support.html
>> >> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> >> CMake Training Courses: http://cmake.org/cmake/help/training.html
>> >>
>> >> Visit other Kitware open-source projects at
>> >> http://www.kitware.com/opensource/opensource.html
>> >>
>> >> Follow this link to subscribe/unsubscribe:
>> >> https://cmake.org/mailman/listinfo/cmake
>> >
>> >
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
--
Sent from my iPhone 4s

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: GLOB_RECURSE

Dan Liew
In reply to this post by Michael Hennebry
On 25 July 2018 at 23:47, Michael Hennebry
<[hidden email]> wrote:
> Emphasis on curse.
>
> from CMakeLists.txt:
>
> file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)
> file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)

Your syntax is wrong. `./ArduinoCore/src`, ` ./SensorUnit`, `*.cpp`,
`*.c` are all being treated as separate glob expressions so `*.cpp`
and `*.c` recursively match the current directory.
If you look at the signature of the function you're calling

```

file(GLOB_RECURSE <variable> [FOLLOW_SYMLINKS]
     [LIST_DIRECTORIES true|false] [RELATIVE <path>]
     [<globbing-expressions>...])
```

you can see that all your arguments after `ards` and `apps` are being
treated as `<globbing-expressions>`.
Instead you want something like this

file(GLOB_RECURSE ards RELATIVE ArduinoCore/src *.cpp *.c)
file (GLOB_RECURSE apps RELATIVE ./SensorUnit *.cpp *.c)

Note the use of the `RELATIVE` argument. See
https://cmake.org/cmake/help/v3.10/command/file.html for more details.

Hope that helps.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: GLOB_RECURSE

Michael Hennebry
In reply to this post by J. Caleb Wherry
I finally found the ellipses.

On Wed, Jul 25, 2018 at 9:48 PM, J. Caleb Wherry <[hidden email]> wrote:
> Latest CMake documentation can be found here:

> https://cmake.org/cmake/help/latest/command/file.html?highlight=glob_recurse#glob-recurse

That is what I was using, albeit badly.

> 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”.

Ah.  The top level directories are not list separately.

> Once you do that, you should be good to go. All of the above is explained
> pretty clearly in the linked docs.

Yes, they are.
My "interpretation" was too heavily influenced by an example even
worse than mine.

Thanks.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake