Yes, you have two options. Let's assume you the folder structure something similar to this.
├── autopilot
│ ├── _AutoPilot.cpp
│ ├── _AutoPilot.h
│ └── action
│ ├── ActionBase.cpp
│ ├── ActionBase.h
│ ├── APcopter
│ │ ├── APcopter_avoid.cpp
│ │ ├── APcopter_avoid.h
If you are to use AUX_SOURCE_DIRECTORY
you have to add CMakeLists.txt each one of sub directories. Then you have to include and link all those subdirectories. This is quite a difficult task. So you can you GLOB and do the job very easily. This is how it is done.
file(GLOB autopilot_sources ./**.cpp ./**.c)
SET( autopilot ${autopilot_sources})
If you want to create a library using above source code this is the command:
ADD_LIBRARY ( autopilot ${autopilot_sources})
TARGET_LINK_LIBRARIES ( autopilot)
If you want to create an executable file using above source code this is the command:
ADD_EXECUTABLE(autopilot ${autopilot_sources})