0

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?

  • We are talking about changing files included [so](https://learn.microsoft.com/en-us/windows/win32/midl/-i) – Aleksey Am Apr 14 '20 at 16:02
  • Welcome to Stack Overflow! Here we expect the question to be **understandable without following links**. Please, [edit] the question and **add your code** into it. You may refer to the other question which you follow, but your question still requires to have the code. – Tsyvarev Apr 16 '20 at 12:38
  • ... Which headers does your generated IDL file depend on? Did you try adding them to the `DEPENDS` part of the command? – Botje Apr 16 '20 at 14:16
  • So just add these headers to `DEPENDS`... You literally used it to specify dpeendency on those MIDL_FILE. – KamilCuk Apr 16 '20 at 14:17

1 Answers1

0

Answer in Cmake.org

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