Skip to content

Conversation

@ednolan
Copy link
Member

@ednolan ednolan commented Nov 13, 2024

This commit adds a UTF_VIEW_BUILD_TESTS CMake option. The logic around its use is:

  • If the user has explicitly set UTF_VIEW_BUILD_TESTS, BUILD_TESTING is set to that value
  • Otherwise, if BUILD_TESTING was already set to ON, then it continues to be set to ON
  • Otherwise, if this is the top-level CMake project and not a dependency of another project, BUILD_TESTING is set to ON
  • Otherwise, BUILD_TESTING is set to OFF

Using BUILD_TESTING to control whether tests are enabled is recommended by CMake in its documentation here:
https://cmake.org/cmake/help/latest/module/CTest.html

This logic is based on a similar option implemented in NVIDIA/stdexec. My commit implementing this logic can be found here:

NVIDIA/stdexec@ee0a962

Additional reasoning can be found here:

NVIDIA/stdexec#1380 (comment)

This commit adds a UTF_VIEW_BUILD_TESTS CMake option. The logic around
its use is:

- If the user has explicitly set UTF_VIEW_BUILD_TESTS, BUILD_TESTING
    is set to that value
- Otherwise, if BUILD_TESTING was already set to ON, then it continues
    to be set to ON
- Otherwise, if this is the top-level CMake project and not a
    dependency of another project, BUILD_TESTING is set to ON
- Otherwise, BUILD_TESTING is set to OFF

Using BUILD_TESTING to control whether tests are enabled is
recommended by CMake in its documentation here:
https://cmake.org/cmake/help/latest/module/CTest.html

This logic is based on a similar option implemented in NVIDIA/stdexec.
My commit implementing this logic can be found here:

NVIDIA/stdexec@ee0a962

Additional reasoning can be found here:

NVIDIA/stdexec#1380 (comment)
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11825407831

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 11824687027: 0.0%
Covered Lines: 468
Relevant Lines: 468

💛 - Coveralls

@ednolan
Copy link
Member Author

ednolan commented Nov 13, 2024

This approach is not used in the Beman project because BUILD_TESTING doesn't provide sufficient granularity for large projects. This pull request will be superseded with an alternative that uses enable_testing().

@ednolan ednolan closed this Nov 13, 2024
@ednolan ednolan deleted the test_build_option branch November 13, 2024 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants