View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0008165 | CMake | CMake | public | 2008-11-25 09:51 | 2012-03-16 13:07 | ||||
Reporter | Robert Lenhardt | ||||||||
Assigned To | David Cole | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | CMake 2.8.4 | Fixed in Version | CMake 2.8.4 | ||||||
Summary | 0008165: vs2005 midl chokes on CMAKE_INTDIR | ||||||||
Description | The midl compiler of Visual Studio 2005 chokes on the CMAKE_INTDIR define which is added by cmake. The problem is the escaped double quote in /D "CMAKE_INTDIR=\"Debug\"" midl hands them over to the preprocessor as /D "CMAKE_INTDIR=\" and thinks Debug\"" is the input file: BuildLog command line: Creating temporary file "c:\foo\Debug\RSP00016D23004524.rsp" with contents [ /D "CMAKE_INTDIR=\"Debug\"" /char signed /env win32 /Oicf /tlb "foo.tlb" /out "foo.dir\Debug" /h "foo.h" /iid "foo_i.c" /proxy "foo_p.c" foo.idl ] Creating command line "midl.exe @c:\foo\Debug\RSP00016D23004524.rsp /nologo" BuildLog Output: Creating Type Library... midl : command line warning MIDL1009 : unknown argument ignored "foo.idl" Processing Debug\"" Debug"" c1 : fatal error C1083: Cannot open source file: 'Debug""': Invalid argument midl : command line error MIDL1003 : error returned by the C preprocessor (2) I don't know if this behavior was fixed in recent versions. This is certainly a bug of midl, but i can not switch off the CMAKE_INTDIR define easily as it is hardcoded in the C++ sources. So right now i have to manually remove the double quotes after a cmake run. It would be nice to select the inclusion of this define maybe per target or per file. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | cmLocalVisualStudio7Generator.cxx.patch [^] (2,258 bytes) 2008-12-03 03:18 [Show Content]
patch_cmake_midl_VS2005.patch [^] (2,536 bytes) 2010-01-21 01:07 [Show Content] cmLocalVisualStudio7Generator.cxx.2.8.0.patch [^] (2,128 bytes) 2010-01-29 06:16 [Show Content] no_ppdefs_for_midl.patch [^] (433 bytes) 2010-11-13 02:14 [Show Content] VSMidl.zip [^] (953 bytes) 2010-11-15 15:43 | ||||||||
Relationships | |||||||||||||||||||||
|
Relationships |
Notes | |
(0014273) Robert Lenhardt (reporter) 2008-12-03 03:24 |
I made a fix in cmLocalVisualStudio7Generator.cxx where the CMAKE_INTDIR define is passed to the midl compiler through AdditionalOptions and not with PreprocessorDefinitions. This way the define which already has quotes in it does not get double quoted as a whole by the IDE. This fixes the problem. Maybe all defines with double quotes should be passed this way -- in my project i do not have any of those. |
(0016649) Lluís Batlle (reporter) 2009-06-08 05:57 |
I need to use the midl compiler in one of my projects, and I hit with this problem. Is there any chance to have that in a cmake release anytime soon? Regards, Lluís. |
(0018331) Jeroen Dierckx (reporter) 2009-11-03 12:01 |
This still doesn't work correctly in Visual Studio 2008, with cmake 2.6-patch4. |
(0018691) qbproger (reporter) 2009-12-03 09:19 |
Just ran into this with Visual Studio 2005, cmake 2.6-patch4. I was trying to convert from vcproj files to cmake. If you'd like me to test with cmake 2.8 I can. |
(0019235) gfr10 (reporter) 2010-01-21 01:07 |
Added patch for cmake-2.8.0. |
(0019362) Robert Lenhardt (reporter) 2010-01-29 06:17 |
I added a patch with my not so intrusive fix for 2.8.0. I can also confirm that this bug applies to VS2008. So i ask you to put this little fix in the next CMake release. It would make those locked up in COM very happy. Thank you, keep up the good work! |
(0023198) David Cole (manager) 2010-11-12 07:16 |
I have been discouraged from simply applying the simple patch because: - it only deals with the one CMAKE_INTDIR define, and it should apply to any define that is double-quoted - it's not clear to me that we should be passing all the C++ defines as MIDL defines in the first place - there is no test in the CMake test suite that will automatically verify this as fixed on the dashboard runs If everybody listening in on this bug thinks the simple patch is sufficient, then I guess I should apply it -- after all, it's better than the way things are now, right? Chime in, add a note, and let me know how many people are listening here, and if you all think the "cmLocalVisualStudio7Generator.cxx.2.8.0.patch" is sufficient. |
(0023209) Robert Lenhardt (reporter) 2010-11-12 13:23 |
Hi everybody, i can understand your points, but here are some points in favor of this patch: - the CMAKE_INTDIR macro is special because it is inserted unconditionally -- you can work around in CMakeLists.txt if there is some misbehaving define in one of the COMPILE_DEFINITIONS variables - witout it you can not include .idl files as cmake sources for VS2005/8 I had a look at the possibility to pass all preprocessor defintions as additional options, but it looks as if you need to change the Options class a lot to make it work, or capture the output of OutputPreprocessorDefinitions and do some dirty string replacement (the following does not work because the defines are missing the /D): std::ostringsstream oss; targetOptions.OutputPreprocessorDefinitions(oss, "\n\t\t\t\t", ""); std::string addOptions = oss.str(); std::string::size_type p = 0; while (p=addOptions.find(p,"PreprocessorDefinitions") != std::string::npos) { addOptions.replace(p,"AdditionalOptions"); } So i would opt for including the patch. Regarding your third point -- please point me to the code of some example test for cmake and i will happily provide you with a midl test. I would say the test should do a midl run on an empty .idl file to at least make sure that cmake can run midl out of the box. |
(0023230) Robert Lenhardt (reporter) 2010-11-12 17:05 |
On second thought i favor the removal of preprocessor definitions for midl altogether. If you need defines passed to the idl file you can include a header. If you add an idl file to an empty Visual Studio project, there are no default defines in the vcproj for midl. So there is no need to try to force passing definitions to the midl commandline in CMake. What do the idl experts monitoring this issue think? |
(0023231) Scott (reporter) 2010-11-12 17:15 |
It would be nice to see a fix for this in the next release so the patch doesn't have to be applied each time a new one is downloaded. |
(0023236) Robert Lenhardt (reporter) 2010-11-13 02:27 |
Just for the record there is now a patch with the removal of the preprocesor options for midl. I have tested it with my idl files and can can confirm it works. Thank you David for bringing up that issue once again. Sometimes you need to think for two years to remove one line of code ;-) Can you point me to an example of the cmake test suite, so i can create a simple midl test for the dashboard runs? |
(0023254) David Cole (manager) 2010-11-15 07:56 |
The CMake test suite is best approached through CMake/Tests/CMakeLists.txt. Many of the subdirectories of CMake/Tests are standalone projects that get built as part of running ctest on CMake itself. A test for this is probably best wrapped in a block like this: IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") ...similar to the VSExternalInclude test. |
(0023268) Robert Lenhardt (reporter) 2010-11-15 15:47 |
I added a midl test run on a barebone idl file with small check if generated files are includeable in main. You can add the following to Tests/CmakeLists.txt right after the VSExternalInclude Test: ADD_TEST(VSMidl ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VSMidl" "${CMake_BINARY_DIR}/Tests/VSMidl" --build-two-config --build-generator ${CMAKE_TEST_GENERATOR} --build-project VSMidl --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command VSMidl) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl") |
(0024421) David Cole (manager) 2011-01-05 11:08 |
Fixed by this commit, just pushed to CMake 'next': http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13caaa3eb74a11dbf067409ea129321718d34dfe [^] I expect this will make it into the upcoming CMake 2.8.4 release. I will update this and related issues with another note if that expectation turns out to be too optimistic... :-) |
(0026308) David Cole (manager) 2011-05-02 14:45 |
Closing resolved issues that have not been updated in more than 3 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2008-11-25 09:51 | Robert Lenhardt | New Issue | |
2008-12-03 03:18 | Robert Lenhardt | File Added: cmLocalVisualStudio7Generator.cxx.patch | |
2008-12-03 03:24 | Robert Lenhardt | Note Added: 0014273 | |
2009-01-29 14:35 | Bill Hoffman | Status | new => assigned |
2009-01-29 14:35 | Bill Hoffman | Assigned To | => David Cole |
2009-06-08 05:57 | Lluís Batlle | Note Added: 0016649 | |
2009-11-03 12:01 | Jeroen Dierckx | Note Added: 0018331 | |
2009-12-03 09:19 | qbproger | Note Added: 0018691 | |
2010-01-21 01:07 | gfr10 | File Added: patch_cmake_midl_VS2005.patch | |
2010-01-21 01:07 | gfr10 | Note Added: 0019235 | |
2010-01-29 06:16 | Robert Lenhardt | File Added: cmLocalVisualStudio7Generator.cxx.2.8.0.patch | |
2010-01-29 06:17 | Robert Lenhardt | Note Added: 0019362 | |
2010-11-12 06:28 | David Cole | Target Version | => CMake 2.8.4 |
2010-11-12 07:16 | David Cole | Note Added: 0023198 | |
2010-11-12 13:23 | Robert Lenhardt | Note Added: 0023209 | |
2010-11-12 17:05 | Robert Lenhardt | Note Added: 0023230 | |
2010-11-12 17:15 | Scott | Note Added: 0023231 | |
2010-11-13 02:14 | Robert Lenhardt | File Added: no_ppdefs_for_midl.patch | |
2010-11-13 02:27 | Robert Lenhardt | Note Added: 0023236 | |
2010-11-15 07:56 | David Cole | Note Added: 0023254 | |
2010-11-15 08:09 | David Cole | Relationship added | related to 0011311 |
2010-11-15 15:43 | Robert Lenhardt | File Added: VSMidl.zip | |
2010-11-15 15:47 | Robert Lenhardt | Note Added: 0023268 | |
2010-12-15 09:16 | David Cole | Relationship added | related to 0010687 |
2010-12-15 12:13 | David Cole | Relationship added | related to 0011461 |
2011-01-05 11:08 | David Cole | Note Added: 0024421 | |
2011-01-05 11:08 | David Cole | Status | assigned => resolved |
2011-01-05 11:08 | David Cole | Fixed in Version | => CMake 2.8.4 |
2011-01-05 11:08 | David Cole | Resolution | open => fixed |
2011-05-02 14:45 | David Cole | Note Added: 0026308 | |
2011-05-02 14:45 | David Cole | Status | resolved => closed |
2012-03-16 13:07 | Brad King | Relationship added | related to 0013043 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |