mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
1 parent
b5efecc945
commit
0bccfbcf0a
4 files changed
+33
-6
No files matched your search
@@ -470,10 +470,15 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2(
|
||||
}
|
||||
|
||||
namespace {
|
||||
std::string ConvertToMakefilePathForUnix(std::string const& path)
|
||||
std::string ConvertToMakefilePathForUnix(std::string const& path,
|
||||
bool isForceQuote)
|
||||
{
|
||||
bool const quote = isForceQuote;
|
||||
std::string result;
|
||||
result.reserve(path.size());
|
||||
result.reserve(path.size() + (quote ? 2 : 0));
|
||||
if (quote) {
|
||||
result.push_back('"');
|
||||
}
|
||||
for (char c : path) {
|
||||
switch (c) {
|
||||
case '=':
|
||||
@@ -493,13 +498,18 @@ std::string ConvertToMakefilePathForUnix(std::string const& path)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (quote) {
|
||||
result.push_back('"');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
std::string ConvertToMakefilePathForWindows(std::string const& path)
|
||||
std::string ConvertToMakefilePathForWindows(std::string const& path,
|
||||
bool isForceQuote)
|
||||
{
|
||||
bool const quote = path.find_first_of(" #") != std::string::npos;
|
||||
bool const quote =
|
||||
isForceQuote || path.find_first_of(" #") != std::string::npos;
|
||||
std::string result;
|
||||
result.reserve(path.size() + (quote ? 2 : 0));
|
||||
if (quote) {
|
||||
@@ -533,12 +543,19 @@ std::string ConvertToMakefilePathForWindows(std::string const& path)
|
||||
std::string cmGlobalUnixMakefileGenerator3::ConvertToMakefilePath(
|
||||
std::string const& path) const
|
||||
{
|
||||
// Watcom WMake treats '+' as special. Quote the whole path so names
|
||||
// containing '+' (e.g. test+1.c, stdc++.cmake) are accepted.
|
||||
bool const isWatcomWMake =
|
||||
this->GetCMakeInstance()->GetState()->UseWatcomWMake();
|
||||
bool const isForceQuote =
|
||||
isWatcomWMake && path.find('+') != std::string::npos;
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
if (!this->ForceUnixPaths) {
|
||||
return ConvertToMakefilePathForWindows(path);
|
||||
return ConvertToMakefilePathForWindows(path, isForceQuote);
|
||||
}
|
||||
#endif
|
||||
return ConvertToMakefilePathForUnix(path);
|
||||
return ConvertToMakefilePathForUnix(path, isForceQuote);
|
||||
}
|
||||
|
||||
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
|
||||
|
||||
@@ -925,6 +925,8 @@ if(BUILD_TESTING)
|
||||
|
||||
ADD_TEST_MACRO(CommandLength CommandLength)
|
||||
|
||||
ADD_TEST_MACRO(PlusInFileName PlusInFileName)
|
||||
|
||||
ADD_TEST_MACRO(EmptyDepends ${CMAKE_CTEST_COMMAND})
|
||||
|
||||
add_test(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(PlusInFileName C)
|
||||
|
||||
add_executable(PlusInFileName test+1.c)
|
||||
@@ -0,0 +1,4 @@
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user