This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 229062 - C++ Make: support multiple main targets
Summary: C++ Make: support multiple main targets
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-26 10:34 UTC by yougo
Modified: 2013-04-30 07:32 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yougo 2013-04-26 10:34:17 UTC
A C++ project in NetBeans does not allow the existence of multiple executable targets. It assume that a project will only generate a single executable. 
I need to support several executable (application, tests, benchmarks) in a single project (single source). It seems others have this need too.

Would it be possible to:
1. Generate a target for each executable (all existing main functions)
2. Add these targets automatically as is currently done for the single one
   (easier than manually adding them, less confusing for the user)
3. Allow toggling the compilation and linking in each target (on/off)
4. Allow executing a target directly on the C/C++ source (a la Java)

I think the above is possible using the Makefile because it supports several targets. The Makefile properties dialog box already lets us manage targets. 
We already can also select and execute a target. Maybe all that is required is to 
tweak the "single main" target creation to detect and add several targets.

TIA.
Comment 1 soldatov 2013-04-26 10:41:16 UTC
(In reply to comment #0)
> A C++ project in NetBeans does not allow the existence of multiple executable
> targets.
It is not a true. See Pi sample in NetBeans.
Comment 2 yougo 2013-04-30 07:32:03 UTC
@soldatov Checked out the Pi example. You are correct. 
I was already aware of the flag to exclude a file from a project.
I was also aware of the ability to manage several configurations.
However I failed to see how the use of both to allow for multiple targets.
Two issues though:
 . Not very intuitive. 
 . Not easy to use (need to hunt down dependencies, may not always work).

In regards to the last one, I have had trouble due to global variables.

Still think my suggestions have some value. 
Should I mark this as resolved?