[CMake] VS2010 tries to compile a file with *.res extension when its copied

David Cole david.cole at kitware.com
Fri Jan 21 11:35:49 EST 2011


I don't think it's stupid. No judgment here. :-)

But can it be renamed, or does this logging library require ".res" as the
file extension?


On Fri, Jan 21, 2011 at 11:22 AM, <Aaron_Wright at selinc.com> wrote:

> Well, you're probably going to think this is stupid, but the *.res file is
> not actually a resource file in the Microsoft sense of it. It's just a
> text file that happens to have the *.res extension. It's a string
> localization text file that our logging library knows how to read. It
> think it is just happen stance that the logging library expects the files
> to end in *.res.
>
> ---
> Aaron Wright
>
>
>
>
> From:
> David Cole <david.cole at kitware.com>
> To:
> Aaron_Wright at selinc.com
> Cc:
> "cmake at cmake.org" <cmake at cmake.org>
> Date:
> 01/21/2011 08:10 AM
> Subject:
> Re: [CMake] VS2010 tries to compile a file with *.res extension when its
> copied
>
>
>
> This is similar in nature to
> http://public.kitware.com/Bug/view.php?id=11147 and friends...
>
> The fix for that issue is ending up being "obj" file specific, though,
> because we have a special handler in place for files with "obj"
> extensions. Perhaps we need similar handling for "res" files. (They are
> really just obj files from the rc compiler...)
>
> Do you not have the rc file? Or are you compiling it as a custom command
> to avoid some other issue with rc files?
>
> This sounds like we need to add a test similar to our existing ExternalOBJ
> test, but with a pre-built res file.
>
>
> Thanks for the discussion -- seems like something needs to be fixed here.
> Let's track it down.
>
> David
>
>
> On Fri, Jan 21, 2011 at 10:57 AM, <Aaron_Wright at selinc.com> wrote:
> This is with both 2.8.3 and 2.8.4-rc1.
>
> On a side note, VS2010 is not trying to compile the *.res file as part of
> the executable, because it is marked HEADER_FILE_ONLY, and in addition I
> can remove it entirely from the project. Instead, even when the *.res file
> appears no where in the solution explorer in VS2010 (except as a
> *.res.rule file), VS2010 is still trying to compile it. If I remove the
> *.res.rule file it stops trying to compile it. So basically its just
> something to do with the ADD_CUSTOM_COMMAND that copies the file.
>
> ---
> Aaron Wright
>
>
>
>
> From:
> David Cole <david.cole at kitware.com>
> To:
> "Aaron_Wright at selinc.com" <Aaron_Wright at selinc.com>
> Cc:
> "cmake at cmake.org" <cmake at cmake.org>
> Date:
> 01/20/2011 07:57 PM
> Subject:
> Re: [CMake] VS2010 tries to compile a file with *.res extension when its
> copied
> Sent by:
> cmake-bounces at cmake.org
>
>
>
> Is tha with 2.8.3 or 2.8.4-rc1?
>
> On Thursday, January 20, 2011,  <Aaron_Wright at selinc.com> wrote:
> > I know I've asked this before, but now I've narrowed it down a bit and I
> > have an example. This copies a *.res file to the binary directory where
> > presumably the executable can find it. The executable has that file as a
> > source file to hook up the dependency, and the copied file has the
> > HEADER_FILE_ONLY property set. Yet, somehow VS2010 is still trying to
> > compile en.res. I even tried setting the source and destination en.res
> > files to HEADER_FILE_ONLY, but that didn't fix it. Removing the
> > ADD_CUSTOM_COMMAND that does the copy fixes the problem. Why is this
> > broken? FYI, it worked fine in VS2008.
> >
> > CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
> >
> > PROJECT(cmake_res_bug)
> >
> > SET(RESOURCE_FILE "${PROJECT_SOURCE_DIR}/resources/en.res")
> >
> > GET_FILENAME_COMPONENT(RESOURCE_FILE_BASENAME "${RESOURCE_FILE}" NAME)
> > SET(LOCAL_RESOURCE_FILE
> > "${PROJECT_BINARY_DIR}/resources/${RESOURCE_FILE_BASENAME}")
> >
> > ADD_CUSTOM_COMMAND(
> >    OUTPUT "${PROJECT_BINARY_DIR}/resources/${RESOURCE_FILE_BASENAME}"
> >    COMMAND ${CMAKE_COMMAND} -E make_directory
> > "${PROJECT_BINARY_DIR}/resources"
> >    COMMAND ${CMAKE_COMMAND} -E copy "${RESOURCE_FILE}"
> > "${PROJECT_BINARY_DIR}/resources"
> >    DEPENDS "${RESOURCE_FILE}"
> >    COMMENT "Localizing ${RESOURCE_FILE_BASENAME}")
> >
> > SET_SOURCE_FILES_PROPERTIES(
> >    "${LOCAL_RESOURCE_FILE}"
> >    PROPERTIES HEADER_FILE_ONLY TRUE)
> >
> > INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
> >
> > ADD_EXECUTABLE(
> >    ${PROJECT_NAME}
> >    "${PROJECT_SOURCE_DIR}/src/main.cpp"
> >    "${LOCAL_RESOURCE_FILE}")
> >
> > ---
> > 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
> >
> _______________________________________________
> 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
>
>
> _______________________________________________
> 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
>
>
> _______________________________________________
> 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/20110121/b18de7db/attachment.htm>


More information about the CMake mailing list