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

Aaron_Wright at selinc.com Aaron_Wright at selinc.com
Fri Jan 21 10:57:01 EST 2011


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




More information about the CMake mailing list