<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 05.01.2018 17:11, Saad Khattak
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAEM70sM=Fyx4FWiDA-7bnH8oXnYczHn79RN3Qve-z3oLHh+tVA@mail.gmail.com">
<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>
You are using the old signature (without NAME|COMMAND) for which the
documentation states [1]:<br>
"Unlike
the above <code class="docutils literal"><span class="pre">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="moz-txt-link-freetext" href="https://cmake.org/cmake/help/latest/command/add_test.html">https://cmake.org/cmake/help/latest/command/add_test.html</a><br>
</body>
</html>