On 8/14/07, Martin Lutken <[EMAIL PROTECTED]> wrote:
> It seems to me that many existing SW libraries, which it would be nice to have
> converted to cmake, cannot too easily make use of the fileglobbing since
> quite often, there are a few files which you don't want to compile in order
> to produce the library.
>
> So a syntax like :
> FILE (GLOB files "*.c" EXCEPT main.c test.c)
> or
> FILE (GLOB files "*.c" EXCLUDE main.c test.c)

With the classic GLOB search, it is trivial to remove items from the
result list:
LIST(REMOVE_ITEM files
  ${CMAKE_CURRENT_SOURCE_DIR}/main.c
  ${CMAKE_CURRENT_SOURCE_DIR}/test.c)

With the GLOB_RECURSE command, it is more tricky. But you can filter
items by using regular expressions:

FILE(GLOB_RECURSE files "*.c")
FOREACH(item ${files})
  IF(${item} MATCHES "foo/main.c")
    LIST(REMOVE_ITEM files ${item})
  ENDIF(${item} MATCHES "foo/main.c")
ENDFOREACH(item)
MESSAGE(STATUS "${files}")

-- 
Tristan Carel
Music with dinner is an insult both to the cook and the violinist.
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to