I am going to use MIDL compiler with CMAKE but unable to invoke MIDL compiler from CmakeList
That is command which I use to achieve my goal
add_custom_command(
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
COMMAND midl /h IFace.h /iid GUIDS.c /proxy Proxy.c /dlldata ProxyDll.c ${CMAKE_CURRENT_LIST_DIR}/include/Server.idl
)
When I build my project there are no files produced by MIDL compiler in ${CMAKE_CURRENT_BINARY_DIR}
But with this signature files generates well
add_custom_command(
PRE_BUILD
TARGET ${PROJECT_NAME}
COMMAND midl /h IFace.h /iid GUIDS.c /proxy Proxy.c /dlldata ProxyDll.c ${CMAKE_CURRENT_LIST_DIR}/include/Server.idl
)
What am I doing wrong?
add_custom_command
is not work; you need to have its OUTPUT as DEPENDS part of someadd_custom_target
call.add_custom_command(PRE_BUILD)
is a special form of the command, which is automatically attached to its TARGET. – Illailladvised