[CMake] regular expression help: set a variable for all source file

William A. Hoffman billlist at nycap.rr.com
Thu Mar 2 10:25:28 EST 2006


At 10:20 AM 3/2/2006, Grant Tang wrote:
>Hi,
>
>I have a mkdoc target, which is for extracting document information from all  C/C++ 
>and Python source files. I tried this setting:
>
>SET(MKDOCSRCS 
>        "@SOURCE_DIR@/subdir1/\\.(C|c|cpp|py)$"
>        "@SOURCE_DIR@/subdir2/\\.(C|c|cpp|py)$"
>        "@SOURCE_DIR@/subdir3/\\.(C|c|cpp|py)$"
>        )
>ADD_CUSTOM_TARGET( mkdoc
>        DEPENDS ${MKDOCSRCS}
>)
>
>But my cmake complain:
>
>CMake Error: can not find file /home/gtang/EMAN/src/eman/boxer/\.(C|c|cpp|py)$
>
>Tried .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h++ .hm .hpp .hxx .in .txx
>
>Could somebody help me out?

You can not depend on a regular expression.   You may want to try the 
  FILE(GLOB variable [globbing expressions]...)

-Bill




More information about the CMake mailing list