[CMake] find_file/find_path recursive

James Bigler jamesbigler at gmail.com
Thu Sep 24 14:48:08 EDT 2009


Perhaps you could use file(GLOB_RECURSE).

            file(GLOB_RECURSE variable [RELATIVE path]
                 [FOLLOW_SYMLINKS] [globbing expressions]...)

See manual for the "file" command.

James

On Thu, Sep 24, 2009 at 4:36 AM, Pablo Yanez Trujillo <
shaoran at sakuranohana.org> wrote:

> Hi
>
> I've already read the online documentation but I don't find anything
> about it. I'm want to use 'find_path'. I only have the installation
> prefix of a project and I would want to search recursively in this
> directory. I've thought of something like that:
>
> set(ABC_INSTALL_PREFIX "" CACHE PATH "Install Prefix of abc project")
>
> find_path(ABC_PACKAGE_FILE abc-config.cmake PATHS ${ABC_INSTALL_PREFIX}
> NO_DEFAULT_PATH)
>
> if(NOT ${ABC_PACKAGE_FILE})
>  message(FATAL_ERROR "Could not find abc-config.cmake. Set
> ABC_INSTALL_PREFIX properly.")
> endif()
>
> set(abc_DIR ${ABC_PACKAGE_FILE})
> find_package(abc)
>
> but this only works when the abc-config.cmake file is stored in
> ${ABC_INSTALL_PREFIX}. This is not the case, hence I would want to
> search for it recursively in ${ABC_INSTALL_PREFIX}, but I don't know how
> to manage it.
>
> Is it actually posible to search recursively with find_path?
>
> Pablo
>
> --
> Pablo Yanez Trujillo
> OpenPGP Key: http://www.sakuranohana.org/gpg/shaoran.asc
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090924/9872c9af/attachment.htm>


More information about the CMake mailing list