c++cmakeresourcesversioninfo

Linking .res file with an Executable (CMake)


i've been trying to link compiled .res file with CMake for some time, i searched internet but there is no much info bout it. I tried adding this into my CMakeList.txt

SET(RESOURCE_FILE scac.res)
file(GLOB src_files 
"${RESOURCE_FILE}"
ADD_EXECUTABLE( FOO ${FOO_SRCS} )
TARGET_LINK_LIBRARIES( FOO ${FOO_LIBS} )
SET( FOO_LINKFLAGS ${CMAKE_CURRENT_SOURCE_DIR}/modules/scac-module/scac.res )
SET_TARGET_PROPERTIES( FOO PROPERTIES LINK_FLAGS ${FOO_LINKFLAGS} )
)

.res file contains VERSIONINFO and also ICON, CMAKE doesn't give any error after compiling, and . res file is also succesfully compiled without any error, but simply version info doesn't show on application Note: I don't have much experience with cmake, problem may be simple, or complicated 😂

Thanks for your time, and help.


Solution

  • After 6 hours, problem is solved just added "${CMAKE_CURRENT_SOURCE_DIR}/res.rc" into line

     add_executable(${EXAMPLE_TARGET} ${EXAMPLE_HEADER_FILES} ${EXAMPLE_INLINE_FILES} "examples/${EXAMPLE_SOURCE_FILE}"
    

    to finally get

    add_executable(${EXAMPLE_TARGET} ${EXAMPLE_HEADER_FILES} ${EXAMPLE_INLINE_FILES} "examples/${EXAMPLE_SOURCE_FILE}" "${CMAKE_CURRENT_SOURCE_DIR}/resource.rc"