bemanproject / beman

Organization, documentation, etc. for the Beman Project
https://bemanproject.org
Apache License 2.0
30 stars 11 forks source link

Update BEMAN_STANDARD: rename flag under CMAKE.SKIP_TESTS #59

Closed neatudarius closed 2 weeks ago

neatudarius commented 2 weeks ago

Sync BEMAN_<short_name>_BUILD_EXAMPLES and BEMAN_<short_name>_BUILD_TESTS.

neatudarius commented 2 weeks ago

I would like consistency. I don't care which is the suffix, but to be similar for examples and tests.

@JeffGarland what it should be for our project?

Jeff, please pick something and I will revert or update or keep https://github.com/beman-project/beman/pull/59.

CC: @steve-downey and @camio

steve-downey commented 2 weeks ago

Professional CMake 19th Edition has

option(MYPROJ_ENABLE_TESTING "..." ${PROJECT_IS_TOP_LEVEL})
if(MYPROJ_ENABLE_TESTING)
  add_subdirectory(tests)
endif()
if(PROJECT_IS_TOP_LEVEL)
  add_subdirectory(packaging)
else()
  # Users are unlikely to be interested in testing this
  # project, so don't show it in the basic options
  mark_as_advanced(MYPROJ_ENABLE_TESTING)
endif()

as part of the recommended practices.

Ignore the packaging part for now, it's cpack related, and OK for single installs outside of an ecosystem, but it's an attractive nuisance for conan, vcpkg, dpkg, and so on.

neatudarius commented 2 weeks ago

Professional CMake 19th Edition has

option(MYPROJ_ENABLE_TESTING "..." ${PROJECT_IS_TOP_LEVEL})
if(MYPROJ_ENABLE_TESTING)
  add_subdirectory(tests)
endif()
if(PROJECT_IS_TOP_LEVEL)
  add_subdirectory(packaging)
else()
  # Users are unlikely to be interested in testing this
  # project, so don't show it in the basic options
  mark_as_advanced(MYPROJ_ENABLE_TESTING)
endif()

as part of the recommended practices.

Ignore the cpack part for now, it's OK for single installs outside of an ecosystem, it's an attractive nuisance for conan, vcpkg, dpkg, and so on.

I don't have doubts about practices for testing and cmake. I just propose to have something uniform for any component which can be skipped at build time.

steve-downey commented 2 weeks ago

For Cmake, testing and building are completely independent. Testing isn't build time. The option is to enable testing of some facility you've composed into a Cmake project. In a package ecosystem it's mostly unused.

All of which can be a frustrating source of error, since running ctest, or invoking the test target, will not build anything.