Skip to content

Releases: XiaoLey/fetch_paths.cmake

v0.1.0

21 Feb 14:33
d3b411b
Compare
Choose a tag to compare
v0.1.0 Pre-release
Pre-release

Overview

The fetch_paths function in CMake has been introduced to facilitate the retrieval of file or directory paths with comprehensive filtering and sorting abilities. This function is handy for projects needing to dynamically determine file lists based on specific criteria, such as file extensions, directory names, or exclusion rules.

New Features

  • Flexible Path Fetching: Users can now specify whether to fetch file paths or directory paths.
  • Comprehensive Filtering: Incorporates both output and exclude filter lists using regular expressions, allowing for precise path selection.
  • Recursive and Non-Recursive Searching: Supports searching within the specified directory and optionally in all its subdirectories.
  • Relative and Working Directory Specification: Facilitates the definition of relative paths and working directories for output.
  • Append Mode: Offers an option to append the retrieved paths to an existing list instead of overwriting it.
  • Exclusion Variables: Allows saving paths that do not meet the filter criteria to a separate variable for additional processing.

Parameters Introduced

  • Numerous parameters have been introduced to control the operation of fetch_paths, such as RELATIVE_PATH, WORKING_DIRECTORY, OUTPUT_FILTER_LIST, EXCLUDE_FILTER_LIST, and more, providing a highly customizable experience.

Default Behavior

  • The function defaults to fetching C/C++ source files in the CMAKE_CURRENT_SOURCE_DIR if no specific filters are applied.
  • Recursion is enabled by default, allowing for comprehensive directory traversal.

Potential Usage Scenarios

  • This function is ideal for projects that need to dynamically generate file lists for compilation or packaging, especially when dealing with a large number of files or complex directory structures.

Note

This is a pre-release version, and users are encouraged to test it thoroughly in their environments. Feedback and suggestions for improvement are welcome to refine the functionality further.