On 1. Jul, 2010, at 9:45 , Diablo 666 wrote:

> 
> Hi,
> 
> I'm currently trying to use the following line to include all source files 
> into my build:
> 
> file (GLOB_RECURSE Files_CPP *.cpp)
> add_executable(test
>    ${Files_CPP}
> )
> 
> Everything runs fine while using an out-of-source build, but for in-source 
> builds these lines include .cpp files from the CMakeFiles directory. Is there 
> any way to exclude this directory within the file command?
> 
> Best regards,
> Andreas

1. Never use GLOB_RECURSE. It's evil. E.g. if you add or remove source files, 
CMake has no way of knowing that it should be re-run. Just list all the files 
in your CMakeLists.txt (or, if you think the list is excessively long, create a 
file called e.g. files.cmake, put the list in there and INCLUDE it in the 
CMakeLists.txt file.

2. Never do in-source builds. CMake creates many, many files, and you don't 
want to delete them all individually for a clean build. And there's no way to 
implement a safe "make clean" (e.g. your build system might be running a custom 
utility which generates files CMake knows nothing about).

HTH

Michael

_______________________________________________
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

Reply via email to