handling multiple binaries within a project

CodeLite installation/troubleshooting forum
sur3
CodeLite Curious
Posts: 5
Joined: Fri May 05, 2017 6:24 pm
Genuine User: Yes
IDE Question: C++
Contact:

handling multiple binaries within a project

Post by sur3 »

Hi i've got a problem with multiple binaries within a project, how can i address them, when i press F7, then it does nothing:
https://s28.postimg.org/9hmf8lpbh/auto.png
Where do i specifiy which file should be build? e.g. host_vect.c or host_vect.cpp both produce fine binaries when i compile them manually in console but i want to be able to build them within a codelite project and execute either of them in debug mode by some easy selection.

This is when i manually click on one file to compile then its only .o not linking to a binary, how can i tell it to not only compile but also to link to a binary?:
https://s14.postimg.org/kbr70jpm9/manu.png

Thanks.
sur3
CodeLite Curious
Posts: 5
Joined: Fri May 05, 2017 6:24 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: handling multiple binaries within a project

Post by sur3 »

Ok i got it to try linking now when setting an output file, weird would be more logical to specify the main input file.
Also depending on that selection is only indirectly available by disabling all other main files, would be more logical to specify which main file to build as target. Or even have a manual build option instead of just manual compile which doesnt make sense anyway if it builds not executeable. So can i somehow easily change what target source to build within a project?
sur3
CodeLite Curious
Posts: 5
Joined: Fri May 05, 2017 6:24 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: handling multiple binaries within a project

Post by sur3 »

btw if i'd split up the project into multiple projects is there a way to share common files between different projects, so these files don't have to be included in every project?
The main problem probably also is i use a git, so i'd like all files from git included into a project and then select what binary to build, that would be a pretty simple straight forward approach? Is that possible or how could i otherwise work on all files of the git efficiently?
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: handling multiple binaries within a project

Post by eranif »

The standard project produces a single binary. If you want multiple binaries from a single project, then you need to write your own makefile and define the project as "custom" from:
Project settings->customize->custom build->enable custom build

Once enabled, you can set the "build" (which will be executed when you hit F7) "clean" and other commands for this project.

OR, you can create multiple projects, each for binary
Make sure you have read the HOW TO POST thread
sur3
CodeLite Curious
Posts: 5
Joined: Fri May 05, 2017 6:24 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: handling multiple binaries within a project

Post by sur3 »

eranif wrote:If you want multiple binaries from a single project, then you need to write your own makefile and define the project as "custom" from:
Project settings->customize->custom build->enable custom build
Ah ok yes i tried that, but then there was the problem that these makefiles are not compatible when changing platform, like switching between windows and linux, when putting the makefile in the git project dir that will be a problem. Also i couldn't find how to execute and debug the resulting binaries.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: handling multiple binaries within a project

Post by eranif »

Here is a link that explains how to work with CMake and CodeLite using an external makefile http://codelite.org/LiteEditor/CustomMakefiles

Also, to debug such binaries, all you need to do is point CodeLite to the binary you want to debug in project settings->general->executable to debug/run

Eran
Make sure you have read the HOW TO POST thread
sur3
CodeLite Curious
Posts: 5
Joined: Fri May 05, 2017 6:24 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: handling multiple binaries within a project

Post by sur3 »

Ahh didn't know the custom makefiles also work with cmake, looks like that could really work, i can put a cmake into every binary folder then, and specify in the targets to cd there before executing cmake. :)
Just switching executables in the settings everytime seems a bit complicated then or can i also define run and debug targets that run or debug a specific code within CL? Then i would make a Compile, Clean, Run and Debug target for every binary in the project.. ^^
Post Reply