My company has their own idl compiler, and I have CMake generating the files as a part of the build process. I want the .idl files to be in the visual studio project, but that means I end up with microsoft trying to compile the idl files with midl (which fails miserably).
I know my question is extremely similar to Adding data files to cmake-generated projects, but the major difference is that microsoft does have a compiler I just don't want them to use it.
-update-
Here is a code sample from the function that adds the idl file to the solution (The entirety of the code is too much, but if there are any declarations that might help in answering the question let me know):
function foo()
add_custom_command...
set(HEADERS ${HEADERS} bar.idl PARENT_SCOPE)
source_group("Source Files\\idl Files" REGULAR_EXPRESSION .*.idl)
endfunction()
Then later - after I call foo - I call add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
One thing I noticed is that nmake will compile how I want it to compile, but visual studio adds the call to midl that I don't want.
Any help will be greatly appreciated.
-update 2-
I can hack a way of 'fixing' the problem by adding a /? to the midl command line inside visual studio (but I can't ask every dev to do that each time they build), so if anyone knows how to add an argument to the midl command line from cmake that would help as well.
It's probably also a bit of a hack, but I think you could achieve this by marking the .idl files as HEADER_FILE_ONLY
:
set_source_files_properties(${HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With