1aux_source_directory 2-------------------- 3 4Find all source files in a directory. 5 6.. code-block:: cmake 7 8 aux_source_directory(<dir> <variable>) 9 10Collects the names of all the source files in the specified directory 11and stores the list in the ``<variable>`` provided. This command is 12intended to be used by projects that use explicit template 13instantiation. Template instantiation files can be stored in a 14``Templates`` subdirectory and collected automatically using this 15command to avoid manually listing all instantiations. 16 17It is tempting to use this command to avoid writing the list of source 18files for a library or executable target. While this seems to work, 19there is no way for CMake to generate a build system that knows when a 20new source file has been added. Normally the generated build system 21knows when it needs to rerun CMake because the ``CMakeLists.txt`` file is 22modified to add a new source. When the source is just added to the 23directory without modifying this file, one would have to manually 24rerun CMake to generate a build system incorporating the new file. 25