Home > Mobile >  .res files don't include to exe file, but .rs files links succesfully
.res files don't include to exe file, but .rs files links succesfully

Time:11-08

I never worked with Win-specific programming and today I've decided to figure out this question. I use Cmake and Ninja and to include a resource file, I use the following line in the Cmake config:

add_executable(${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/src/windows/test.res" ${APP_SOURCE_FILES} )

And when I open properties of my app using context menu I don't see any meta data or icon. These ones are described in the .res file, which I try to include. But if I use non-compiled resource file everything works (.rs). How should I link a .res file with my app?

For compilling res files I use windres by msys2

CodePudding user response:

It looks like I am not only winapi-beginner. I am also a cmake beginner. When a path is added to add_executable Cmake tries to compile a file with the specified path to a .obj file. But because a .res file has been compiled, cmake just does nothing. In this case, I have to add .res file to the link flags instead. Google, thank you. You're the best :)

  • Related