summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/ctest_submit.rst3
-rw-r--r--Help/command/find_package.rst11
-rw-r--r--Help/prop_sf/VS_SETTINGS.rst7
-rw-r--r--Help/release/dev/ctest_memcheck-generate-test.xml.rst6
-rw-r--r--Help/release/dev/vs_settings.rst5
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake19
-rw-r--r--Modules/CMakeFindPackageMode.cmake2
-rw-r--r--Modules/FindICU.cmake4
-rw-r--r--Modules/FindThreads.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx1
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx15
-rw-r--r--Source/cmCacheManager.cxx14
-rw-r--r--Source/cmCacheManager.h16
-rw-r--r--Source/cmFindBase.cxx4
-rw-r--r--Source/cmGlobalCommonGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx5
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx6
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx5
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx11
-rw-r--r--Source/cmLocalVisualStudioGenerator.h6
-rw-r--r--Source/cmMakefile.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.cxx7
-rw-r--r--Source/cmState.cxx2
-rw-r--r--Source/cmState.h12
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx90
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h14
-rw-r--r--Source/cmake.cxx60
-rw-r--r--Source/cmake.h12
-rw-r--r--Tests/RunCMake/VS10Project/VsSettings-check.cmake15
-rw-r--r--Tests/RunCMake/VS10Project/VsSettings.cmake2
-rw-r--r--Tests/RunCMake/ctest_memcheck/ExpectedOutputs-check.cmake10
-rw-r--r--Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stdout.txt2
-rw-r--r--Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake13
37 files changed, 279 insertions, 126 deletions
diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst
index e6d277f..d661825 100644
--- a/Help/command/ctest_submit.rst
+++ b/Help/command/ctest_submit.rst
@@ -30,7 +30,8 @@ The options are:
Build = ctest_build results, in Build.xml
Test = ctest_test results, in Test.xml
Coverage = ctest_coverage results, in Coverage.xml
- MemCheck = ctest_memcheck results, in DynamicAnalysis.xml
+ MemCheck = ctest_memcheck results, in DynamicAnalysis.xml and
+ DynamicAnalysis-Test.xml
Notes = Files listed by CTEST_NOTES_FILES, in Notes.xml
ExtraFiles = Files listed by CTEST_EXTRA_SUBMIT_FILES
Upload = Files prepared for upload by ctest_upload(), in Upload.xml
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 490a5c7..8388709 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -55,12 +55,13 @@ The ``[version]`` argument requests a version with which the package found
should be compatible. There are two possible forms in which it may be
specified:
- * A single version with the format ``major[.minor[.patch[.tweak]]]``.
+ * A single version with the format ``major[.minor[.patch[.tweak]]]``, where
+ each component is a numeric value.
* A version range with the format ``versionMin...[<]versionMax`` where
- ``versionMin`` and ``versionMax`` have the same format as the single
- version. By default, both end points are included. By specifying ``<``,
- the upper end point will be excluded. Version ranges are only supported
- with CMake 3.19 or later.
+ ``versionMin`` and ``versionMax`` have the same format and constraints
+ on components being integers as the single version. By default, both end
+ points are included. By specifying ``<``, the upper end point will be
+ excluded. Version ranges are only supported with CMake 3.19 or later.
The ``EXACT`` option requests that the version be matched exactly. This option
is incompatible with the specification of a version range.
diff --git a/Help/prop_sf/VS_SETTINGS.rst b/Help/prop_sf/VS_SETTINGS.rst
index 322f5a6..871e36e 100644
--- a/Help/prop_sf/VS_SETTINGS.rst
+++ b/Help/prop_sf/VS_SETTINGS.rst
@@ -3,7 +3,12 @@ VS_SETTINGS
.. versionadded:: 3.18
-Set any item metadata on a non-built file.
+Set any item metadata on a file.
+
+.. versionadded:: 3.22
+
+ This property is honored for all source file types.
+ Previously it worked only for non-built files.
Takes a list of ``Key=Value`` pairs. Tells the Visual Studio generator to set
``Key`` to ``Value`` as item metadata on the file.
diff --git a/Help/release/dev/ctest_memcheck-generate-test.xml.rst b/Help/release/dev/ctest_memcheck-generate-test.xml.rst
new file mode 100644
index 0000000..fac02d8
--- /dev/null
+++ b/Help/release/dev/ctest_memcheck-generate-test.xml.rst
@@ -0,0 +1,6 @@
+ctest_memcheck-generate-test.xml
+--------------------------------
+
+* The :command:`ctest_memcheck` command now also generates a
+ `DynamicAnalysis-Test.xml` file which may be used to submit test results to
+ CDash.
diff --git a/Help/release/dev/vs_settings.rst b/Help/release/dev/vs_settings.rst
new file mode 100644
index 0000000..64f3ced
--- /dev/null
+++ b/Help/release/dev/vs_settings.rst
@@ -0,0 +1,5 @@
+vs_settings
+-----------
+
+* The :prop_sf:`VS_SETTINGS` source file property is now supported for
+ all source file types. Previously it worked only for non-built sources.
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index e8b9db7..a1814b7 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -125,6 +125,7 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
include(CMakeDetermineCompilerId)
set(userflags)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")
+ set(_variant "")
if("x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xIAR")
# primary necessary to detect architecture, so the right archiver and linker can be picked
# eg. "IAR Assembler V8.10.1.12857/W32 for ARM" or "IAR Assembler V4.11.1.4666 for Renesas RX"
@@ -137,6 +138,19 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
if(_all_compileid_matches)
list(GET _all_compileid_matches "-1" CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID)
endif()
+ elseif("x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xClang")
+ # Test whether an MSVC-like command-line option works.
+ execute_process(COMMAND ${CMAKE_ASM${ASM_DIALECT}_COMPILER} -?
+ OUTPUT_VARIABLE _clang_output
+ ERROR_VARIABLE _clang_output
+ RESULT_VARIABLE _clang_result)
+ if(_clang_result EQUAL 0)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_FRONTEND_VARIANT "MSVC")
+ set(CMAKE_ASM${ASM_DIALECT}_SIMULATE_ID MSVC)
+ else()
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_FRONTEND_VARIANT "GNU")
+ endif()
+ set(_variant " with ${CMAKE_ASM${ASM_DIALECT}_COMPILER_FRONTEND_VARIANT}-like command-line")
endif()
_cmake_find_compiler_sysroot(ASM${ASM_DIALECT})
@@ -144,6 +158,8 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
unset(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT)
unset(_all_compileid_matches)
unset(_compileid)
+ unset(_clang_result)
+ unset(_clang_output)
endif()
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
@@ -157,9 +173,10 @@ if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
else()
set(_archid "")
endif()
- message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}${_archid}${_version}")
+ message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}${_archid}${_version}${_variant}")
unset(_archid)
unset(_version)
+ unset(_variant)
else()
message(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
endif()
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index 815dfc9..726e2a2 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -78,7 +78,7 @@ if(UNIX)
# from the outside
if(NOT CMAKE_SIZEOF_VOID_P)
set(CMAKE_SIZEOF_VOID_P 4)
- if(EXISTS /usr/lib64)
+ if(EXISTS ${CMAKE_SYSROOT}/usr/lib64)
set(CMAKE_SIZEOF_VOID_P 8)
else()
# use the file utility to check whether itself is 64 bit:
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index 2bb49ad..1bae825 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -172,7 +172,7 @@ function(_ICU_FIND)
DOC "ICU ${program} executable"
NO_PACKAGE_ROOT_PATH
)
- mark_as_advanced(cache_var)
+ mark_as_advanced("${cache_var}")
set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
endforeach()
@@ -301,7 +301,7 @@ function(_ICU_FIND)
HINTS ${icu_roots}
PATH_SUFFIXES ${icu_data_suffixes}
DOC "ICU ${data} data file")
- mark_as_advanced(cache_var)
+ mark_as_advanced("${cache_var}")
set("${data_var}" "${${cache_var}}" PARENT_SCOPE)
endforeach()
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index c6a3451..e4d6cf3 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -106,7 +106,7 @@ endmacro()
# Do NOT even think about using it outside of this file!
macro(_check_pthreads_flag)
if(NOT Threads_FOUND)
- # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
+ # If we did not find -lpthreads, -lpthread, or -lthread, look for -pthread
if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG)
message(CHECK_START "Check if compiler accepts -pthread")
if(CMAKE_C_COMPILER_LOADED)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index ea70d2a..94e36e8 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 21)
-set(CMake_VERSION_PATCH 20210909)
+set(CMake_VERSION_PATCH 20210914)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 5b54573..bf938e4 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -804,6 +804,7 @@ int cmCTestSubmitHandler::ProcessHandler()
}
}
this->CTest->AddIfExists(cmCTest::PartMemCheck, "DynamicAnalysis.xml");
+ this->CTest->AddIfExists(cmCTest::PartMemCheck, "DynamicAnalysis-Test.xml");
this->CTest->AddIfExists(cmCTest::PartMemCheck, "Purify.xml");
this->CTest->AddIfExists(cmCTest::PartNotes, "Notes.xml");
this->CTest->AddIfExists(cmCTest::PartUpload, "Upload.xml");
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 1157d10..00c1443 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -705,6 +705,21 @@ bool cmCTestTestHandler::GenerateXML()
this->GenerateCTestXML(xml);
}
+ if (this->MemCheck) {
+ cmGeneratedFileStream xmlfile;
+ if (!this->StartResultingXML(cmCTest::PartTest, "DynamicAnalysis-Test",
+ xmlfile)) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Cannot create testing XML file" << std::endl);
+ this->LogFile = nullptr;
+ return false;
+ }
+ cmXMLWriter xml(xmlfile);
+ // Explicitly call this class' `GenerateCTestXML` method to make `Test.xml`
+ // as well.
+ this->cmCTestTestHandler::GenerateCTestXML(xml);
+ }
+
return true;
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 8fefaa6..17369c8 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -232,17 +232,17 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
// before writing the cache, update the version numbers
// to the
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION",
- std::to_string(cmVersion::GetMajorVersion()).c_str(),
+ std::to_string(cmVersion::GetMajorVersion()),
"Major version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION",
- std::to_string(cmVersion::GetMinorVersion()).c_str(),
+ std::to_string(cmVersion::GetMinorVersion()),
"Minor version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION",
- std::to_string(cmVersion::GetPatchVersion()).c_str(),
+ std::to_string(cmVersion::GetPatchVersion()),
"Patch version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
@@ -256,7 +256,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
currentcwd[0] = static_cast<char>(currentcwd[0] - 'A' + 'a');
}
cmSystemTools::ConvertToUnixSlashes(currentcwd);
- this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
+ this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd,
"This is the directory where this CMakeCache.txt"
" was created",
cmStateEnums::INTERNAL);
@@ -521,7 +521,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
"=================================================\n";
}
-void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
+void cmCacheManager::AddCacheEntry(const std::string& key, cmProp value,
const char* helpString,
cmStateEnums::CacheEntryType type)
{
@@ -550,10 +550,10 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
: "(This variable does not exist and should not be used)");
}
-void cmCacheManager::CacheEntry::SetValue(const char* value)
+void cmCacheManager::CacheEntry::SetValue(cmProp value)
{
if (value) {
- this->Value = value;
+ this->Value = *value;
this->Initialized = true;
} else {
this->Value.clear();
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 0238fb8..eca7150 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -31,7 +31,7 @@ class cmCacheManager
public:
const std::string& GetValue() const { return this->Value; }
- void SetValue(const char*);
+ void SetValue(cmProp);
cmStateEnums::CacheEntryType GetType() const { return this->Type; }
void SetType(cmStateEnums::CacheEntryType ty) { this->Type = ty; }
@@ -83,7 +83,7 @@ public:
void SetCacheEntryValue(std::string const& key, std::string const& value)
{
if (auto* entry = this->GetCacheEntry(key)) {
- entry->SetValue(value.c_str());
+ entry->SetValue(cmProp(value));
}
}
@@ -173,6 +173,18 @@ public:
//! Add an entry into the cache
void AddCacheEntry(const std::string& key, const char* value,
+ const char* helpString, cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key,
+ value ? cmProp(std::string(value)) : cmProp(nullptr),
+ helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, const std::string& value,
+ const char* helpString, cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key, cmProp(value), helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, cmProp value,
const char* helpString,
cmStateEnums::CacheEntryType type);
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index f4e1763..37f9572 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -358,8 +358,8 @@ void cmFindBase::NormalizeFindResult()
// value.
if (value != *existingValue || this->AlreadyInCacheWithoutMetaInfo) {
this->Makefile->GetCMakeInstance()->AddCacheEntry(
- this->VariableName, value.c_str(),
- this->VariableDocumentation.c_str(), this->VariableType);
+ this->VariableName, value, this->VariableDocumentation.c_str(),
+ this->VariableType);
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) ==
cmPolicies::NEW) {
if (this->Makefile->IsNormalDefinitionSet(this->VariableName)) {
diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx
index a8e0f23..24c8944 100644
--- a/Source/cmGlobalCommonGenerator.cxx
+++ b/Source/cmGlobalCommonGenerator.cxx
@@ -117,7 +117,7 @@ std::string cmGlobalCommonGenerator::GetEditCacheCommand() const
editCacheCommand = cmSystemTools::GetCMakeGUICommand();
}
if (!editCacheCommand.empty()) {
- cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
+ cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand,
"Path to cache edit program executable.",
cmStateEnums::INTERNAL);
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 17cd95e..fd1a197 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2185,9 +2185,8 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator* gen,
this->TryCompileOuterMakefile = mf;
cmProp make =
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
- this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", cmToCStr(make),
- "make program",
- cmStateEnums::FILEPATH);
+ this->GetCMakeInstance()->AddCacheEntry(
+ "CMAKE_MAKE_PROGRAM", make, "make program", cmStateEnums::FILEPATH);
// copy the enabled languages
this->GetCMakeInstance()->GetState()->SetEnabledLanguages(
gen->GetCMakeInstance()->GetState()->GetEnabledLanguages());
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index d0ad53e..3ecf32e 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -467,9 +467,9 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
// Save the selected instance persistently.
std::string genInstance = mf->GetSafeDefinition("CMAKE_GENERATOR_INSTANCE");
if (vsInstance != genInstance) {
- this->CMakeInstance->AddCacheEntry(
- "CMAKE_GENERATOR_INSTANCE", vsInstance.c_str(),
- "Generator instance identifier.", cmStateEnums::INTERNAL);
+ this->CMakeInstance->AddCacheEntry("CMAKE_GENERATOR_INSTANCE", vsInstance,
+ "Generator instance identifier.",
+ cmStateEnums::INTERNAL);
}
return true;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 763f12a..fa76b01 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3241,9 +3241,8 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
return *storedGUID;
}
- this->CMakeInstance->AddCacheEntry(guidStoreName, id.c_str(),
- "Stored Xcode object GUID",
- cmStateEnums::INTERNAL);
+ this->CMakeInstance->AddCacheEntry(
+ guidStoreName, id, "Stored Xcode object GUID", cmStateEnums::INTERNAL);
return id;
}
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index 5b532ce..c8b4a39 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -77,9 +77,8 @@ bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
if (!customGuid.empty()) {
std::string guidVariable = utility_name + "_GUID_CMAKE";
- mf.GetCMakeInstance()->AddCacheEntry(guidVariable, customGuid.c_str(),
- "Stored GUID",
- cmStateEnums::INTERNAL);
+ mf.GetCMakeInstance()->AddCacheEntry(
+ guidVariable, customGuid, "Stored GUID", cmStateEnums::INTERNAL);
}
// Create a target instance for this utility.
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 151470b..7b5fed6 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -566,7 +566,7 @@ public:
} else {
this->Stream << this->LG->EscapeForXML("\n");
}
- std::string script = this->LG->ConstructScript(ccg);
+ std::string script = this->LG->ConstructScript(ccg, unmanaged);
this->Stream << this->LG->EscapeForXML(script);
}
@@ -1779,7 +1779,7 @@ void cmLocalVisualStudio7Generator::WriteCustomRule(
}
std::string comment = this->ConstructComment(ccg);
- std::string script = this->ConstructScript(ccg);
+ std::string script = this->ConstructScript(ccg, unmanaged);
if (this->FortranProject) {
cmSystemTools::ReplaceString(script, "$(Configuration)", config);
}
@@ -2142,7 +2142,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
std::string guidStoreName = cmStrCat(name, "_GUID_CMAKE");
// save the GUID in the cache
this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry(
- guidStoreName, parser.GUID.c_str(), "Stored GUID", cmStateEnums::INTERNAL);
+ guidStoreName, parser.GUID, "Stored GUID", cmStateEnums::INTERNAL);
}
std::string cmLocalVisualStudio7Generator::GetTargetDirectory(
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 46f9d31..acddfe1 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -124,7 +124,8 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const
}
std::string cmLocalVisualStudioGenerator::ConstructScript(
- cmCustomCommandGenerator const& ccg, const std::string& newline_text)
+ cmCustomCommandGenerator const& ccg, IsManaged isManaged,
+ const std::string& newline_text)
{
bool useLocal = this->CustomCommandUseLocal();
std::string workingDirectory = ccg.GetWorkingDirectory();
@@ -236,6 +237,14 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
script += newline;
script += "if %errorlevel% neq 0 goto ";
script += this->GetReportErrorLabel();
+ if (isManaged == managed) {
+ // These aren't generated by default for C# projects.
+ script += newline;
+ script += this->GetReportErrorLabel();
+ script += newline;
+ script += "exit /b 0";
+ script += newline;
+ }
}
return script;
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 91fb6b0..0e7f63f 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -31,7 +31,13 @@ public:
virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */
+ enum IsManaged
+ {
+ unmanaged,
+ managed
+ };
std::string ConstructScript(cmCustomCommandGenerator const& ccg,
+ IsManaged isManaged,
const std::string& newline = "\n");
/** Label to which to jump in a batch file after a failed step in a
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9e7816f..ef31d76 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1927,7 +1927,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
nvalue += files[cc];
}
- this->GetCMakeInstance()->AddCacheEntry(name, nvalue.c_str(), doc, type);
+ this->GetCMakeInstance()->AddCacheEntry(name, nvalue, doc, type);
nvalue = *this->GetState()->GetInitializedCacheValue(name);
value = nvalue.c_str();
}
@@ -3561,13 +3561,13 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// Tell the single-configuration generator which one to use.
// Add this before the user-provided CMake arguments in case
// one of the arguments is -DCMAKE_BUILD_TYPE=...
- cm.AddCacheEntry("CMAKE_BUILD_TYPE", config->c_str(),
- "Build configuration", cmStateEnums::STRING);
+ cm.AddCacheEntry("CMAKE_BUILD_TYPE", config, "Build configuration",
+ cmStateEnums::STRING);
}
}
cmProp recursionDepth = this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH");
if (recursionDepth) {
- cm.AddCacheEntry("CMAKE_MAXIMUM_RECURSION_DEPTH", recursionDepth->c_str(),
+ cm.AddCacheEntry("CMAKE_MAXIMUM_RECURSION_DEPTH", recursionDepth,
"Maximum recursion depth", cmStateEnums::STRING);
}
// if cmake args were provided then pass them in
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 1b6b834..be8bb08 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -774,8 +774,11 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
cmProp d = mf->GetDefinition("CMAKE_C_COMPILER");
const std::string cl =
d ? *d : mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
- cldeps = cmStrCat('"', cmSystemTools::GetCMClDepsCommand(), "\" ", lang,
- ' ', vars.Source, " $DEP_FILE $out \"",
+ std::string cmcldepsPath;
+ cmSystemTools::GetShortPath(cmSystemTools::GetCMClDepsCommand(),
+ cmcldepsPath);
+ cldeps = cmStrCat(cmcldepsPath, ' ', lang, ' ', vars.Source,
+ " $DEP_FILE $out \"",
mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX"),
"\" \"", cl, "\" ");
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index cfd9ad0..16718e8 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -206,7 +206,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key,
return this->CacheManager->GetCacheEntryPropertyAsBool(key, propertyName);
}
-void cmState::AddCacheEntry(const std::string& key, const char* value,
+void cmState::AddCacheEntry(const std::string& key, cmProp value,
const char* helpString,
cmStateEnums::CacheEntryType type)
{
diff --git a/Source/cmState.h b/Source/cmState.h
index 0fd28d0..390f6d6 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -219,6 +219,18 @@ public:
private:
friend class cmake;
void AddCacheEntry(const std::string& key, const char* value,
+ const char* helpString, cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key,
+ value ? cmProp(std::string(value)) : cmProp(nullptr),
+ helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, const std::string& value,
+ const char* helpString, cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key, cmProp(value), helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, cmProp value,
const char* helpString,
cmStateEnums::CacheEntryType type);
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 9407228..75fb05f 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1465,7 +1465,10 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
cmCustomCommandGenerator ccg(command, c, lg, true);
std::string comment = lg->ConstructComment(ccg);
comment = cmVS10EscapeComment(comment);
- std::string script = lg->ConstructScript(ccg);
+ cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed)
+ ? cmLocalVisualStudioGenerator::managed
+ : cmLocalVisualStudioGenerator::unmanaged;
+ std::string script = lg->ConstructScript(ccg, isManaged);
bool symbolic = false;
// input files for custom command
std::stringstream additional_inputs;
@@ -1796,8 +1799,8 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources(
}
}
-void cmVisualStudio10TargetGenerator::WriteHeaderSource(Elem& e1,
- cmSourceFile const* sf)
+void cmVisualStudio10TargetGenerator::WriteHeaderSource(
+ Elem& e1, cmSourceFile const* sf, ConfigToSettings const& toolSettings)
{
std::string const& fileName = sf->GetFullPath();
Elem e2(e1, "ClInclude");
@@ -1808,6 +1811,7 @@ void cmVisualStudio10TargetGenerator::WriteHeaderSource(Elem& e1,
e2.Element("DependentUpon",
fileName.substr(0, fileName.find_last_of(".")));
}
+ this->FinishWritingSource(e2, toolSettings);
}
void cmVisualStudio10TargetGenerator::ParseSettingsProperty(
@@ -1864,8 +1868,8 @@ bool cmVisualStudio10TargetGenerator::PropertyIsSameInAllConfigs(
return true;
}
-void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
- cmSourceFile const* sf)
+void cmVisualStudio10TargetGenerator::WriteExtraSource(
+ Elem& e1, cmSourceFile const* sf, ConfigToSettings& toolSettings)
{
bool toolHasSettings = false;
const char* tool = "None";
@@ -1876,10 +1880,6 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
std::string copyToOutDir;
std::string includeInVsix;
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
- ConfigToSettings toolSettings;
- for (const auto& config : this->Configurations) {
- toolSettings[config];
- }
if (this->ProjectType == csproj && !this->InSourceBuild) {
toolHasSettings = true;
@@ -2047,10 +2047,6 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
}
}
- if (cmProp p = sf->GetProperty("VS_SETTINGS")) {
- ParseSettingsProperty(*p, toolSettings);
- }
-
if (!toolSettings.empty()) {
toolHasSettings = true;
}
@@ -2060,27 +2056,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
if (toolHasSettings) {
e2.SetHasElements();
- std::vector<std::string> writtenSettings;
- for (const auto& configSettings : toolSettings) {
- for (const auto& setting : configSettings.second) {
-
- if (std::find(writtenSettings.begin(), writtenSettings.end(),
- setting.first) != writtenSettings.end()) {
- continue;
- }
-
- if (PropertyIsSameInAllConfigs(toolSettings, setting.first)) {
- e2.Element(setting.first, setting.second);
- writtenSettings.push_back(setting.first);
- } else {
- e2.WritePlatformConfigTag(setting.first,
- "'$(Configuration)|$(Platform)'=='" +
- configSettings.first + "|" +
- this->Platform + "'",
- setting.second);
- }
- }
- }
+ this->FinishWritingSource(e2, toolSettings);
if (!deployContent.empty()) {
cmGeneratorExpression ge;
@@ -2217,6 +2193,15 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
// Skip explicit reference to CMakeLists.txt source.
continue;
}
+
+ ConfigToSettings toolSettings;
+ for (const auto& config : this->Configurations) {
+ toolSettings[config];
+ }
+ if (cmProp p = si.Source->GetProperty("VS_SETTINGS")) {
+ ParseSettingsProperty(*p, toolSettings);
+ }
+
const char* tool = nullptr;
switch (si.Kind) {
case cmGeneratorTarget::SourceKindAppManifest:
@@ -2244,10 +2229,10 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
}
break;
case cmGeneratorTarget::SourceKindExtra:
- this->WriteExtraSource(e1, si.Source);
+ this->WriteExtraSource(e1, si.Source, toolSettings);
break;
case cmGeneratorTarget::SourceKindHeader:
- this->WriteHeaderSource(e1, si.Source);
+ this->WriteHeaderSource(e1, si.Source, toolSettings);
break;
case cmGeneratorTarget::SourceKindIDL:
tool = "Midl";
@@ -2357,6 +2342,8 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
if (!isCSharp && !exclude_configs.empty()) {
this->WriteExcludeFromBuild(e2, exclude_configs);
}
+
+ this->FinishWritingSource(e2, toolSettings);
}
}
@@ -2365,6 +2352,32 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
}
}
+void cmVisualStudio10TargetGenerator::FinishWritingSource(
+ Elem& e2, ConfigToSettings const& toolSettings)
+{
+ std::vector<std::string> writtenSettings;
+ for (const auto& configSettings : toolSettings) {
+ for (const auto& setting : configSettings.second) {
+
+ if (std::find(writtenSettings.begin(), writtenSettings.end(),
+ setting.first) != writtenSettings.end()) {
+ continue;
+ }
+
+ if (PropertyIsSameInAllConfigs(toolSettings, setting.first)) {
+ e2.Element(setting.first, setting.second);
+ writtenSettings.push_back(setting.first);
+ } else {
+ e2.WritePlatformConfigTag(setting.first,
+ "'$(Configuration)|$(Platform)'=='" +
+ configSettings.first + "|" +
+ this->Platform + "'",
+ setting.second);
+ }
+ }
+ }
+}
+
void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
Elem& e2, cmSourceFile const* source)
{
@@ -4205,7 +4218,10 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
comment += lg->ConstructComment(ccg);
script += pre;
pre = "\n";
- script += lg->ConstructScript(ccg);
+ cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed)
+ ? cmLocalVisualStudioGenerator::managed
+ : cmLocalVisualStudioGenerator::unmanaged;
+ script += lg->ConstructScript(ccg, isManaged);
stdPipesUTF8 = stdPipesUTF8 || cc.GetStdPipesUTF8();
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 55c5444..a5ce5e5 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -58,6 +58,10 @@ private:
struct Elem;
struct OptionsHelper;
+ using ConfigToSettings =
+ std::unordered_map<std::string,
+ std::unordered_map<std::string, std::string>>;
+
std::string ConvertPath(std::string const& path, bool forceRelative);
std::string CalcCondition(const std::string& config) const;
void WriteProjectConfigurations(Elem& e0);
@@ -66,12 +70,15 @@ private:
void WriteCEDebugProjectConfigurationValues(Elem& e0);
void WriteMSToolConfigurationValuesManaged(Elem& e1,
std::string const& config);
- void WriteHeaderSource(Elem& e1, cmSourceFile const* sf);
- void WriteExtraSource(Elem& e1, cmSourceFile const* sf);
+ void WriteHeaderSource(Elem& e1, cmSourceFile const* sf,
+ ConfigToSettings const& toolSettings);
+ void WriteExtraSource(Elem& e1, cmSourceFile const* sf,
+ ConfigToSettings& toolSettings);
void WriteNsightTegraConfigurationValues(Elem& e1,
std::string const& config);
void WriteAndroidConfigurationValues(Elem& e1, std::string const& config);
void WriteSource(Elem& e2, cmSourceFile const* sf);
+ void FinishWritingSource(Elem& e2, ConfigToSettings const& toolSettings);
void WriteExcludeFromBuild(Elem& e2,
std::vector<size_t> const& exclude_configs);
void WriteAllSources(Elem& e0);
@@ -252,9 +259,6 @@ private:
void ClassifyAllConfigSources();
void ClassifyAllConfigSource(cmGeneratorTarget::AllConfigSource const& acs);
- using ConfigToSettings =
- std::unordered_map<std::string,
- std::unordered_map<std::string, std::string>>;
std::unordered_map<std::string, ConfigToSettings> ParsedToolTargetSettings;
bool PropertyIsSameInAllConfigs(const ConfigToSettings& toolSettings,
const std::string& propName);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index beb5d16..7cafaee 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -605,9 +605,8 @@ void cmake::ProcessCacheArg(const std::string& var, const std::string& value,
}
}
- this->AddCacheEntry(var, value.c_str(),
- "No help, variable specified on the command line.",
- type);
+ this->AddCacheEntry(
+ var, value, "No help, variable specified on the command line.", type);
if (this->WarnUnusedCli) {
if (!haveValue ||
@@ -1517,16 +1516,15 @@ void cmake::SetDirectoriesFromFile(const std::string& arg)
int cmake::AddCMakePaths()
{
// Save the value in the cache
- this->AddCacheEntry("CMAKE_COMMAND",
- cmSystemTools::GetCMakeCommand().c_str(),
+ this->AddCacheEntry("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand(),
"Path to CMake executable.", cmStateEnums::INTERNAL);
#ifndef CMAKE_BOOTSTRAP
- this->AddCacheEntry(
- "CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(),
- "Path to ctest program executable.", cmStateEnums::INTERNAL);
- this->AddCacheEntry(
- "CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(),
- "Path to cpack program executable.", cmStateEnums::INTERNAL);
+ this->AddCacheEntry("CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand(),
+ "Path to ctest program executable.",
+ cmStateEnums::INTERNAL);
+ this->AddCacheEntry("CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand(),
+ "Path to cpack program executable.",
+ cmStateEnums::INTERNAL);
#endif
if (!cmSystemTools::FileExists(
(cmSystemTools::GetCMakeRoot() + "/Modules/CMake.cmake"))) {
@@ -1538,7 +1536,7 @@ int cmake::AddCMakePaths()
cmSystemTools::GetCMakeRoot());
return 0;
}
- this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(),
+ this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot(),
"Path to CMake installation.", cmStateEnums::INTERNAL);
return 1;
@@ -1886,7 +1884,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
this->LoadCache();
// restore the changed compilers
for (SaveCacheEntry const& i : saved) {
- this->AddCacheEntry(i.key, i.value.c_str(), i.help.c_str(), i.type);
+ this->AddCacheEntry(i.key, i.value, i.help.c_str(), i.type);
}
cmSystemTools::Message(warning.str());
// avoid reconfigure if there were errors
@@ -1993,7 +1991,7 @@ int cmake::ActualConfigure()
}
if (!res) {
this->AddCacheEntry(
- "CMAKE_HOME_DIRECTORY", this->GetHomeDirectory().c_str(),
+ "CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(),
"Source directory with the top level CMakeLists.txt file for this "
"project",
cmStateEnums::INTERNAL);
@@ -2038,19 +2036,17 @@ int cmake::ActualConfigure()
}
}
if (!this->State->GetInitializedCacheValue("CMAKE_GENERATOR")) {
- this->AddCacheEntry("CMAKE_GENERATOR",
- this->GlobalGenerator->GetName().c_str(),
+ this->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName(),
"Name of generator.", cmStateEnums::INTERNAL);
- this->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
- this->GlobalGenerator->GetExtraGeneratorName().c_str(),
- "Name of external makefile project generator.",
- cmStateEnums::INTERNAL);
+ this->AddCacheEntry(
+ "CMAKE_EXTRA_GENERATOR", this->GlobalGenerator->GetExtraGeneratorName(),
+ "Name of external makefile project generator.", cmStateEnums::INTERNAL);
if (!this->State->GetInitializedCacheValue("CMAKE_TOOLCHAIN_FILE")) {
std::string envToolchain;
if (cmSystemTools::GetEnv("CMAKE_TOOLCHAIN_FILE", envToolchain) &&
!envToolchain.empty()) {
- this->AddCacheEntry("CMAKE_TOOLCHAIN_FILE", envToolchain.c_str(),
+ this->AddCacheEntry("CMAKE_TOOLCHAIN_FILE", envToolchain,
"The CMake toolchain file",
cmStateEnums::FILEPATH);
}
@@ -2069,9 +2065,9 @@ int cmake::ActualConfigure()
return -2;
}
} else {
- this->AddCacheEntry(
- "CMAKE_GENERATOR_INSTANCE", this->GeneratorInstance.c_str(),
- "Generator instance identifier.", cmStateEnums::INTERNAL);
+ this->AddCacheEntry("CMAKE_GENERATOR_INSTANCE", this->GeneratorInstance,
+ "Generator instance identifier.",
+ cmStateEnums::INTERNAL);
}
if (cmProp platformName =
@@ -2087,8 +2083,7 @@ int cmake::ActualConfigure()
return -2;
}
} else {
- this->AddCacheEntry("CMAKE_GENERATOR_PLATFORM",
- this->GeneratorPlatform.c_str(),
+ this->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform,
"Name of generator platform.", cmStateEnums::INTERNAL);
}
@@ -2104,8 +2099,7 @@ int cmake::ActualConfigure()
return -2;
}
} else {
- this->AddCacheEntry("CMAKE_GENERATOR_TOOLSET",
- this->GeneratorToolset.c_str(),
+ this->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset,
"Name of generator toolset.", cmStateEnums::INTERNAL);
}
@@ -2416,7 +2410,7 @@ int cmake::Generate()
return 0;
}
-void cmake::AddCacheEntry(const std::string& key, const char* value,
+void cmake::AddCacheEntry(const std::string& key, cmProp value,
const char* helpString, int type)
{
this->State->AddCacheEntry(key, value, helpString,
@@ -3540,7 +3534,7 @@ void cmake::SetSuppressDevWarnings(bool b)
value = "FALSE";
}
- this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value.c_str(),
+ this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value,
"Suppress Warnings that are meant for"
" the author of the CMakeLists.txt files.",
cmStateEnums::INTERNAL);
@@ -3564,7 +3558,7 @@ void cmake::SetSuppressDeprecatedWarnings(bool b)
value = "TRUE";
}
- this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value.c_str(),
+ this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value,
"Whether to issue warnings for deprecated "
"functionality.",
cmStateEnums::INTERNAL);
@@ -3588,7 +3582,7 @@ void cmake::SetDevWarningsAsErrors(bool b)
value = "TRUE";
}
- this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value.c_str(),
+ this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value,
"Suppress errors that are meant for"
" the author of the CMakeLists.txt files.",
cmStateEnums::INTERNAL);
@@ -3612,7 +3606,7 @@ void cmake::SetDeprecatedWarningsAsErrors(bool b)
value = "FALSE";
}
- this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value.c_str(),
+ this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value,
"Whether to issue deprecation errors for macros"
" and functions.",
cmStateEnums::INTERNAL);
diff --git a/Source/cmake.h b/Source/cmake.h
index 32c7582..7408044 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -332,6 +332,18 @@ public:
cmProp GetCacheDefinition(const std::string&) const;
//! Add an entry into the cache
void AddCacheEntry(const std::string& key, const char* value,
+ const char* helpString, int type)
+ {
+ this->AddCacheEntry(key,
+ value ? cmProp(std::string(value)) : cmProp(nullptr),
+ helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, const std::string& value,
+ const char* helpString, int type)
+ {
+ this->AddCacheEntry(key, cmProp(value), helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, cmProp value,
const char* helpString, int type);
bool DoWriteGlobVerifyTarget() const;
diff --git a/Tests/RunCMake/VS10Project/VsSettings-check.cmake b/Tests/RunCMake/VS10Project/VsSettings-check.cmake
index 0f8b26c..13cc8e2 100644
--- a/Tests/RunCMake/VS10Project/VsSettings-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsSettings-check.cmake
@@ -4,20 +4,29 @@ macro(ensure_props_set projectFile)
return()
endif()
- set(SettingFound FALSE)
+ set(Setting1Found FALSE)
+ set(Setting2Found FALSE)
file(STRINGS "${projectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "<SourceProperty1.*Debug.*>SourceProperty1Value</SourceProperty1>")
message("SourceProperty1 setting found")
- set(SettingFound TRUE)
+ set(Setting1Found TRUE)
+ endif()
+ if(line MATCHES "<SourceProperty2.*Debug.*>SourceProperty2Value</SourceProperty2>")
+ message("SourceProperty2 setting found")
+ set(Setting2Found TRUE)
endif()
endforeach()
- if (NOT SettingFound)
+ if (NOT Setting1Found)
set(RunCMake_TEST_FAILED "SourceProperty1 setting was not found")
return()
endif()
+ if (NOT Setting2Found)
+ set(RunCMake_TEST_FAILED "SourceProperty2 setting was not found")
+ return()
+ endif()
endmacro()
ensure_props_set("${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
diff --git a/Tests/RunCMake/VS10Project/VsSettings.cmake b/Tests/RunCMake/VS10Project/VsSettings.cmake
index a4b321b..3a046f1 100644
--- a/Tests/RunCMake/VS10Project/VsSettings.cmake
+++ b/Tests/RunCMake/VS10Project/VsSettings.cmake
@@ -3,3 +3,5 @@ enable_language(CXX)
add_library(foo foo.cpp shader.hlsl)
set_property(SOURCE shader.hlsl PROPERTY VS_SETTINGS
"$<$<CONFIG:DEBUG>:SourceProperty1=SourceProperty1Value>")
+set_property(SOURCE foo.cpp PROPERTY VS_SETTINGS
+ "$<$<CONFIG:DEBUG>:SourceProperty2=SourceProperty2Value>")
diff --git a/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-check.cmake b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-check.cmake
new file mode 100644
index 0000000..9d2a059
--- /dev/null
+++ b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-check.cmake
@@ -0,0 +1,10 @@
+function (find_xml_file name)
+ file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/${name}.xml")
+ if (NOT test_xml_file)
+ message(FATAL_ERROR
+ "${name}.xml not created.")
+ endif ()
+endfunction ()
+
+find_xml_file(DynamicAnalysis)
+find_xml_file(DynamicAnalysis-Test)
diff --git a/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stderr.txt b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stderr.txt
new file mode 100644
index 0000000..e1fc77a
--- /dev/null
+++ b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stderr.txt
@@ -0,0 +1 @@
+Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-build/Testing/Temporary/MemoryChecker.1.log\.\*
diff --git a/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stdout.txt b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stdout.txt
new file mode 100644
index 0000000..b3473bf
--- /dev/null
+++ b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stdout.txt
@@ -0,0 +1,2 @@
+Memory checking results:
+left shift of negative value -256 - 1
diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
index 6e0a91c..cb8f696 100644
--- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
@@ -95,6 +95,19 @@ unset(CMAKELISTS_EXTRA_CODE)
unset(CTEST_EXTRA_CODE)
#-----------------------------------------------------------------------------
+# add output test
+set(CTEST_EXTRA_CODE
+"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1\")
+")
+set(CMAKELISTS_EXTRA_CODE
+"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\"
+-P \"${RunCMake_SOURCE_DIR}/testUndefinedBehaviorSanitizer.cmake\")
+")
+run_mc_test(ExpectedOutputs "" -DMEMCHECK_TYPE=UndefinedBehaviorSanitizer)
+unset(CMAKELISTS_EXTRA_CODE)
+unset(CTEST_EXTRA_CODE)
+
+#-----------------------------------------------------------------------------
set(CTEST_EXTRA_CODE "string(REPLACE \" \" \"\\\\ \" PRE_POST_COMMAND \"\${CTEST_MEMORYCHECK_COMMAND}\")
set(CTEST_CUSTOM_PRE_MEMCHECK \"\${PRE_POST_COMMAND} pre command\")