# Is there any reason to prefer \`include(CTest)\` or \`enable\_testing()\` over the other?

**URL:** https://discourse.cmake.org/t/is-there-any-reason-to-prefer-include-ctest-or-enable-testing-over-the-other/1905
**Category:** Code
**Created:** [September 24, 2020, 9:04am UTC](https://discourse.cmake.org/t/is-there-any-reason-to-prefer-include-ctest-or-enable-testing-over-the-other/1905 "2020-09-24T09:04:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![alex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alex/32/125_2.png) [@alex](https://discourse.cmake.org/u/alex)
#### Post date: [September 24, 2020, 9:04am UTC](https://discourse.cmake.org/t/is-there-any-reason-to-prefer-include-ctest-or-enable-testing-over-the-other/1905/1 "2020-09-24T09:04:19Z")

</div>

Like it says in the title… the main difference I’m aware of is that `include(CTest)` has extra features for integrating with CDash and defines the `BUILD_TESTING` option.

But should one be preferred over the other for _new_ code?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 24, 2020, 10:46am UTC](https://discourse.cmake.org/t/is-there-any-reason-to-prefer-include-ctest-or-enable-testing-over-the-other/1905/2 "2020-09-24T10:46:28Z")

</div>

`include(CTest)` adds a bunch of targets that can be used to run parts of a dashboard submission. If you don’t need those, `enable_testing()` may be preferable to avoid the extra clutter. I used to use `include(CTest)` a fair bit, but these days I almost always just do `enable_testing()` since I use a dedicated dashboard script if I want dashboard submissions.
