[CMake] Removing files from a globbed list

James C. Sutherland James.Sutherland at utah.edu
Mon Jun 22 10:43:14 EDT 2009


I am trying to add most files from a directory to a variable.  I first
glob the source files, and then want to remove the unwanted files from
the resulting string.  Here is what I have:

  set( empty "" )

  file( GLOB f90_src src/*.f90 )

  string( REPLACE
    ${PROJECT_SOURCE_DIR}/src/ark_m.f90
    ${empty}
    f90_src
    ${f90_src}
  )

  message( STATUS ${f90_src} )

The problem is that the file is not removed as you would expect.  The
message still outputs a string with both files in it...

Is there a better way to achieve this?

Thanks!

James


More information about the CMake mailing list