<div dir="ltr">That was it, thanks Nils!<div><br></div><div>For future reference, after adding the test like Nils suggested, calling "ctest" wouldn't work as it now needs your configuration:</div><div><br></div><div>ctest -C Debug</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jan 5, 2018 at 11:16 AM Nils Gladitz <<a href="mailto:nilsgladitz@gmail.com">nilsgladitz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    <div class="m_-3474701543371410271moz-cite-prefix">On 05.01.2018 17:11, Saad Khattak
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>Suppose I have something like this:</div>
        <div><br>
        </div>
        <div>add_executable(MyTest main.cpp)</div>
        <div>set_target_properties(MyTest</div>
        <div>  PROPERTIES</div>
        <div>  DEBUG_POSTFIX _d</div>
        <div>  RELEASE_POSTFIX _r</div>
        <div>  )</div>
        <div>add_test(RunTests MyTest) # where MyTest is the
          <command></div>
        <div><br>
        </div>
        <div>I expect CMake to recognize that "MyTest" has executables
          that are named "MyTest_d" and "MyTest_r" and NOT MyTest. I
          expect this because in the CMake documentation the
          <command> can be an executable target where CMake then
          replaces it with the location of the executable.</div>
        <div><br>
        </div>
        <div>However, what I get is errors when running "ctest" where it
          complains that it cannot find "MyTest" when it should really
          be searching for "MyTest_d" and "MyTest_r".</div>
        <div><br>
        </div>
        <div>Am I doing something wrong or is this a bug in CMake?</div>
      </div>
    </blockquote>
    <br></div><div text="#000000" bgcolor="#FFFFFF">
    You are using the old signature (without NAME|COMMAND) for which the
    documentation states [1]:<br>
        "Unlike
    the above <code class="m_-3474701543371410271docutils m_-3474701543371410271literal"><span class="m_-3474701543371410271pre">NAME</span></code>
    signature no transformation is performed on the
    command-line to support target names or generator expressions."<br>
    <br>
    Use the new signature instead e.g.:<br>
        add_test(NAME RunTests COMMAND MyTest)<br>
    <br>
    Nils<br>
    <br>
    [1] <a class="m_-3474701543371410271moz-txt-link-freetext" href="https://cmake.org/cmake/help/latest/command/add_test.html" target="_blank">https://cmake.org/cmake/help/latest/command/add_test.html</a><br>
  </div>

</blockquote></div>