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

David Cole david.cole at kitware.com
Fri Jan 21 12:06:38 EST 2011


I'll take a look at the code you sent in your original post and try to see
exactly why it's not working. I might not get to it until the end of the
day, though.

If it worked in VS2008, but not now in VS2010, then we're clearly doing
something different in the generators. I'll find out if it's an important
something or not and get back to you.


Thanks,
David


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

> Ah, I new that would come up. Yeah, they could be renamed. There are only
> a dozen or so of them.
>
> I was just trying to migrate the build system to VS2010 in between
> projects here at work, and this is the only thing holding me back from a
> smooth transition. Changing the extension is certainly an option, but it
> wasn't my first. Sense this is working good in VS2008, I was hoping it was
> just a simple bug, or maybe something I was doing wrong with the
> ADD_CUSTOM_COMMAND.
>
> Do you think this is the way its supposed to work with VS2010? Should I
> make the extension change or work with CMake more?
>
> ---
> 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:36 AM
> Subject:
> Re: [CMake] VS2010 tries to compile a file with *.res extension when its
> copied
> Sent by:
> cmake-bounces at cmake.org
>
>
>
> 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
> _______________________________________________
> 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/6058fed3/attachment.htm>


More information about the CMake mailing list