Skip to content

Allow usage as submodule #29

@Flamefire

Description

@Flamefire

Would be great if this was usable as a git-submodule or via CMakes ExternalProject or FetchContent.

This requires

  • a proper target name, e.g. tcspan
  • a namespaced alias for that target, e.g. tc::span
  • being able to exclude tests

For the latter I'd suggest to remove the enable_testing and use:

if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
  include(CTest)
endif()
if(BUILD_TESTING)
  add_subdirectory(test)
endif()

This include adds an option BUILD_TESTING with default ON and enable_testing call if the current project is not the super project (aka cmake was called for another folder and this folder was added via add_subdirectory)

PS: CMAKE_CURRENT_SOURCE_DIR as used is not required and can be omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions