diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2000-09-27 19:01:19 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2000-09-27 19:01:19 (GMT) |
commit | 74c1345333b456eb34480c987bc186ef2af3c536 (patch) | |
tree | 0c0751e4bfef94831377d7f5e20202b27cd06de9 /Source/cmUnixMakefile.cxx | |
parent | 1e3ba0f1d72873233193ce69614fd4bd880e8fc5 (diff) | |
download | CMake-74c1345333b456eb34480c987bc186ef2af3c536.zip CMake-74c1345333b456eb34480c987bc186ef2af3c536.tar.gz CMake-74c1345333b456eb34480c987bc186ef2af3c536.tar.bz2 |
ENH: change ME to LIBRARY and added PROJECT, also remove ITK stuff and replaced with CMake
Diffstat (limited to 'Source/cmUnixMakefile.cxx')
-rw-r--r-- | Source/cmUnixMakefile.cxx | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/Source/cmUnixMakefile.cxx b/Source/cmUnixMakefile.cxx index 8a21295..11964b4 100644 --- a/Source/cmUnixMakefile.cxx +++ b/Source/cmUnixMakefile.cxx @@ -101,8 +101,8 @@ void cmUnixMakefile::OutputMakefile(const char* file) // Ouput Library name if there are SRC_OBJS if(strlen(this->GetLibraryName()) > 0) { - fout << "ME = " << this->GetLibraryName() << "\n\n"; - fout << "BUILD_LIB_FILE = lib${ME}${ITK_LIB_EXT}\n\n"; + fout << "LIBRARY = " << this->GetLibraryName() << "\n\n"; + fout << "BUILD_LIB_FILE = lib${LIBRARY}${CMAKE_LIB_EXT}\n\n"; } // Output SRC_OBJ list for all the classes to be compiled fout << "SRC_OBJ = \\\n"; @@ -157,6 +157,11 @@ void cmUnixMakefile::OutputMakefile(const char* file) linkLibs += " "; } linkLibs += " ${LOCAL_LINK_FLAGS} "; + // create and output a varible in the makefile that + // each executable will depend on. This will have all the + // libraries that the executable uses + fout << "CMAKE_DEPEND_LIBS = "; + this->OutputDependLibraries(fout); // Now create rules for all of the executables to be built for(int i = 0; i < m_Classes.size(); i++) { @@ -164,7 +169,9 @@ void cmUnixMakefile::OutputMakefile(const char* file) { std::string DotO = m_Classes[i].m_ClassName; DotO += ".o"; - fout << m_Classes[i].m_ClassName << ": " << DotO << "\n"; + + fout << m_Classes[i].m_ClassName << ": " << DotO << " "; + fout << "${CMAKE_DEPEND_LIBS}\n"; fout << "\t${CXX} ${CXX_FLAGS} " << DotO.c_str() << " " << linkLibs.c_str() @@ -239,3 +246,29 @@ void cmUnixMakefile::OutputMakefile(const char* file) } this->OutputDepends(fout); } + +void cmUnixMakefile::OutputDependLibraries(std::ostream& fout) +{ + std::vector<std::string>& libs = m_BuildFlags.GetLinkLibraries(); + std::vector<std::string>& libdirs = m_BuildFlags.GetLinkDirectories(); + std::vector<std::string>::iterator dir, lib, endlibs, enddirs; + for(lib = libs.begin(); lib != libs.end(); ++lib) + { + bool found = false; + for(dir = libdirs.begin(); dir != libdirs.end() && !found; ++dir) + { + std::string expression = "LIBRARY.*=.*"; + expression += lib->c_str(); + if(cmSystemTools::Grep(dir->c_str(), "CMakeTargets.make", expression.c_str())) + { + std::string libpath = *dir; + libpath += "/lib"; + libpath += *lib; + libpath += "${CMAKE_LIB_EXT}"; + fout << libpath << " "; + found = true; + } + } + } + fout << "\n"; +} |