Alex Vergara
Alex Vergara

Reputation: 2248

CMake way of wildcard values on set variables

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:

and all the source files under the

Upvotes: 1

Views: 1390

Answers (1)

Etienne Chanudet
Etienne Chanudet

Reputation: 56

One solution is to replace set() by:

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

and same thing for your source files.

Upvotes: 2

Related Questions