[CMake] CMake & win32 rc files

Gabriele Greco gabriele.greco at darts.it
Tue May 3 09:53:44 EDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110503/b8fb0a5c/attachment.htm>


More information about the CMake mailing list