cmakevisual-studio-2017idlmidl

MIDL compiler from CMAKE


I did as described here

set(MIDL_OUTPUT
    ${CMAKE_CURRENT_BINARY_DIR}/IFace.h
    ${CMAKE_CURRENT_BINARY_DIR}/GUIDS.c
    ${CMAKE_CURRENT_BINARY_DIR}/Proxy.c
    ${CMAKE_CURRENT_BINARY_DIR}/ProxyDll.c
    )
set(MIDL_FILE
    ${CMAKE_CURRENT_LIST_DIR}/BookSku.idl
    )
add_custom_command(
    OUTPUT ${MIDL_OUTPUT}
    COMMAND midl /h IFace.h /iid GUIDS.c /proxy Proxy.c /dlldata ProxyDll.c 
${MIDL_FILE}
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    DEPENDS ${MIDL_FILE}
    MAIN_DEPENDENCY ${MIDL_FILE}
    VERBATIM
    )

The output from the build of the IDL file is dependent many of the headers, so it needs to track if these have changed to determine if it should rebuild the type library. But when you change files, and pushing "Build" the project in VS2017 is not rebuilt. Need to push "Rebuild". How to make file changes tracked?


Solution

  • Answer in Cmake.org

    DEPENDS: Specify files on which the command depends. Each argument is converted to a dependency as follows: