[CMake] CMake with IDL file generation

Robert Dailey rcdailey.lists at gmail.com
Mon Sep 10 19:38:10 EDT 2012


I'm creating a shared library target that needs to compile and include
source generated by an IDL. I want CMake to create a custom target
that will invoke MIDL.EXE (comes with Windows SDK) against the IDL
file to generate the header / source files needed. These header/source
files will then be built by the shared library target. I saw a similar
post on this here:

http://www.cmake.org/pipermail/cmake/2011-July/045617.html

This seems complicated and I'm not sure it even works, since from my
tests, if source files don't exist by the time add_library,
add_executable, etc is called, generation will fail. I also don't want
CMake to invoke MIDL for me since that would require us to run CMake
again every time the IDL file changes (this shouldn't be the case, we
should just have to rebuild the target again using Visual Studio or
NMake).

Any ideas on a simple solution to this?

Thanks in advance.


More information about the CMake mailing list