From c4156b4531668adc0dc9bf37f42758d6db03ff68 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Fri, 24 Feb 2006 17:35:35 -0500 Subject: [PATCH] COMP: Even more global target fixes --- Source/cmGlobalGenerator.cxx | 4 +++- Source/cmGlobalGenerator.h | 3 +++ Source/cmGlobalUnixMakefileGenerator3.cxx | 1 - Source/cmGlobalVisualStudio6Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio6Generator.h | 2 ++ Source/cmGlobalVisualStudio71Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 3 +-- Source/cmGlobalVisualStudio7Generator.h | 4 ++++ Source/cmGlobalXCode21Generator.h | 3 +++ Source/cmGlobalXCodeGenerator.cxx | 2 -- Source/cmGlobalXCodeGenerator.h | 4 +++- Source/cmLocalVisualStudio6Generator.cxx | 7 +++---- Source/cmLocalVisualStudio7Generator.cxx | 3 +-- Source/cmMakefile.cxx | 2 ++ Source/cmTarget.h | 4 ++-- 15 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 525033dca..d94a02e3e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1309,11 +1309,13 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) cmd = "$(CMAKE_COMMAND)"; } singleLine.push_back(cmd.c_str()); - const char* cmakeCfgIntDir = mf->GetDefinition("CMAKE_CFG_INTDIR"); + const char* cmakeCfgIntDir = this->GetCMakeCFGInitDirectory(); + std::cout << "CMakeCFG: " << cmakeCfgIntDir << std::endl; if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[1] != '.' ) { std::string cfgArg = "-DBUILD_TYPE="; cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR"); + singleLine.push_back(cfgArg); } singleLine.push_back("-P"); singleLine.push_back("cmake_install.cmake"); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 92b618ce0..586473811 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -131,6 +131,9 @@ public: ///! What is the output extension for a given source file extension. const char* GetLanguageOutputExtensionFromExtension(const char* lang); + ///! What is the configurations directory variable called? + virtual const char* GetCMakeCFGInitDirectory() { return "."; } + /** * Convert the given remote path to a relative path with respect to * the given local path. The local path must be given in component diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index f16d9a1f8..d74ebf987 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -31,7 +31,6 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() void cmGlobalUnixMakefileGenerator3 ::EnableLanguage(std::vectorconst& languages, cmMakefile *mf) { - mf->AddDefinition("CMAKE_CFG_INTDIR","."); this->cmGlobalGenerator::EnableLanguage(languages, mf); std::string path; for(std::vector::const_iterator l = languages.begin(); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index f720b1f29..d24fd70a3 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -27,7 +27,6 @@ cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() void cmGlobalVisualStudio6Generator::EnableLanguage(std::vectorconst& lang, cmMakefile *mf) { - mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)"); mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); @@ -246,7 +245,8 @@ void cmGlobalVisualStudio6Generator::WriteDSWFile(std::ostream& fout, { if (al->second.IsInAll()) { - if (al->second.GetType() == cmTarget::UTILITY) + if (al->second.GetType() == cmTarget::UTILITY || + al->second.GetType() == cmTarget::GLOBAL_TARGET) { l->second.AddUtility(al->first.c_str()); } diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 687ab8a25..ab27124a7 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -78,6 +78,8 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* config, std::string& dir); + ///! What is the configurations directory variable called? + virtual const char* GetCMakeCFGInitDirectory() { return "$(IntDir)"; } private: void GenerateConfigurations(cmMakefile* mf); void WriteDSWFile(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 72ce42d3d..9c050fa37 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -107,7 +107,7 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout, { if (al->second.IsInAll()) { - if (al->second.GetType() == cmTarget::UTILITY && + if (al->second.GetType() == cmTarget::UTILITY || al->second.GetType() == cmTarget::GLOBAL_TARGET) { l->second.AddUtility(al->first.c_str()); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 6d689f6ed..72a654ae0 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -31,7 +31,6 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator() void cmGlobalVisualStudio7Generator::EnableLanguage(std::vectorconst & lang, cmMakefile *mf) { - mf->AddDefinition("CMAKE_CFG_INTDIR","$(OutDir)"); mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); @@ -315,7 +314,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout, { if (al->second.IsInAll()) { - if (al->second.GetType() == cmTarget::UTILITY && + if (al->second.GetType() == cmTarget::UTILITY || al->second.GetType() == cmTarget::GLOBAL_TARGET) { l->second.AddUtility(al->first.c_str()); diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 7ef7d3258..cff22f403 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -84,6 +84,9 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* config, std::string& dir); + ///! What is the configurations directory variable called? + virtual const char* GetCMakeCFGInitDirectory() { return "$(OutDir)"; } + protected: virtual void OutputSLNFile(cmLocalGenerator* root, std::vector& generators); @@ -103,6 +106,7 @@ protected: const char* name, const char* path, const std::vector& dependencies); + std::vector m_Configurations; std::map m_GUIDMap; diff --git a/Source/cmGlobalXCode21Generator.h b/Source/cmGlobalXCode21Generator.h index e9cb19fba..d585e0e78 100644 --- a/Source/cmGlobalXCode21Generator.h +++ b/Source/cmGlobalXCode21Generator.h @@ -32,6 +32,9 @@ public: virtual void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); + + ///! What is the configurations directory variable called? + virtual const char* GetCMakeCFGInitDirectory() { return "$(CONFIGURATION)"; } }; #endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d15e53bd9..d7736a41f 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -111,11 +111,9 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vectorconst& mf->AddDefinition("XCODE","1"); if(m_XcodeVersion == 15) { - mf->AddDefinition("CMAKE_CFG_INTDIR","."); } else { - mf->AddDefinition("CMAKE_CFG_INTDIR","$(CONFIGURATION)"); mf->AddCacheDefinition( "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo", diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 0e6f65f55..d73639b8c 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -72,6 +72,9 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* config, std::string& dir); + ///! What is the configurations directory variable called? + virtual const char* GetCMakeCFGInitDirectory() { return "."; } + private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg); @@ -148,7 +151,6 @@ private: const char* varNameSuffix, const char* default_flags); protected: - int m_XcodeVersion; std::vector m_XCodeObjects; cmXCodeObject* m_RootObject; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index d7533b90d..cf0cbc27f 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -455,8 +455,8 @@ void cmLocalVisualStudio6Generator::WriteGroup(const cmSourceGroup *sg, cmTarget { cmSystemTools::ExpandListArgument(dependsValue, depends); } - if (source != libName || target.GetType() == cmTarget::UTILITY - || target.GetType() == cmTarget::GLOBAL_TARGET) + if (source != libName || target.GetType() == cmTarget::UTILITY || + target.GetType() == cmTarget::GLOBAL_TARGET) { fout << "# Begin Source File\n\n"; @@ -721,8 +721,7 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, { std::string customRuleCode = ""; - if (target.GetType() >= cmTarget::UTILITY || - target.GetType() >= cmTarget::GLOBAL_TARGET) + if (target.GetType() >= cmTarget::UTILITY ) { return customRuleCode; } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ac55eacd8..370e5e469 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1220,8 +1220,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, cmTarget &target, const char * /*libName*/) { - if (target.GetType() > cmTarget::UTILITY || - target.GetType() > cmTarget::GLOBAL_TARGET) + if (target.GetType() > cmTarget::GLOBAL_TARGET) { return; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 566265de5..bf7f78dd2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2040,6 +2040,8 @@ cmSourceFile* cmMakefile::AddSource(cmSourceFile const&sf) void cmMakefile::EnableLanguage(std::vector const & lang) { + this->AddDefinition("CMAKE_CFG_INTDIR", + m_LocalGenerator->GetGlobalGenerator()->GetCMakeCFGInitDirectory()); m_LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index bb4140ba2..a605a35b6 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -34,8 +34,8 @@ class cmTarget public: cmTarget(); enum TargetType { EXECUTABLE, STATIC_LIBRARY, - SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, INSTALL_FILES, - INSTALL_PROGRAMS, GLOBAL_TARGET}; + SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET, + INSTALL_FILES, INSTALL_PROGRAMS}; enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };