From 0ef091d98677253c340d4045413057c50566a528 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 19 Aug 2012 23:14:15 +0200 Subject: [PATCH] Early return if there is no target. The remainder of this method depends on the target existing (otherwise the includes container would be empty), so make the code a little more readable. --- Source/cmLocalGenerator.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 62b6ce763..3f6fe0394 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1390,6 +1390,11 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } } + if(!target) + { + return; + } + // Load implicit include directories for this language. std::string impDirVar = "CMAKE_"; impDirVar += lang; @@ -1407,10 +1412,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Get the target-specific include directories. std::vector includes; - if(target) - { - includes = target->GetIncludeDirectories(); - } + + includes = target->GetIncludeDirectories(); // Support putting all the in-project include directories first if // it is requested by the project.