<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body><div>On Thu, 2019-03-28 at 16:07 -0400, Norton Allen wrote:</div><blockquote type="cite">
<p>Kyle,</p>
<p>What you say makes sense, and I can even understand why
add_custom_target might do that, but I cannot get this to actually
work. Here is a minimal CMakeLists.txt. mysourcefile is just and
empty file.</p>
<p>I have these files in test/cmake, and I:</p>
<blockquote>
<p>cd test<br>
mkdir build-cmake<br>
cd build-cmake<br>
cmake ../cmake<br>
make</p>
</blockquote>
<p>and there is no sign of mygeneratedfile. I then try</p>
<blockquote>
<p>make install</p>
</blockquote>
<p>and I get:</p>
<blockquote>
<p>$ make install<br>
Install the project...<br>
-- Install configuration: ""<br>
CMake Error at cmake_install.cmake:31 (file):<br>
file INSTALL cannot find
"/home/nort/test/build-cmake/mygeneratedfile".<br>
<br>
<br>
make: *** [Makefile:84: install] Error 1<br>
</p>
</blockquote>
Where is my mistake?<br></blockquote><div><br></div><div>One more thing: if you want the custom target to be built by "make" or "make all", you have to give it the ALL argument:</div><div><br></div><div><span style="font-family: 'Ubuntu Mono'; font-size: 17px;">add_custom_target(mygeneratedtarget ALL</span><br style="font-family: 'Ubuntu Mono'; font-size: 17px;"><span style="font-family: 'Ubuntu Mono'; font-size: 17px;"> DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mygeneratedfile</span><br style="font-family: 'Ubuntu Mono'; font-size: 17px;"><span style="font-family: 'Ubuntu Mono'; font-size: 17px;">)</span></div><div><br></div><div>Otherwise you can build the target with "make mygeneratedtarget".</div><div><br></div><div>Kyle</div></body></html>