[cmake-developers] [vc12/idl] output directory problem

Tim Blechmann tim at klingt.org
Thu Feb 19 01:54:25 EST 2015


hi all,

i'm having troubles with the midl compiler of generated msvc2013 project
files: the generated projects contain a hardcoded output directory:
$(IntDir). however having this property, the midl call fails for me. if
i remove this property, or replace it with $(ProjectDir)/$(IntDir) it
compiles fine.

attached patch resolves this issue for me, though i'm not sure if this
is a good solution in general. also, have to add this include directory:
"${CMAKE_CURRENT_BINARY_DIR}/MyProject.dir/${CMAKE_CFG_INTDIR}"

i'm not an expert on msvc toolchains, so it would be great if someone
could review this patch.

thanks,
tim

-------------- next part --------------
From a9f83bd54c8d7e073c4d8faee7e5b8dd68738fdc Mon Sep 17 00:00:00 2001
From: Tim Blechmann <tim at klingt.org>
Date: Thu, 19 Feb 2015 14:35:02 +0800
Subject: [PATCH] cmake: Midl - set OutputDir via absolute path

---
 Source/cmVisualStudio10TargetGenerator.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b265c0e..6c09702 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2509,7 +2509,7 @@ WriteMidlOptions(std::string const& /*config*/,
     }
   this->WriteString("%(AdditionalIncludeDirectories)"
                     "</AdditionalIncludeDirectories>\n", 0);
-  this->WriteString("<OutputDirectory>$(IntDir)</OutputDirectory>\n", 3);
+  this->WriteString("<OutputDirectory>$(ProjectDir)/$(IntDir)</OutputDirectory>\n", 3);
   this->WriteString("<HeaderFileName>%(Filename).h</HeaderFileName>\n", 3);
   this->WriteString(
     "<TypeLibraryName>%(Filename).tlb</TypeLibraryName>\n", 3);
-- 
2.3.0



More information about the cmake-developers mailing list