1

I have the next snippet on a CMake based project

set(Headers
    ./include/MyLib/main.hpp
)
set(Sources
    src/main.cpp
)

add_library(${This} STATIC ${Headers} ${Sources})

How can I indicate to recursively include all the interface files under the:

  • ./include/MyLib/{ /* File name here */ }.ixx

and all the source files under the

  • src/{ /* File name here */ }.cpp
Alex Vergara
  • 1,766
  • 1
  • 10
  • 29
  • 1
    Using globbing in CMake for this purpose is usually no good idea. See [this answers](https://stackoverflow.com/a/1060061/7703564). – Jodocus Jan 05 '22 at 15:49

1 Answers1

2

One solution is to replace set() by:

file(
  GLOB_RECURSE
  Headers
  ./include/MyLib/*.ixx
)

and same thing for your source files.