Skip to content

Better and more intuitive settings for C++11 and C++14 with different variants #10

@drodri

Description

@drodri

Currently, configuring some library/block to use C++11/14 is a bit complex. There are several options:

1-. Native use of CMake. It can require some conditionals for MultiOS

IF(UNIX)
    IF(CLANG)
        TARGET_COMPILE_OPTIONS(${BII_BLOCK_TARGET} INTERFACE -std=c++11)
....

2-. Use an existing CMake macro, possibly one existing in biicode and retrieved as dependency:

INCLUDE(biicode/cmake/tools)
ACTIVATE_CPP11(INTERFACE ${BII_BLOCK_TARGET})

This one requires one bii find or [requirements] to be written.

PROPOSAL:

From my point of view, it is still a bit complex, so I propose a high level definition, in biicode.conf, something like:

[cpp-std]
     c++11 PUBLIC   # or c++11 libstdc++...

That would be translated to a cmake variable, and biicode, checking that variable would automatically call something in the line of ACTIVATE_CPP11. Surely we have to check for CMake compile features as solution for this, instead of bare compile options.

Pros:

  • Much simpler approach
  • Easily deals with propagating usage to consumers
  • Might be able to deal with the problem of collisions
  • Totally optional, the user can still use the other approaches

Cons:

  • It wires the config to the internal ACTIVATE_CPP11 implementation, that might change with new versions of biicode, so changes, improvements, could break something.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions