[CMake] Generated file not found during cmake generation

Aaron_Wright at selinc.com Aaron_Wright at selinc.com
Thu May 6 18:59:03 EDT 2010


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 generally works fine, but sometimes it 
says it can't find the *.rc file. This happens sporadically. 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.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100506/90190b9e/attachment.htm>


More information about the CMake mailing list