add_subdirectory

add_subdirectory

Content #

add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL])

This command will look for a CMakeLists.txt file in the source_dir path (evaluated relative to the current directory).

• Variable changes are isolated to the nested scope. • You’re free to configure the nested artifacts however you like. • Changing the nested CMakeLists.txt file doesn’t require building unrelated targets. • Paths are local to the directory, and they can even be added to the parent include path if desired.

From #