GenEx: Fix reporting about not-found include directories and libraries.
This fixes a regression introduced in commit 290e92ad
(Move
GetIncludeDirectories to cmGeneratorTarget, 2012-09-16) which loops over
cmGeneratorTargets before they get created, so the container is empty.
This commit is contained in:
parent
f7ef32b00b
commit
79edd00235
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
|
#include "assert.h"
|
||||||
|
|
||||||
#include <cmsys/String.h>
|
#include <cmsys/String.h>
|
||||||
|
|
||||||
|
@ -129,3 +130,51 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmGeneratorExpression::Preprocess(const std::string &input,
|
||||||
|
PreprocessContext context)
|
||||||
|
{
|
||||||
|
if (context != StripAllGeneratorExpressions)
|
||||||
|
{
|
||||||
|
assert(!"cmGeneratorExpression::Preprocess called with invalid args");
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string result;
|
||||||
|
std::string::size_type pos = 0;
|
||||||
|
std::string::size_type lastPos = pos;
|
||||||
|
while((pos = input.find("$<", lastPos)) != input.npos)
|
||||||
|
{
|
||||||
|
result += input.substr(lastPos, pos - lastPos);
|
||||||
|
pos += 2;
|
||||||
|
int nestingLevel = 1;
|
||||||
|
const char *c = input.c_str() + pos;
|
||||||
|
const char * const cStart = c;
|
||||||
|
for ( ; *c; ++c)
|
||||||
|
{
|
||||||
|
if(c[0] == '$' && c[1] == '<')
|
||||||
|
{
|
||||||
|
++nestingLevel;
|
||||||
|
++c;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(c[0] == '>')
|
||||||
|
{
|
||||||
|
--nestingLevel;
|
||||||
|
if (nestingLevel == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const std::string::size_type traversed = (c - cStart) + 1;
|
||||||
|
if (!*c)
|
||||||
|
{
|
||||||
|
result += "$<" + input.substr(pos, traversed);
|
||||||
|
}
|
||||||
|
pos += traversed;
|
||||||
|
lastPos = pos;
|
||||||
|
}
|
||||||
|
result += input.substr(lastPos);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,13 @@ public:
|
||||||
const cmCompiledGeneratorExpression& Parse(std::string const& input);
|
const cmCompiledGeneratorExpression& Parse(std::string const& input);
|
||||||
const cmCompiledGeneratorExpression& Parse(const char* input);
|
const cmCompiledGeneratorExpression& Parse(const char* input);
|
||||||
|
|
||||||
|
enum PreprocessContext {
|
||||||
|
StripAllGeneratorExpressions
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::string Preprocess(const std::string &input,
|
||||||
|
PreprocessContext context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmGeneratorExpression(const cmGeneratorExpression &);
|
cmGeneratorExpression(const cmGeneratorExpression &);
|
||||||
void operator=(const cmGeneratorExpression &);
|
void operator=(const cmGeneratorExpression &);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "cmComputeTargetDepends.h"
|
#include "cmComputeTargetDepends.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
|
#include "cmGeneratorExpression.h"
|
||||||
|
|
||||||
#include <cmsys/Directory.hxx>
|
#include <cmsys/Directory.hxx>
|
||||||
|
|
||||||
|
@ -1152,13 +1153,13 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
{
|
{
|
||||||
manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
|
manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
|
||||||
this->LocalGenerators[i]->ConfigureFinalPass();
|
this->LocalGenerators[i]->ConfigureFinalPass();
|
||||||
cmGeneratorTargetsType targets =
|
cmTargets &targets =
|
||||||
this->LocalGenerators[i]->GetMakefile()->GetGeneratorTargets();
|
this->LocalGenerators[i]->GetMakefile()->GetTargets();
|
||||||
for (cmGeneratorTargetsType::iterator l = targets.begin();
|
for (cmTargets::iterator l = targets.begin();
|
||||||
l != targets.end(); l++)
|
l != targets.end(); l++)
|
||||||
{
|
{
|
||||||
const cmTarget::LinkLibraryVectorType& libs =
|
const cmTarget::LinkLibraryVectorType& libs =
|
||||||
l->second->Target->GetOriginalLinkLibraries();
|
l->second.GetOriginalLinkLibraries();
|
||||||
for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin();
|
for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin();
|
||||||
lib != libs.end(); ++lib)
|
lib != libs.end(); ++lib)
|
||||||
{
|
{
|
||||||
|
@ -1174,14 +1175,23 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
}
|
}
|
||||||
std::string text = notFoundMap[varName];
|
std::string text = notFoundMap[varName];
|
||||||
text += "\n linked by target \"";
|
text += "\n linked by target \"";
|
||||||
text += l->second->GetName();
|
text += l->second.GetName();
|
||||||
text += "\" in directory ";
|
text += "\" in directory ";
|
||||||
text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
|
text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
|
||||||
notFoundMap[varName] = text;
|
notFoundMap[varName] = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<std::string> incs;
|
std::vector<std::string> incs;
|
||||||
this->LocalGenerators[i]->GetIncludeDirectories(incs, l->second);
|
const char *incDirProp = l->second.GetProperty("INCLUDE_DIRECTORIES");
|
||||||
|
if (!incDirProp)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string incDirs = cmGeneratorExpression::Preprocess(incDirProp,
|
||||||
|
cmGeneratorExpression::StripAllGeneratorExpressions);
|
||||||
|
|
||||||
|
cmSystemTools::ExpandListArgument(incDirs.c_str(), incs);
|
||||||
|
|
||||||
for( std::vector<std::string>::const_iterator incDir = incs.begin();
|
for( std::vector<std::string>::const_iterator incDir = incs.begin();
|
||||||
incDir != incs.end(); ++incDir)
|
incDir != incs.end(); ++incDir)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmMakeDepend.h"
|
#include "cmMakeDepend.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
#include "cmGeneratorExpression.h"
|
||||||
|
|
||||||
#include <cmsys/RegularExpression.hxx>
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
|
@ -58,12 +59,22 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
|
||||||
// Now extract any include paths from the targets
|
// Now extract any include paths from the targets
|
||||||
std::set<std::string> uniqueIncludes;
|
std::set<std::string> uniqueIncludes;
|
||||||
std::vector<std::string> orderedAndUniqueIncludes;
|
std::vector<std::string> orderedAndUniqueIncludes;
|
||||||
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
|
cmTargets &targets = this->Makefile->GetTargets();
|
||||||
for (cmGeneratorTargetsType::iterator l = targets.begin();
|
for (cmTargets::iterator l = targets.begin();
|
||||||
l != targets.end(); ++l)
|
l != targets.end(); ++l)
|
||||||
{
|
{
|
||||||
const std::vector<std::string>& includes =
|
const char *incDirProp = l->second.GetProperty("INCLUDE_DIRECTORIES");
|
||||||
l->second->GetIncludeDirectories();
|
if (!incDirProp)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string incDirs = cmGeneratorExpression::Preprocess(incDirProp,
|
||||||
|
cmGeneratorExpression::StripAllGeneratorExpressions);
|
||||||
|
|
||||||
|
std::vector<std::string> includes;
|
||||||
|
cmSystemTools::ExpandListArgument(incDirs.c_str(), includes);
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator j = includes.begin();
|
for(std::vector<std::string>::const_iterator j = includes.begin();
|
||||||
j != includes.end(); ++j)
|
j != includes.end(); ++j)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,6 +53,7 @@ add_RunCMake_test(ObjectLibrary)
|
||||||
add_RunCMake_test(build_command)
|
add_RunCMake_test(build_command)
|
||||||
add_RunCMake_test(find_package)
|
add_RunCMake_test(find_package)
|
||||||
add_RunCMake_test(include)
|
add_RunCMake_test(include)
|
||||||
|
add_RunCMake_test(include_directories)
|
||||||
add_RunCMake_test(list)
|
add_RunCMake_test(list)
|
||||||
|
|
||||||
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
|
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
||||||
|
include(${RunCMake_TEST}.cmake)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,6 @@
|
||||||
|
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
|
||||||
|
Please set them or make sure they are set and tested correctly in the CMake files:
|
||||||
|
NotThere1
|
||||||
|
used as include directory in directory .*
|
||||||
|
NotThere2
|
||||||
|
used as include directory in directory .*
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
include_directories(NotThere1-NOTFOUND)
|
||||||
|
|
||||||
|
include_directories($<1:There1-NOTFOUND>)
|
||||||
|
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" "int main(int,char**) { return 0; }\n")
|
||||||
|
add_executable(dummy "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp")
|
||||||
|
set_property(TARGET dummy APPEND PROPERTY INCLUDE_DIRECTORIES "NotThere2-NOTFOUND")
|
||||||
|
set_property(TARGET dummy APPEND PROPERTY INCLUDE_DIRECTORIES "$<1:There2-NOTFOUND>")
|
|
@ -0,0 +1,3 @@
|
||||||
|
include(RunCMake)
|
||||||
|
|
||||||
|
run_cmake(NotFoundContent)
|
Loading…
Reference in New Issue