I have the following directory structure.
root
--src
---tests
src
contains the source & header files (C files) for the application. When this application is built, it generates an executable. tests
directory contains unit test cases (C++ files, using UnitTest++
as testing framework) for the application.
In the testing project, I can include header files from src
directory and compile will pass. Problems occur at the link time. Linker won't be able find the object files in the source directory.
How can I solve this? What is the normal practice in C & C++ projects for having one executable for main application and other one for tests where both needs the same source files to work with?
- Application type : Cross platform.
- Current development env : Linux
- Build tool : CMake
Any help would be great!