diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-11-28 19:19:45 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-11-28 19:19:45 (GMT) |
commit | 9789fe0ec2989d28880b43c4cebdaefc5bced753 (patch) | |
tree | 60776550591fe9911a70db80c51f9d92a664e2a3 /Source | |
parent | 909714cc23c0630e055b6835325641ad1e44d8a0 (diff) | |
download | CMake-9789fe0ec2989d28880b43c4cebdaefc5bced753.zip CMake-9789fe0ec2989d28880b43c4cebdaefc5bced753.tar.gz CMake-9789fe0ec2989d28880b43c4cebdaefc5bced753.tar.bz2 |
ENH: merge in changes from the main tree
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 16 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 16 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 43 |
4 files changed, 83 insertions, 9 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 955fd15..10c3237 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -365,6 +365,7 @@ IF(BUILD_TESTING) # and not the ctest from the cmake building and testing # cmake. SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest") + SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake") # Should the long tests be run? OPTION(CMAKE_RUN_LONG_TESTS "Should the long tests be run (such as Bootstrap)." ON) @@ -390,6 +391,18 @@ IF(BUILD_TESTING) --build-project TestTar --test-command TestTarExec) + ADD_TEST(TargetName ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/TargetName" + "${CMake_BINARY_DIR}/Tests/TargetName" + --build-two-config + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project TargetName + --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files + ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world + ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world) + ADD_TEST(CustomCommand ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustomCommand" @@ -729,7 +742,7 @@ IF(BUILD_TESTING) QT_QT_LIBRARY QT_UIC_EXE) - IF (QT_FOUND AND QT_UIC_EXECUTABLE) + IF (QT_FOUND AND QT_WRAP_UI) ADD_TEST(qtwrapping ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Wrapping" @@ -740,7 +753,7 @@ IF(BUILD_TESTING) --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --test-command qtwrapping ) - ENDIF (QT_FOUND AND QT_UIC_EXECUTABLE) + ENDIF (QT_FOUND AND QT_WRAP_UI) ADD_TEST(testdriver1 ${CMAKE_CTEST_COMMAND} --build-and-test diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a6e44bd..7afdb31 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1857,6 +1857,22 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName, // Look for a CMake target with the given name. if(cmTarget* target = this->GlobalGenerator->FindTarget(0, name.c_str())) { + // make sure it is not just a coincidence that the target name + // found is part of the inName + if(cmSystemTools::FileIsFullPath(inName)) + { + std::string tLocation = target->GetLocation(config); + tLocation = cmSystemTools::GetFilenamePath(tLocation); + std::string depLocation = cmSystemTools::GetFilenamePath( + std::string(inName)); + if(depLocation != tLocation) + { + // it is a full path to a depend that has the same name + // as a target but is in a different location so do not use + // the target as the depend + return inName; + } + } switch (target->GetType()) { case cmTarget::EXECUTABLE: diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e87e8ab..ecc4699 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1136,7 +1136,13 @@ void cmMakefileTargetGenerator { return; } - + // Compute which library configuration to link. + cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; + if(cmSystemTools::UpperCase( + this->LocalGenerator->ConfigurationName.c_str()) == "DEBUG") + { + linkType = cmTarget::DEBUG; + } // Keep track of dependencies already listed. std::set<cmStdString> emitted; @@ -1149,6 +1155,14 @@ void cmMakefileTargetGenerator for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); lib != tlibs.end(); ++lib) { + // skip the library if it is not general and the link type + // does not match the current target + if(lib->second != cmTarget::GENERAL && + lib->second != linkType) + { + continue; + } + // Don't emit the same library twice for this target. if(emitted.insert(lib->first).second) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b2c5dc2..6102fa7 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -230,15 +230,41 @@ void cmTarget::TraceVSDependencies(std::string projFile, unsigned int i; for (i = 0; i < outsf->GetCustomCommand()->GetDepends().size(); ++i) { - std::string dep = cmSystemTools::GetFilenameName( - outsf->GetCustomCommand()->GetDepends()[i]); + const std::string& fullName + = outsf->GetCustomCommand()->GetDepends()[i]; + std::string dep = cmSystemTools::GetFilenameName(fullName); if (cmSystemTools::GetFilenameLastExtension(dep) == ".exe") { dep = cmSystemTools::GetFilenameWithoutLastExtension(dep); } - // watch for target dependencies, - if(this->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->FindTarget(0, dep.c_str())) + bool isUtility = false; + // see if we can find a target with this name + cmTarget* t = this->Makefile->GetLocalGenerator()-> + GetGlobalGenerator()->FindTarget(0, dep.c_str()); + if(t) + { + // if we find the target and the dep was given as a full + // path, then make sure it was not a full path to something + // else, and the fact that the name matched a target was + // just a coincident + if(cmSystemTools::FileIsFullPath(fullName.c_str())) + { + std::string tLocation = t->GetLocation(0); + tLocation = cmSystemTools::GetFilenamePath(tLocation); + std::string depLocation = cmSystemTools::GetFilenamePath( + std::string(fullName)); + if(depLocation == tLocation) + { + isUtility = true; + } + } + // if it was not a full path then it must be a target + else + { + isUtility = true; + } + } + if(isUtility) { // add the depend as a utility on the target this->AddUtility(dep.c_str()); @@ -737,7 +763,9 @@ void cmTarget::Emit( const std::string& lib, { // It's already been emitted if( emitted.find(lib) != emitted.end() ) + { return; + } // Emit the dependencies only if this library node hasn't been // visited before. If it has, then we have a cycle. The recursion @@ -797,7 +825,9 @@ void cmTarget::GatherDependencies( const cmMakefile& mf, // If the library is already in the dependency map, then it has // already been fully processed. if( dep_map.find(lib) != dep_map.end() ) + { return; + } const char* deps = mf.GetDefinition( (lib+"_LIB_DEPENDS").c_str() ); if( deps && strcmp(deps,"") != 0 ) @@ -857,7 +887,8 @@ const char* cmTarget::GetDirectory(const char* config) this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); break; default: - return 0; + this->Directory = this->Makefile->GetStartOutputDirectory(); + break; } if(this->Directory.empty()) { |