<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I – being new to CMake - somehow fail to set VS_DEBUGGER_* property values on a project added via add_custom_target(). The settings of those property values seem to be lost and not written to any .vcxproj file. Doing the same to a target
 added via add_executable() works on the other hand as expected, ie the debug property values show up correctly in the corresponding .vcxproj. (This is all tried with Visual Studio 2015.)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What is the proposed way to achieve the settings of the property values on a project added via add_custom_target()? What am I doing wrong?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">_Details_ I have the helloWorld.cpp and CMakeLists.txt next to a subdirectory ext, containing both the test01.cpp and test01.exe. Ie<o:p></o:p></p>
<p class="MsoNormal">  CMakeLists.txt<o:p></o:p></p>
<p class="MsoNormal">  helloWorld.cpp<o:p></o:p></p>
<p class="MsoNormal">  ext/<o:p></o:p></p>
<p class="MsoNormal">      test01.cpp<o:p></o:p></p>
<p class="MsoNormal">      test01.exe<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The CMake code in a nutshell:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">add_executable(helloWorld helloWorld.cpp)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">set(test_name "test01")<o:p></o:p></p>
<p class="MsoNormal">set(test_target "${test_name}_build")<o:p></o:p></p>
<p class="MsoNormal">add_custom_target(${test_target}<o:p></o:p></p>
<p class="MsoNormal">    #COMMAND ${CMAKE_COMMAND} -E env "PATH=${BUILD_DRIVER_NVMAKE_DIRECTORY};$ENV{PATH}" nvmake ...<o:p></o:p></p>
<p class="MsoNormal">    COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/ext/${test_name}.exe" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>"<o:p></o:p></p>
<p class="MsoNormal">    SOURCES "${CMAKE_SOURCE_DIR}/ext/${test_name}.cpp"<o:p></o:p></p>
<p class="MsoNormal">)<o:p></o:p></p>
<p class="MsoNormal">set_property( TARGET ${test_target} PROPERTY FOLDER "nvmake tests" )<o:p></o:p></p>
<p class="MsoNormal"># from the following two set_property() calls only the first one has an effect in the generated .vcxproj files<o:p></o:p></p>
<p class="MsoNormal">set_property( TARGET helloWorld     PROPERTY VS_DEBUGGER_COMMAND "foo.exe" )<o:p></o:p></p>
<p class="MsoNormal">set_property( TARGET ${test_target} PROPERTY VS_DEBUGGER_COMMAND "foo.exe" )<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I understand that using imported targets might be an even more appropriate solution for the problem at hand. But with imported targets, eg via add_executable(${test_target} IMPORTED), I fail to add those in a way that they show up as projects
 in Visual Studio. What is the recommended way for this approach?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks for any hints,<o:p></o:p></p>
<p class="MsoNormal">Ali<o:p></o:p></p>
<p class="MsoNormal">PS The custom target ends up as a project of configuration type Utility – is there a way to change it to type Executable?<o:p></o:p></p>
</div>

<DIV>
<HR>
</DIV>
<DIV>This email message is for the sole use of the intended recipient(s) and may 
contain confidential information.  Any unauthorized review, use, disclosure 
or distribution is prohibited.  If you are not the intended recipient, 
please contact the sender by reply email and destroy all copies of the original 
message. </DIV>
<DIV>
<HR>
</DIV>
</body>
</html>