[CMake] How to find_file by pattern

Laurent Humbertclaude laurent.humbertclaude at gmail.com
Tue Feb 26 10:29:19 EST 2008


Hi,

while writing a FindXXX.cmake module,
I am trying to figure out the version of the library.
The library use an empty file in the root directory of the source package.
The file is named THIS_IS_OMNIORB_X_Y_Z without extension

Using a file glob like
 FILE(GLOB OMNIORB_VERSION_FILE THIS_IS_OMNIORB_* )
does not works because it looks in the source dir and I haven't found
a way to specify the base directory

Is there another option than listing every version number I know of ?

FIND_FILE(OMNIORB_VERSION_FILE NAMES
  THIS_IS_OMNIORB_4_0_5
  THIS_IS_OMNIORB_4_1_0
  THIS_IS_OMNIORB_4_1_1
PATHS
  ${OMNIORB_ROOT_DIR}
)

This works but it is far from future proof.

Thanks,

Laurent


More information about the CMake mailing list