Skip to content

Suggestions for improving the CMakeLists #26

@Flamefire

Description

@Flamefire

Hello, just some random findings on how to improve the CML

  • set (Boost.Real_VERSION_MAJOR 1) -> project(Boost.Real VERSION 1.0) which is shorter and a superset of those 2 sets
  • don't add coverage by default, add an option
  • make the if consistently lowercase and ommit the condition in the closing endif
  • You are not really using the CodeCoverage include, so maybe remove it and do the stuff explicitely or copy the single file especially going forward in inclusion with boost this might be relevant. Then also check the copyright
  • General advice: Don't check CMAKE_BUILD_TYPE. E.g. for Visual Studio as the output this value is meaningless
  • Instead of HAVE_FLAG_STD_CXX17 use target_compile_features with cxx_std_17
  • replace include_directories with target_include_directories
  • Boost_INCLUDE_DIRS is unset at the point it is used and can be removed
  • add_executable(Boost.Real_headers likely doesn't do what you want. You add a folder as the sources which isn't right IIRC and what is the point for this binary? Could you clarify? I'm inclined in suggesting to remove it
  • Instead if REAL_TEST use the standard BUILD_TESTING (e.g. by include(CTest))

If you want, check https://github.com/boostorg/nowide/blob/develop/CMakeLists.txt. That is a bit more convoluted as it supports a build library instead of a header-only lib and integrates with Boost superproject

Metadata

Metadata

Assignees

No one assigned

    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