[CMake] file not generated with ADD_CUSTOM_COMMAND

Alexander Neundorf a.neundorf-work at gmx.net
Wed Jan 4 12:38:46 EST 2006


Hi, 
 
shouldn't this work ? 
 
main.c: 
 
#include "generated.h" 
 
#include <stdio.h> 
 
int main() 
{ 
   printf("hello world\n"); 
   return 0; 
} 
 
CMakeLists.txt: 
 
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated.h COMMAND 
sh ARGS -c "echo // > generated.h" ) 
ADD_EXECUTABLE(hello main.cpp) 
 
--- 
 
The custom command isn't generated. I guess cmDependsC.cxx finds the 
include "generated.h" but since it doesn't exist, it isn't added to the 
list of dependencies and that's why when building generated.h simply 
doesn't exist. 
Adding "generated.h" to the list of source files doesn't change anything. 
 
Bye 
Alex 
 

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++


More information about the CMake mailing list