[CMake] Generated file not found during generation

David Cole david.cole at kitware.com
Fri Jul 23 16:38:07 EDT 2010


Does the behavior change if you list the rc file first? Or if you list only
the rc file as an OUTPUT?

I vaguely remember there being some difference between "primary" OUTPUT and
other files mentioned as OUTPUT values, but it's in the foggy past... Some
experimentation or some reading of the add_custom_command source code is in
order.


Let me know if this helps,
David


On Fri, Jul 23, 2010 at 4:12 PM, <Aaron_Wright at selinc.com> wrote:

> (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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100723/07f7f726/attachment.htm>


More information about the CMake mailing list