[CMake] Setting MIDL Include path via cmake

David Cole david.cole at kitware.com
Fri Aug 12 17:30:11 EDT 2011


I pushed this commit to 'next' just now:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac22e2a8790e507d7600e0876585424db70f785b

Which makes the VS 7, 8 and 9 generators use include_directories for
midl command lines, to make them consistent with the VS 10 generator.

If nobody objects to this change, and it doesn't cause us any problems
on any of the dashboard tests tonight, then we can put this change
into the upcoming 2.8.6...


Cheers,
David


On Fri, Aug 12, 2011 at 10:27 AM, David Cole <david.cole at kitware.com> wrote:
> We actually have a test for idl files in the CMake test suite: VSMidl.
> See where it was added in this commit:
>
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13caaa3eb74a11dbf067409ea129321718d34dfe
>
> However, there does appear to be an inconsistency between Visual
> Studio 9 and earlier generators and Visual Studio 10: the VS10 one
> does add include directories, whereas the VS9 and earlier generators
> do not...
>
> In 2.8.5, there's another issue, though. If you inspect the property
> pages of an idl file in the GUI, it does not show anything. This is
> related to the fact that we generate full path names for the idl file
> in the vcxproj file, and Visual Studio doesn't display the property
> pages correctly... (Separate issue, but the additional include
> directory actually is there, you can verify with a text editor.)
>
> So..... can you use VS10? If not, it should be fairly simple to add
> the additional include directories to older generators. I'll see if I
> can get to it before the next CMake release. (or at the very least,
> shortly thereafter...)
>
>
> Thanks,
> David
>
>
> On Fri, Aug 5, 2011 at 12:37 PM, Paul Whelan <pwhelan at aer.com> wrote:
>> It neither shows up in the IDE nor builds with a cannot find include file
>> error. The project is kind of big and complex, so I created a quick sample
>> that exhibits the same behavior. I included the project directory with
>> original visual studio projects and a CMakeLists.txt file I wrote to do the
>> same thing. A second directory (IDLSampleBld) contains the results of
>> running cmake out of source.
>>
>> On 8/5/2011 10:54 AM, David Cole wrote:
>>>
>>> Hmmmm... I have some old code where I built an ActiveX control that
>>> included an idl file that does this:
>>>
>>>   include_directories("${CMAKE_CURRENT_BINARY_DIR}/\$(IntDir)")
>>>   include_directories("${CMAKE_CURRENT_BINARY_DIR}/\$(OutDir)")
>>>
>>> I know it used to work, but I haven't built that project in about 4
>>> years... (I don't think I can simply trivially build it, as some of
>>> the things that it depends on are no longer actively developed and
>>> building with today's CMake and Visual Studio versions...)
>>>
>>> I do not know whether the include directories showed up in the VS
>>> Properties dialog, or if the flags were simply added to the midl
>>> command line, but I did have it working at one point.
>>>
>>> Either it's gotten broken by something in the interim, or it still
>>> works even though the VS GUI doesn't reflect reality... Does your
>>> project fail to build when using two include_directories commands as
>>> above?
>>>
>>> Is the build error simply a midl or a C++ "cannot find include file
>>> xxxxx.h"? Or something else?
>>>
>>> Is your project available for me to try? Or can you make a smalll
>>> simple stand-alone reproduce case?
>>>
>>> If we can't get it working with VS and it's built-in midl handling, we
>>> can always resort to running midl as a custom command....
>>>
>>>
>>> HTH,
>>> David
>>>
>>>
>>> On Fri, Aug 5, 2011 at 8:10 AM, Paul Whelan<pwhelan at aer.com>  wrote:
>>>>
>>>> No, that just sets the compiler's include path. If you look at visual
>>>> studio's property dialog for a COM dll, the MIDL properties General tab
>>>> contains an "Additional include directories" entry much like the C++
>>>> general
>>>> tab. However, it isn't getting populated by cmake as best I can tell.
>>>>
>>>> On 8/4/2011 5:27 PM, David Cole wrote:
>>>>>
>>>>> Does calling
>>>>>
>>>>>   include_directories(${CMAKE_CURRENT_BINARY_DIR})
>>>>>
>>>>> before calling add_library work?
>>>>>
>>>>>
>>>>> On Thu, Aug 4, 2011 at 4:14 PM, Paul Whelan<pwhelan at aer.com>    wrote:
>>>>>>
>>>>>> Hi guys,
>>>>>>
>>>>>> I'm new to the mailing list and fairly new to cmake itself, so I hope
>>>>>> this
>>>>>> isn't to basic a question to be posting here. Please refer me to the
>>>>>> appropriate url/forum, etc if it is.
>>>>>>
>>>>>> I have a windows COM project that I'm trying to convert to a cmake
>>>>>> build.
>>>>>> The IDL file in that project has includes of header files in it, so I
>>>>>> need a
>>>>>> way to set the MIDL compiler's include path from cmake. I don't see an
>>>>>> obvious variable to set in cmake and the visual studio (2008) project
>>>>>> that
>>>>>> it generates comes up with a blank MIDL include path. Any suggestions
>>>>>> on
>>>>>> how
>>>>>> to set that and maybe also where I should be looking for that type of
>>>>>> info
>>>>>> if it is readily available?
>>>>>>
>>>>>> Thanks,
>>>>>> Paul
>>>>>> _______________________________________________
>>>>>> Powered by www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at
>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>>>>
>>>>
>>
>


More information about the CMake mailing list