Closed neatudarius closed 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
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.
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.
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.
Sync
BEMAN_<short_name>_BUILD_EXAMPLES
andBEMAN_<short_name>_BUILD_TESTS
.