[CMake] CMake & win32 rc files

Tyler tyler at cryptio.net
Tue May 3 10:15:00 EDT 2011


It doesn't work if you just include your icon file as one of the
source files in the call to add_executable()/add_library()?

What do you mean by "cross building"? Do you mean cross-compiling? If
so, from what platform to win32?

tyler

On Tue, May 3, 2011 at 6:53 AM, Gabriele Greco <gabriele.greco at darts.it> wrote:
>
>
>> I've seen that my win32 binaries crossbuilt with cmake do not have icons,
>> so I googled around for this problem and I found this:
>> 0011773: CMake ignore .RC files when cross building
>>
>> It seems it's not yet solved, what I'm asking here if there is a
>> workaround, something like to build with a custom command the rc file (I can
>> do it), and then add it to the project binary with add_executable (this
>> doesn't work).
>
> Just to describe the problem with some additional details:
> I added to my CMakeLists.txt:
> add_custom_target(icon.o
>                   COMMAND ${CMAKE_RC_COMPILER} icon.rc icon.o
>                   DEPENDS monitor.ico
>                   SOURCES icon.rc
>                   )
> Then I tried to add it to the project both as "source" in add_executable(
> ... icon.o) (1), and as library in target_link_libraries (... icon.o) (2)
> CMake give the following error for (1):
>   Cannot find source file "icon.o".  Tried extensions .c .C .c++ .cc .cpp
>   .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
> And the following error for (2):
>   Target "icon.o" of type UTILITY may not be linked into another target.
>  One
>   may link only to STATIC or SHARED libraries, or to executables with the
>   ENABLE_EXPORTS property set.
> The "right" case, that is to add, WITHOUT any custom target, icon.rc to the
> add_executable() source list does produce an executable, but without icon
> (as detailed also in the error report on the cmake tracker)
> --
> Thanks in advance,
>  Gabry
>
>
> _______________________________________________
> 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