kovac
kovac

Reputation: 5389

How to find the path to a file recursively using CMake?

I have placed some header files in a subdirectory next to CMakeLists.txt called "dependencies". I want to search this directory recursively to find a header file. I'm trying the below command, but it's not working:

find_path(ALLEGRO_INCLUDE_DIR NAMES "allegro*.h" PATHS ${CMAKE_CURRENT_SOURCE_DIR})

Upvotes: 0

Views: 1873

Answers (1)

Levi Wu
Levi Wu

Reputation: 66

You can use the following command instead:

file(GLOB_RECURSE ALLEGRO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/allegro*.h")

Upvotes: 1

Related Questions