diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-06-27 19:42:27 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-06-27 19:42:27 (GMT) |
commit | a5cda2217d4e88b298be544e553725c5a3c80b56 (patch) | |
tree | 590bdac43fe4354e844dc8ccbca9f105ca2f0caf /Source | |
parent | 7bb9fdbeef33aec26e3b7b36e8a216b393a50a4b (diff) | |
download | CMake-a5cda2217d4e88b298be544e553725c5a3c80b56.zip CMake-a5cda2217d4e88b298be544e553725c5a3c80b56.tar.gz CMake-a5cda2217d4e88b298be544e553725c5a3c80b56.tar.bz2 |
ENH: fix install for cygwin, build cmake from configure
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 2 | ||||
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 74 | ||||
-rw-r--r-- | Source/cmake.cxx | 5 |
4 files changed, 63 insertions, 20 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 3a2b0dc..fea985a 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -10,7 +10,7 @@ IF(FLTK_LIBRARY) ENDIF(FLTK_LIBRARY) SOURCE_FILES(SRCS -cmake +cmake.cxx cmMakeDepend.cxx cmMakefile.cxx cmMakefileGenerator.cxx diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a3221c0..284f5f5 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -125,7 +125,7 @@ void cmSystemTools::GetPath(std::vector<std::string>& path) const char* cmSystemTools::GetExecutableExtension() { -#if defined(_WIN32) +#if defined(_WIN32) || defined(__CYGWIN__) return ".exe"; #else return ""; diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index edabe4e..7ad6d22 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -547,27 +547,41 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout) // Search the list of libraries that will be linked into // the executable emitted.clear(); + bool dll = this->BuildingSharedLibs(); for(lib2 = libs.begin(); lib2 != libs.end(); ++lib2) { if( ! emitted.insert(lib2->first).second ) continue; const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str()); - if(cacheValue - && (strcmp(m_Makefile->GetCurrentOutputDirectory(), cacheValue) != 0)) + if(cacheValue ) { - std::string libpath = cacheValue; - if(m_LibraryOutputPath.size()) + // if there is a cache value then this is a library that cmake + // knows how to build, so we can depend on it + std::string libpath; + if (strcmp(m_Makefile->GetCurrentOutputDirectory(), cacheValue) != 0) { - libpath = m_LibraryOutputPath; - libpath += "lib"; + // if the library is not in the current directory, then get the full + // path to it + std::string libpath = cacheValue; + if(m_LibraryOutputPath.size()) + { + libpath = m_LibraryOutputPath; + libpath += "lib"; + } + else + { + libpath += "/lib"; + } } else { - libpath += "/lib"; + // library is in current Makefile so use lib as a prefix + libpath = "lib"; } - libpath += lib2->first; - bool dll = this->BuildingSharedLibs(); + // add the library name + libpath += lib2->first; + // add the correct extension if(dll) { libpath += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX"); @@ -580,7 +594,6 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout) } } fout << "\n\n"; - emitted.clear(); for(lib2 = libs.begin(); lib2 != libs.end(); ++lib2) { @@ -1019,7 +1032,8 @@ void cmUnixMakefileGenerator::OutputInstallRules(std::ostream& fout) break; case cmTarget::WIN32_EXECUTABLE: case cmTarget::EXECUTABLE: - fout << "\t$(INSTALL_PROGRAM) " << l->first + fout << "\t$(INSTALL_PROGRAM) " << l->first + << cmSystemTools::GetExecutableExtension() << " " << prefix << l->second.GetInstallPath() << "\n"; break; case cmTarget::INSTALL: @@ -1030,10 +1044,30 @@ void cmUnixMakefileGenerator::OutputInstallRules(std::ostream& fout) { fout << "\t@ echo \"Installing " << *i << " \"\n"; fout << "\t@if [ -e " << *i << " ] ; then \\\n"; - fout << "\t $(INSTALL) " << *i + // avoid using install-sh to install install-sh + // does not work on windows.... + if(*i == "install-sh") + { + fout << "\t cp "; + } + else + { + fout << "\t $(INSTALL) "; + } + fout << *i << " " << prefix << l->second.GetInstallPath() << "; \\\n"; fout << "\t elif [ -e ${srcdir}/" << *i << " ] ; then \\\n"; - fout << "\t $(INSTALL) ${srcdir}/" << *i + // avoid using install-sh to install install-sh + // does not work on windows.... + if(*i == "install-sh") + { + fout << "\t cp "; + } + else + { + fout << "\t $(INSTALL) "; + } + fout << "${srcdir}/" << *i << " " << prefix << l->second.GetInstallPath() << "; \\\n"; fout << "\telse \\\n"; fout << "\t echo \" ERROR!!! Unable to find: " << *i @@ -1103,11 +1137,15 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout) 0, "${CMAKE_COMMAND} " "-H${CMAKE_SOURCE_DIR} -B${CMAKE_BINARY_DIR}"); - this->OutputMakeRule(fout, - "Rebuild cmake dummy rule", - "${CMAKE_COMMAND}", - 0, - "echo \"cmake might be out of date\""); + // do not put this command in for the cmake project + if(strcmp(m_Makefile->GetProjectName(), "CMake") != 0) + { + this->OutputMakeRule(fout, + "Rebuild cmake dummy rule", + "${CMAKE_COMMAND}", + 0, + "echo \"cmake might be out of date\""); + } this->OutputMakeRule(fout, "Rule to keep make from removing Makefiles " "if control-C is hit during a run of cmake.", diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8f8cbf9..98b95c7 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -224,6 +224,11 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args) int cmake::Generate(const std::vector<std::string>& args) { + if(args.size() == 1 && !cmSystemTools::FileExists("CMakeLists.txt")) + { + this->Usage(args[0].c_str()); + return -1; + } // look for obvious request for help for(unsigned int i=1; i < args.size(); ++i) { |