diff options
author | Ken Martin <ken.martin@kitware.com> | 2005-06-20 18:00:48 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2005-06-20 18:00:48 (GMT) |
commit | 26c53fe14c4d6cabb8b7476f5c19ca7088199841 (patch) | |
tree | 0a21177b04547b365a0c82a52979315cb4adcd97 | |
parent | 490119d2aa31eaaeb99a145ab3e7b2aee2c957db (diff) | |
download | CMake-26c53fe14c4d6cabb8b7476f5c19ca7088199841.zip CMake-26c53fe14c4d6cabb8b7476f5c19ca7088199841.tar.gz CMake-26c53fe14c4d6cabb8b7476f5c19ca7088199841.tar.bz2 |
ENH: modified GET_TARGET_PROPERTIES to work with all targets
-rw-r--r-- | Docs/CMake04.rtf | 32 | ||||
-rw-r--r-- | Source/cmGetTargetPropertyCommand.cxx | 54 | ||||
-rw-r--r-- | Source/cmGetTargetPropertyCommand.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 5 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 45 |
5 files changed, 57 insertions, 83 deletions
diff --git a/Docs/CMake04.rtf b/Docs/CMake04.rtf deleted file mode 100644 index de27369..0000000 --- a/Docs/CMake04.rtf +++ /dev/null @@ -1,32 +0,0 @@ -{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
-{\f28\froman\fcharset238\fprq2 Times New Roman CE;}{\f29\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f31\froman\fcharset161\fprq2 Times New Roman Greek;}{\f32\froman\fcharset162\fprq2 Times New Roman Tur;}
-{\f33\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f34\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f35\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f36\fswiss\fcharset238\fprq2 Arial CE;}{\f37\fswiss\fcharset204\fprq2 Arial Cyr;}
-{\f39\fswiss\fcharset161\fprq2 Arial Greek;}{\f40\fswiss\fcharset162\fprq2 Arial Tur;}{\f41\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f42\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f43\fswiss\fcharset186\fprq2 Arial Baltic;}}
-{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;
-\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
-\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\author deneb}{\operator deneb}{\creatim\yr2001\mo7\dy18\hr16\min33}{\revtim\yr2001\mo7\dy18\hr16\min39}{\version2}{\edmins6}
-{\nofpages1}{\nofwords187}{\nofchars1067}{\*\company Dell Computer Corporation}{\nofcharsws1310}{\vern8269}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701
-\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind4\viewscale100\nolnhtadjtbl \fet0\sectd \linex0\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3
-\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}
-{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain
-\ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\f1\fs28 CMake Version 0.4
-\par
-\par }{\b\f1\fs20
-\par This is the 0.6
- beta release of CMake for Windows. This is still a beta release so no features or commands are fixed in stone. If you find bugs send them to kitware@kitware.com with a subject of CMake Bug. See http://public.kitware.com/CMake for additional information.
-
-\par
-\par Changes from 0.4 to 0.6
-\par
-\par Library search paths now only look to .lib on Windows and .so .sl for UNIX. CMakeLists files now supports escape sequences. Better testing support. Depend checks expand variables. AUX_SOURCE_DIRECTORY no longer adds all files
-, but looks at the source extension. Added CMAKE_COMPILER_IS_GNUCXX variable. Mac OSX support. Make sure Cache is cleared in the GUI.
-\par
-\par Changes from 0.2 to 0.4
-\par
-\par A number of fixes to support different UNIX compilers, better error reporting for the TARGET_LINK_LIBRARY command when a bad target is specified, when searching for programs CMake will no longer mistake a directory
- for a program, a resizing bug was fixed when CMake was minimized, the ADD_LIBRARY command now supports an optional argument that can specify if a library can only be built as static (or shared, or either).
-\par
-\par Changes from 0.1 to 0.2
-\par
-\par This release has a large number of changes, new features and bug fixes. Unlike version 0.1 the commands in this version are fairly stable. }{\f1\fs20
-\par }}
\ No newline at end of file diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 9c8ed4f..45164da 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -27,56 +27,18 @@ bool cmGetTargetPropertyCommand::InitialPass( } const char* var = args[0].c_str(); const char* targetName = args[1].c_str(); - cmTargets& targets = m_Makefile->GetTargets(); - cmTargets::iterator i = targets.find(targetName); - if ( i != targets.end()) + + cmTarget *tgt = m_Makefile->GetLocalGenerator()->GetGlobalGenerator() + ->FindTarget(0,targetName); + if (tgt) { - cmTarget& target = i->second; - if ( args[2] == "LOCATION" ) + cmTarget& target = *tgt; + const char *prop = target.GetProperty(args[2].c_str()); + if (prop) { - std::string target_location; - switch( target.GetType() ) - { - case cmTarget::STATIC_LIBRARY: - case cmTarget::MODULE_LIBRARY: - case cmTarget::SHARED_LIBRARY: - target_location = m_Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); - break; - case cmTarget::EXECUTABLE: - target_location = m_Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); - break; - default: - m_Makefile->AddDefinition(var, "NOTFOUND"); - return true; - } - if ( target_location.size() == 0 ) - { - target_location += m_Makefile->GetCurrentOutputDirectory(); - } - if ( target_location.size() > 0 ) - { - target_location += "/"; - } - const char* cfgid = m_Makefile->GetDefinition("CMAKE_CFG_INTDIR"); - if ( cfgid && strcmp(cfgid, ".") != 0 ) - { - target_location += cfgid; - target_location += "/"; - } - - target_location += target.GetFullName(m_Makefile); - m_Makefile->AddDefinition(var, target_location.c_str()); + m_Makefile->AddDefinition(var, prop); return true; } - else - { - const char *prop = target.GetProperty(args[2].c_str()); - if (prop) - { - m_Makefile->AddDefinition(var, prop); - return true; - } - } } m_Makefile->AddDefinition(var, "NOTFOUND"); return true; diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index 3f617a0..8e455c3 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -60,7 +60,9 @@ public: "a target is built. The read-only property \"LOCATION\" specifies " "the full path to the file on disk that will be created for the " "target. This is very useful for executable targets to get " - "the path to the executable file for use in a custom command."; + "the path to the executable file for use in a custom command. " + "This command can get properties for any target so far created. " + "The targets do not need to be in the current CMakeLists.txt file."; } cmTypeMacro(cmGetTargetPropertyCommand, cmCommand); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 8b35116..6ed8609 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -143,6 +143,9 @@ public: */ void FindMakeProgram(cmMakefile*); + ///! Find a target by name by searching the local generators. + cmTarget* FindTarget(const char* project, const char* name); + protected: // Fill the m_ProjectMap, this must be called after m_LocalGenerators has been populated. void FillProjectMap(); @@ -159,8 +162,6 @@ protected: // map from project name to vector of local generators in that project std::map<cmStdString, std::vector<cmLocalGenerator*> > m_ProjectMap; - ///! Find a target by name by searching the local generators. - cmTarget* FindTarget(const char* project, const char* name); private: // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2248ec4..abb29ea 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1079,7 +1079,8 @@ void cmMakefile::AddLibrary(const char* lname, int shared, target.SetInAll(true); target.GetSourceLists() = srcs; this->AddGlobalLinkInformation(lname, target); - m_Targets.insert(cmTargets::value_type(lname,target)); + cmTargets::iterator it = + m_Targets.insert(cmTargets::value_type(lname,target)).first; // Add an entry into the cache std::string libPath = lname; @@ -1088,7 +1089,27 @@ void cmMakefile::AddLibrary(const char* lname, int shared, AddCacheEntry(libPath.c_str(), this->GetCurrentOutputDirectory(), "Path to a library", cmCacheManager::INTERNAL); - + + // set the LOCATION property of the target + std::string target_location; + target_location = this->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); + if ( target_location.size() == 0 ) + { + target_location += this->GetCurrentOutputDirectory(); + } + if ( target_location.size() > 0 ) + { + target_location += "/"; + } + const char* cfgid = this->GetDefinition("CMAKE_CFG_INTDIR"); + if ( cfgid && strcmp(cfgid, ".") != 0 ) + { + target_location += cfgid; + target_location += "/"; + } + target_location += target.GetFullName(this); + target.SetProperty("LOCATION",target_location.c_str()); + // Add an entry into the cache std::string ltname = lname; ltname += "_LIBRARY_TYPE"; @@ -1133,6 +1154,26 @@ cmTarget* cmMakefile::AddExecutable(const char *exeName, cmTargets::iterator it = m_Targets.insert(cmTargets::value_type(exeName,target)).first; + // set the LOCATION property of the target + std::string target_location; + target_location = this->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); + if ( target_location.size() == 0 ) + { + target_location += this->GetCurrentOutputDirectory(); + } + if ( target_location.size() > 0 ) + { + target_location += "/"; + } + const char* cfgid = this->GetDefinition("CMAKE_CFG_INTDIR"); + if ( cfgid && strcmp(cfgid, ".") != 0 ) + { + target_location += cfgid; + target_location += "/"; + } + target_location += target.GetFullName(this); + it->second.SetProperty("LOCATION",target_location.c_str()); + // Add an entry into the cache std::string exePath = exeName; exePath += "_CMAKE_PATH"; |