summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraCodeBlocksGenerator.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-04-25 18:01:34 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-04-25 18:01:34 (GMT)
commit81e696c99d8f1d9239aae722ffe2b2b15a5e0fa9 (patch)
treed4919f64a6be755fe99962f109540bb60d1c3fdb /Source/cmExtraCodeBlocksGenerator.cxx
parent745067bd7e1ac9d6cc40a45c58a8d1cd61eac537 (diff)
parent38d4c1ed0503917954e4ad6d29898006af89c67d (diff)
downloadCMake-81e696c99d8f1d9239aae722ffe2b2b15a5e0fa9.zip
CMake-81e696c99d8f1d9239aae722ffe2b2b15a5e0fa9.tar.gz
CMake-81e696c99d8f1d9239aae722ffe2b2b15a5e0fa9.tar.bz2
Merge topic 'OBJECTLibrariesInCodeBlocks'
38d4c1e CodeBlocks: improve support for OBJECT libraries d2ed3c7 -fix #13081: support OBJECT libraries in CodeBlocks/QtCreator projects
Diffstat (limited to 'Source/cmExtraCodeBlocksGenerator.cxx')
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx43
1 files changed, 41 insertions, 2 deletions
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 084c904..5df8627 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -386,6 +386,7 @@ void cmExtraCodeBlocksGenerator
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
+ case cmTarget::OBJECT_LIBRARY:
{
this->AppendTarget(fout, ti->first.c_str(), &ti->second,
make.c_str(), makefile, compiler.c_str());
@@ -423,6 +424,7 @@ void cmExtraCodeBlocksGenerator
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
+ case cmTarget::OBJECT_LIBRARY:
case cmTarget::UTILITY: // can have sources since 2.6.3
{
const std::vector<cmSourceFile*>&sources=ti->second.GetSourceFiles();
@@ -535,6 +537,31 @@ void cmExtraCodeBlocksGenerator
}
+// Write a dummy file for OBJECT libraries, so C::B can reference some file
+std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
+ cmMakefile* mf, cmTarget* target) const
+{
+ // this file doesn't seem to be used by C::B in custom makefile mode,
+ // but we generate a unique file for each OBJECT library so in case
+ // C::B uses it in some way, the targets don't interfere with each other.
+ std::string filename = mf->GetCurrentOutputDirectory();
+ filename += "/";
+ filename += mf->GetLocalGenerator()->GetTargetDirectory(*target);
+ filename += "/";
+ filename += target->GetName();
+ filename += ".objlib";
+ cmGeneratedFileStream fout(filename.c_str());
+ if(fout)
+ {
+ fout << "# This is a dummy file for the OBJECT library "
+ << target->GetName()
+ << " for the CMake CodeBlocks project generator.\n"
+ << "# Don't edit, this file will be overwritten.\n";
+ }
+ return filename;
+}
+
+
// Generate the xml code for one target.
void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
const char* targetName,
@@ -573,7 +600,18 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
}
const char* buildType = makefile->GetDefinition("CMAKE_BUILD_TYPE");
- fout<<" <Option output=\"" << target->GetLocation(buildType)
+ std::string location;
+ if ( target->GetType()==cmTarget::OBJECT_LIBRARY)
+ {
+ location = this->CreateDummyTargetFile(const_cast<cmMakefile*>(makefile),
+ target);
+ }
+ else
+ {
+ location = target->GetLocation(buildType);
+ }
+
+ fout<<" <Option output=\"" << location
<< "\" prefix_auto=\"0\" extension_auto=\"0\" />\n"
" <Option working_dir=\"" << workingDir << "\" />\n"
" <Option object_output=\"./\" />\n"
@@ -731,7 +769,8 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target)
return 1;
}
}
- else if ( target->GetType()==cmTarget::STATIC_LIBRARY)
+ else if (( target->GetType()==cmTarget::STATIC_LIBRARY)
+ || (target->GetType()==cmTarget::OBJECT_LIBRARY))
{
return 2;
}