[CMake] Removing files from a globbed list

Adolfo Rodríguez dofo79 at gmail.com
Mon Jun 22 10:47:14 EDT 2009


On Mon, Jun 22, 2009 at 4:43 PM, James C. Sutherland <
James.Sutherland at utah.edu> wrote:

> 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?


Try

list(REMOVE_ITEM <list> <value> [<value> ...])

See http://www.cmake.org/cmake/help/cmake2.6docs.html#command:list


>
> Thanks!
>
> James
> _______________________________________________
> 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
>



-- 
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090622/d0b03ff6/attachment.htm>


More information about the CMake mailing list