4.2.2. Externally Managed Build¶
Build systems not managed by Eclipse.
- Recommended (needed) for existing projects.
- Any build system that supports command line build can be covered using this mechanism. (e.g. Using MSVC)
It involves these steps:
- Add the source within Eclipse
- Tell Eclipse how to build it.
- (Optionally) Fix Indexing
Since we are covering ZLib source in this book, let’s have a walk through how that code is imported / built into Eclipse.
For our example, ZLib is present in C:\sw\src\zlib\1.2.3\zlib-1.2.3
And the build commands is
make -f win32/Makefile.gcc LOC="-DDEBUG -g" all
Follow the steps as shown below to import any Makefile based project into Eclipse.
The parameters in steps marked [X] might have to be adapted other projects.
Create a new C Project. File ‣ New ‣Project, C Project (Select C++ Project if your project is based on C++`)
[X] Set project name as Zlib-1.2.3
Unset Use default location
[X] Set Location as C:\sw\src\zlib\1.2.3\zlib-1.2.3
Set Project Type as Makefile project ‣ Empty Project
Set Toolchain as MinGW GCC (On Linux, select Linux GCC)
Click Next button
Click Advanced Settings
Select the option, C/C++ Build
Change the build command to
make -f win32/Makefile.gcc LOC="-DDEBUG -g"
The Console view should show the build output.
The Project Explorer view should show the generated binaries.