[CMake] Generated file not found during generation

Aaron_Wright at selinc.com Aaron_Wright at selinc.com
Fri Jul 23 16:12:08 EDT 2010


(This is a repeat email, but my last one may have been in reply to another 
message, which it should not have been. So I'm trying again, sorry.)

I have a program that uses the Window's Event Log. Using the event log is 
a little goofy; it requires a message resource file. So I set up a custom 
command to call mc.exe can create a header and resource file from a 
message script (*.mc file). This configures ok, but fails during 
generation. It says it can't find the *.rc file. I checked via 
GET_SOURCE_FILE_PROPERTY that the *.rc file is marked as generated. 

Is this familiar to anyone? I was wondering if Windows was playing a trick 
on me or something, and is there a way to work around it? I currently have 
to go and create the *.rc file by hand, and re-run CMake. This man-made 
*.rc file is then overwritten during building like normal.

ADD_CUSTOM_COMMAND( 
   OUTPUT 
      "${PROJECT_BINARY_DIR}/event_log_messages.h" 
      "${PROJECT_BINARY_DIR}/event_log_messages.rc" 
   COMMAND mc -c 
      -U "${PROJECT_SOURCE_DIR}/event_log_messages.mc" 
      -r "${PROJECT_BINARY_DIR}" 
      -h "${PROJECT_BINARY_DIR}" 
   DEPENDS "${PROJECT_SOURCE_DIR}/event_log_messages.mc" 
   COMMENT "Generating \"event_log_messages.h\" & 
\"event_log_messages.rc\"") 
 
SET( 
   SOURCES 
   "${PROJECT_SOURCE_DIR}/main.cpp" 
   "${PROJECT_SOURCE_DIR}/event_log_messages.mc" 
   "${PROJECT_BINARY_DIR}/event_log_messages.rc") 
 
SET( 
   HEADERS 
   "${PROJECT_BINARY_DIR}/event_log_messages.h") 

ADD_EXECUTABLE( 
   event_log_test 
   SOURCES ${SOURCES} 
   HEADERS ${HEADERS}) 

---
Aaron Wright


More information about the CMake mailing list