summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx17
-rw-r--r--Tests/ExternalOBJ/CMakeLists.txt2
-rw-r--r--Tests/ExternalOBJ/Sub/CMakeLists.txt3
3 files changed, 9 insertions, 13 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 88ad178..6caaad1 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -857,19 +857,10 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
si = this->GeneratorTarget->ExternalObjects.begin();
si != this->GeneratorTarget->ExternalObjects.end(); ++si)
{
- // If an object file is generated, then vs10
- // will use it in the build, and we have to list
- // it as None instead of Object
- if((*si)->GetPropertyAsBool("GENERATED"))
- {
- this->WriteSource("None", *si);
- }
- // If it is not a generated object then we have
- // to use the Object type
- else
- {
- this->WriteSource("Object", *si);
- }
+ // If an object file is generated in this target, then vs10 will use
+ // it in the build, and we have to list it as None instead of Object.
+ std::vector<cmSourceFile*> const* d = this->Target->GetSourceDepends(*si);
+ this->WriteSource((d && !d->empty())? "None":"Object", *si);
}
this->WriteSources("None", this->GeneratorTarget->ExtraSources);
diff --git a/Tests/ExternalOBJ/CMakeLists.txt b/Tests/ExternalOBJ/CMakeLists.txt
index f12de11..683e799 100644
--- a/Tests/ExternalOBJ/CMakeLists.txt
+++ b/Tests/ExternalOBJ/CMakeLists.txt
@@ -59,3 +59,5 @@ ADD_EXECUTABLE(ExternalOBJ executable.cxx ${CUSTOM_OBJECT})
# not didn't work. So, repeat the executable using the object
# directly and not from the output of the copy.
ADD_EXECUTABLE(ExternalOBJ2 executable.cxx ${EXTERNAL_OBJECT})
+
+ADD_SUBDIRECTORY(Sub)
diff --git a/Tests/ExternalOBJ/Sub/CMakeLists.txt b/Tests/ExternalOBJ/Sub/CMakeLists.txt
new file mode 100644
index 0000000..35cd30c
--- /dev/null
+++ b/Tests/ExternalOBJ/Sub/CMakeLists.txt
@@ -0,0 +1,3 @@
+set_property(SOURCE ${CUSTOM_OBJECT} PROPERTY GENERATED 1)
+add_executable(ExternalOBJSub ../executable.cxx ${CUSTOM_OBJECT})
+add_dependencies(ExternalOBJSub ExternalOBJ) # depend on generating target