Ninja: Fix RC include directories regression
Changes in commit b9aa5041
(cmLocalGenerator: Simplify GetIncludeFlags
output formatting, 2014-03-04) caused Windows Resource Compiler include
directories to be computed as relative paths in the Ninja generator.
This breaks the cmcldeps handling of include paths. The reason for the
regression is that several cmLocalGenerator::GetIncludeFlags callers
treated the fourth "bool forResponseFile" argument as if it controlled
whether include directories were a full path. It actually did control
that by accident until the above commit.
Add an explicit "bool forceFullPaths" argument to GetIncludeFlags
and thread the value through ConvertToIncludeReference as needed.
Update GetIncludeFlags call sites that really wanted to control the
forResponseFile setting to be aware of the new argument. Extend the
VSResource test to cover this case.
This commit is contained in:
parent
5ab9aa62fe
commit
f4c5eade78
|
@ -1287,9 +1287,11 @@ cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string
|
std::string
|
||||||
cmLocalGenerator::ConvertToIncludeReference(std::string const& path,
|
cmLocalGenerator::ConvertToIncludeReference(std::string const& path,
|
||||||
OutputFormat format)
|
OutputFormat format,
|
||||||
|
bool forceFullPaths)
|
||||||
{
|
{
|
||||||
return this->ConvertToOutputForExisting(path, START_OUTPUT, format);
|
return this->ConvertToOutputForExisting(
|
||||||
|
path, forceFullPaths? FULL : START_OUTPUT, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -1297,6 +1299,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
|
||||||
const std::vector<std::string> &includes,
|
const std::vector<std::string> &includes,
|
||||||
cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
const std::string& lang,
|
const std::string& lang,
|
||||||
|
bool forceFullPaths,
|
||||||
bool forResponseFile,
|
bool forResponseFile,
|
||||||
const std::string& config)
|
const std::string& config)
|
||||||
{
|
{
|
||||||
|
@ -1401,7 +1404,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
|
||||||
flagUsed = true;
|
flagUsed = true;
|
||||||
}
|
}
|
||||||
std::string includePath =
|
std::string includePath =
|
||||||
this->ConvertToIncludeReference(*i, shellFormat);
|
this->ConvertToIncludeReference(*i, shellFormat, forceFullPaths);
|
||||||
if(quotePaths && includePath.size() && includePath[0] != '\"')
|
if(quotePaths && includePath.size() && includePath[0] != '\"')
|
||||||
{
|
{
|
||||||
includeFlags << "\"";
|
includeFlags << "\"";
|
||||||
|
|
|
@ -160,6 +160,7 @@ public:
|
||||||
std::string GetIncludeFlags(const std::vector<std::string> &includes,
|
std::string GetIncludeFlags(const std::vector<std::string> &includes,
|
||||||
cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
const std::string& lang,
|
const std::string& lang,
|
||||||
|
bool forceFullPaths = false,
|
||||||
bool forResponseFile = false,
|
bool forResponseFile = false,
|
||||||
const std::string& config = "");
|
const std::string& config = "");
|
||||||
|
|
||||||
|
@ -215,7 +216,8 @@ public:
|
||||||
OutputFormat format = SHELL);
|
OutputFormat format = SHELL);
|
||||||
|
|
||||||
virtual std::string ConvertToIncludeReference(std::string const& path,
|
virtual std::string ConvertToIncludeReference(std::string const& path,
|
||||||
OutputFormat format = SHELL);
|
OutputFormat format = SHELL,
|
||||||
|
bool forceFullPaths = false);
|
||||||
|
|
||||||
/** Called from command-line hook to clear dependencies. */
|
/** Called from command-line hook to clear dependencies. */
|
||||||
virtual void ClearDependencies(cmMakefile* /* mf */,
|
virtual void ClearDependencies(cmMakefile* /* mf */,
|
||||||
|
|
|
@ -151,9 +151,10 @@ cmLocalNinjaGenerator::ConvertToLinkReference(std::string const& lib,
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
cmLocalNinjaGenerator::ConvertToIncludeReference(std::string const& path,
|
cmLocalNinjaGenerator::ConvertToIncludeReference(std::string const& path,
|
||||||
OutputFormat format)
|
OutputFormat format,
|
||||||
|
bool forceFullPaths)
|
||||||
{
|
{
|
||||||
return this->Convert(path, HOME_OUTPUT, format);
|
return this->Convert(path, forceFullPaths? FULL : HOME_OUTPUT, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -108,7 +108,8 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::string ConvertToIncludeReference(std::string const& path,
|
virtual std::string ConvertToIncludeReference(std::string const& path,
|
||||||
OutputFormat format = SHELL);
|
OutputFormat format = SHELL,
|
||||||
|
bool forceFullPaths = false);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1962,7 +1962,7 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
|
||||||
|
|
||||||
std::string includeFlags =
|
std::string includeFlags =
|
||||||
this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
|
this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
|
||||||
lang, useResponseFile);
|
lang, false, useResponseFile);
|
||||||
if(includeFlags.empty())
|
if(includeFlags.empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -18,6 +18,11 @@ if(CMAKE_RC_COMPILER MATCHES windres)
|
||||||
message(STATUS "CMAKE_RC_COMPILER MATCHES windres")
|
message(STATUS "CMAKE_RC_COMPILER MATCHES windres")
|
||||||
add_definitions(/DCMAKE_RCDEFINE=test.txt)
|
add_definitions(/DCMAKE_RCDEFINE=test.txt)
|
||||||
add_definitions(/DCMAKE_RCDEFINE_NO_QUOTED_STRINGS)
|
add_definitions(/DCMAKE_RCDEFINE_NO_QUOTED_STRINGS)
|
||||||
|
if(MSYS AND CMAKE_CURRENT_BINARY_DIR MATCHES " ")
|
||||||
|
# windres cannot handle spaces in include dir, and
|
||||||
|
# for the MSys shell we do not convert to shortpath.
|
||||||
|
set(CMAKE_RC_NO_INCLUDE 1)
|
||||||
|
endif()
|
||||||
elseif(MSVC60)
|
elseif(MSVC60)
|
||||||
# VS6 rc compiler does not deal well with spaces in a "/D" value, but it can
|
# VS6 rc compiler does not deal well with spaces in a "/D" value, but it can
|
||||||
# handle the quoting
|
# handle the quoting
|
||||||
|
@ -30,10 +35,17 @@ else()
|
||||||
set(TEXTFILE_FROM_SOURCE_DIR "textfile, spaces in name, from binary dir")
|
set(TEXTFILE_FROM_SOURCE_DIR "textfile, spaces in name, from binary dir")
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test.txt
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test.txt
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/test with spaces.txt" @ONLY)
|
"${CMAKE_CURRENT_BINARY_DIR}/test with spaces.txt" @ONLY)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
add_definitions(/DCMAKE_RCDEFINE="test with spaces.txt")
|
add_definitions(/DCMAKE_RCDEFINE="test with spaces.txt")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_RC_NO_INCLUDE)
|
||||||
|
add_definitions(/DCMAKE_RC_NO_INCLUDE)
|
||||||
|
else()
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include.rc.in
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/include.rc" @ONLY)
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(VSResource main.cpp test.rc)
|
add_executable(VSResource main.cpp test.rc)
|
||||||
|
|
||||||
set_property(TARGET VSResource
|
set_property(TARGET VSResource
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
// This file should be included.
|
|
@ -1,4 +1,7 @@
|
||||||
#ifdef CMAKE_RCDEFINE
|
#ifdef CMAKE_RCDEFINE
|
||||||
|
# ifndef CMAKE_RC_NO_INCLUDE
|
||||||
|
# include <include.rc>
|
||||||
|
# endif
|
||||||
|
|
||||||
// This line can compile with either an unquoted or a quoted string
|
// This line can compile with either an unquoted or a quoted string
|
||||||
1025 TEXTFILE CMAKE_RCDEFINE
|
1025 TEXTFILE CMAKE_RCDEFINE
|
||||||
|
|
Loading…
Reference in New Issue