<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'> Hello,<BR> <BR>Using CMake 3.3 and VS2012.<BR> <BR>The below cmake scripts generate "Policy CMP0040 is not set: The target in the TARGET signature of add_custom_command must exists". Why cannot the custom/CMakeLists.txt file see the target created in app/CMakeLists.txt ? Moving the ADD_CUSTOM_COMMAND to the app/CMakeLists.txt fixes the problem but I would like to keep them separate if possible.<BR> <BR>PROJECT(TEST)<BR>ADD_DIRECTORY(app)<BR>ADD_DIRECTORY(custom)<BR> <BR>The app CMakeLists.txt looks like this;<BR>ADD_EXECUTABLE(app main.cpp)<BR>TARGET_LINK_LIBRARIES(app)<BR> <BR>The custom CMakeLists.txt looks like this;<BR>ADD_CUSTOM_COMMAND(<BR>  TARGET app <BR>  POST_BUILD<BR>  COMMAND tbd.exe)<BR> <BR>Appreciate any input.<BR> <BR>Kind regards, Lars<BR>                                     </div></body>
</html>