summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-06-11 13:44:31 (GMT)
committerBrad King <brad.king@kitware.com>2003-06-11 13:44:31 (GMT)
commit2db5cc8c31cf281d9f106433fbfe3060d97fa664 (patch)
tree2b7ffaacc26ed53e8ed603789e832b0c2610c6c9 /Source
parent9c1afa85e9d7b1dfa21a4dd9264763ef4260a6df (diff)
downloadCMake-2db5cc8c31cf281d9f106433fbfe3060d97fa664.zip
CMake-2db5cc8c31cf281d9f106433fbfe3060d97fa664.tar.gz
CMake-2db5cc8c31cf281d9f106433fbfe3060d97fa664.tar.bz2
BUG: When executable output path is not set, we still need to generate the full path to the executable target.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx31
1 files changed, 29 insertions, 2 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 33d5572..badaa0a 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -1093,9 +1093,21 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
buildType = cmSystemTools::UpperCase(buildType);
std::string flags;
- std::string target = m_ExecutableOutputPath + name
- + cmSystemTools::GetExecutableExtension();
+
+ // Construct the full path to the executable that will be generated.
+ std::string target = m_ExecutableOutputPath;
+ if(target.length() == 0)
+ {
+ target = m_Makefile->GetCurrentOutputDirectory();
+ if(target.size() && target[target.size()-1] != '/')
+ {
+ target += "/";
+ }
+ }
+ target += name;
+ target += cmSystemTools::GetExecutableExtension();
target = cmSystemTools::ConvertToOutputPath(target.c_str());
+
std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
std::string depend = "$(";
depend += this->CreateMakeVariable(name, "_SRC_OBJS")
@@ -1189,6 +1201,21 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
target.c_str(),
depend.c_str(),
commands);
+
+ // If there is no executable output path, add a rule with the
+ // relative path to the executable. This is necessary for
+ // try-compile to work in this case.
+ if(m_ExecutableOutputPath.length() == 0)
+ {
+ target = name;
+ target += cmSystemTools::GetExecutableExtension();
+ target = cmSystemTools::ConvertToOutputPath(target.c_str());
+ this->OutputMakeRule(fout,
+ comment.c_str(),
+ target.c_str(),
+ depend.c_str(),
+ commands);
+ }
}