Skip to content

Require src/main.cpp for building. #24

@BassedWarrior

Description

@BassedWarrior

cargo expects a src/main.rs file to be present when compiling a binary
crate. And in case it doesn't find it, it doesn't attempt to build the crate.
A way around this is to explicitly state a [[bin]] name and path in the
Cargo.toml manifest. Which is able to tell cargo to look for that file to be
the main file of a binary produced by the crate.

In the case of cppargo, perhaps it would be benefitial to enforce such file
structure standard by default. Refusing to build the project if src/main.cpp
is not found. And could be overriden once a manifest of sorts is implemented,
as discussed in #7.

Note

Edit: The functionality for specifying a different file structure has
been deemed beyond the scope of this issue and is left for future version
releases. For now, cppargo will indeed only enforce the src/main.cpp file
to be present, and fail to build the project if it is not present.

This decision after analyzing that the implementation of a system like the
one cargo uses for defining multiple binary targets would be pointless
without also overhauling the behaviour of just searching for all .cpp files
and passing them as arguments to g++ without any further analysis of the
dependency trees, and the vairous #inculde in the different .cpp files.

Hence it would be pointless to do anything that didn't factor that into
account.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions