summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-07 21:12:37 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-07 21:12:37 (GMT)
commit52eb0ccac76b0f4066af11d9ed4537204633548a (patch)
tree78505b8e32417eaf945c8a2ca929a11f8c1644cc /Source/cmLocalGenerator.cxx
parent9f2790d3e7e5a1e8e564d7f670fe2ff8b28cf6e6 (diff)
downloadCMake-52eb0ccac76b0f4066af11d9ed4537204633548a.zip
CMake-52eb0ccac76b0f4066af11d9ed4537204633548a.tar.gz
CMake-52eb0ccac76b0f4066af11d9ed4537204633548a.tar.bz2
BUG: Restore old interface of "make foo.o" and "make foo.i" even though object file names now include source extensions. For Java we also need to always remove the source extension (.java -> .class). This fixes the re-opening of bug #6169.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx25
1 files changed, 22 insertions, 3 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d22a2ef..f91ed10 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2700,7 +2700,8 @@ cmLocalGenerator
std::string
cmLocalGenerator
::GetObjectFileNameWithoutTarget(const cmSourceFile& source,
- std::string::size_type dir_len)
+ std::string::size_type dir_len,
+ bool* hasSourceExtension)
{
// Construct the object file name using the full path to the source
// file which is its only unique identification.
@@ -2751,11 +2752,25 @@ cmLocalGenerator
// Replace the original source file extension with the object file
// extension.
+ bool keptSourceExtension = true;
if(!source.GetPropertyAsBool("KEEP_EXTENSION"))
{
- // Remove the original extension for CMake 2.4 compatibility.
- if(this->NeedBackwardsCompatibility(2, 4))
+ // Decide whether this language wants to replace the source
+ // extension with the object extension. For CMake 2.4
+ // compatibility do this by default.
+ bool replaceExt = this->NeedBackwardsCompatibility(2, 4);
+ if(!replaceExt)
+ {
+ std::string repVar = "CMAKE_";
+ repVar += source.GetLanguage();
+ repVar += "_OUTPUT_EXTENSION_REPLACE";
+ replaceExt = this->Makefile->IsOn(repVar.c_str());
+ }
+
+ // Remove the source extension if it is to be replaced.
+ if(replaceExt)
{
+ keptSourceExtension = false;
std::string::size_type dot_pos = objectName.rfind(".");
if(dot_pos != std::string::npos)
{
@@ -2767,6 +2782,10 @@ cmLocalGenerator
objectName +=
this->GlobalGenerator->GetLanguageOutputExtension(source);
}
+ if(hasSourceExtension)
+ {
+ *hasSourceExtension = keptSourceExtension;
+ }
// Convert to a safe name.
return this->CreateSafeUniqueObjectFileName(objectName.c_str(), dir_len);