# avoiding extra quotes in add\_test command

**URL:** https://discourse.cmake.org/t/avoiding-extra-quotes-in-add-test-command/10425
**Category:** Code
**Created:** [March 20, 2024, 9:05pm UTC](https://discourse.cmake.org/t/avoiding-extra-quotes-in-add-test-command/10425 "2024-03-20T21:05:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![samuelpmish](https://discourse.cmake.org/user_avatar/discourse.cmake.org/samuelpmish/32/3308_2.png) [@samuelpmish](https://discourse.cmake.org/u/samuelpmish)
#### Post date: [March 20, 2024, 9:05pm UTC](https://discourse.cmake.org/t/avoiding-extra-quotes-in-add-test-command/10425/1 "2024-03-20T21:05:39Z")

</div>

Hi, I’m trying to add CMake support for an existing library that has a suite of tests that are expected to be invoked in the following way:

```auto
test001 /ref/opt

```

where `/ref/opt` is the project’s own notation for expressing a list of options for the test, i.e. {ref, opt}. In an attempt to set this test up with CMake/CTest, I did

```auto
set(BACKENDS /ref/opt)

add_test(
  NAME ${my_test}
  COMMAND ${my_test} ${CEED_BACKENDS}
)				

```

but that seems to end up invoking

```auto
Test command: /path/to/my/project/build/test001 "/ref/opt"

```

This is not the argument format the program expects, and the tests fail as a result. How do I prevent CMake from appending these extra quotation marks to my test’s arguments?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 10, 2024, 11:42pm UTC](https://discourse.cmake.org/t/avoiding-extra-quotes-in-add-test-command/10425/2 "2024-04-10T23:42:22Z")

</div>

Is `test001` getting the quotes literally in its `argv`? Also, I see `BACKENDS` and `CEED_BACKENDS`; is that a typo here or in the original source?

---

<div class="post-metadata">

### Author: ![samuelpmish](https://discourse.cmake.org/user_avatar/discourse.cmake.org/samuelpmish/32/3308_2.png) [@samuelpmish](https://discourse.cmake.org/u/samuelpmish)
#### Post date: [April 10, 2024, 11:46pm UTC](https://discourse.cmake.org/t/avoiding-extra-quotes-in-add-test-command/10425/3 "2024-04-10T23:46:34Z")

</div>

Sorry, this example was (poorly) anonymized, it should just be BACKENDS in both cases-- I’ll edit to clarify.

Oops, I guess it’s too late to edit now.

---

<div class="post-metadata">

### Author: ![samuelpmish](https://discourse.cmake.org/user_avatar/discourse.cmake.org/samuelpmish/32/3308_2.png) [@samuelpmish](https://discourse.cmake.org/u/samuelpmish)
#### Post date: [April 10, 2024, 11:58pm UTC](https://discourse.cmake.org/t/avoiding-extra-quotes-in-add-test-command/10425/4 "2024-04-10T23:58:09Z")

</div>

You’re right, the quotes are stripped by the time they make it to `argv`. I (wrongly) assumed the test failure was attributed to the difference in arguments being passed.

Thank you @ben.boeckel
