I am working on a simulation project: Taking an embedded C codebase from a target platform and trying to simulate it on a Host computer for debugging or single stepping into the code.
OS: Ubuntu Linux 14.04, IDE: CodeLite, Makefile Generator: Cmake. I am confused about how to write CMakeLists.txt for the project. Following is the structure of codebase (it's all written in C):
|ARQSim\
|-->ARQSim.h
|-->ARQSim.c
|-->BaseStationCode\
| |->downlink.c
| |->neoncopy.c
| |->armCore\
| | |->common\
| | | |->Bsconfig.h
| | | |->config.h
| | |->MacSource\
| | | |->lib\
| | | | |->arqCommon.h
| | | | |->OverTheAir.h
| | | |->source\
| | | | |->beacon.c
| | | | |->proxyDhcp.c
| | | | |->ARQ\
| | | | | |->arqCommon.c
| | | | | |->arqInterface.c
| | | | | |->fragmentation\
| | | | | | |->fragBookkeeping.c
| | | | | | |->fragProcessAck.c
| | | | | |->reassembly\
| | | | | | |->reasmBookkeeping.c
| | | | | | |->reasmProcessAck.c
I am totally new to Cmake. I have read up a lot of resources on CMake and threads here on StackOverflow. But I get confused every time. Few questions I have:
- Do I need only one CMakeLists.txt at root directory or every directory needs a different CMakeLists.txt file?
- How to add the source files recursively in CMakeLists.txt?
- What are the basic commands I need to put in CMakeLists.txt for MakeFile generation?
An example based on the structure of code mentioned above would be appreciated.