summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/guide/tutorial/Adding a Library.rst13
-rw-r--r--Help/guide/tutorial/Step2/CMakeLists.txt2
-rw-r--r--Help/guide/tutorial/Step2/TutorialConfig.h.in2
-rw-r--r--Help/guide/tutorial/Step2/tutorial.cxx4
-rw-r--r--Help/manual/cmake-presets.7.rst19
-rw-r--r--Help/release/3.25.rst2
-rw-r--r--Modules/CPack.cmake3
-rw-r--r--Modules/Platform/Windows-LLVMFlang-Fortran.cmake1
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx13
-rw-r--r--Source/cmGlobalNinjaGenerator.h1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx43
-rw-r--r--Source/cmVSSetupHelper.cxx23
-rw-r--r--Templates/MSBuild/FlagTables/v10_CSharp.json6
-rw-r--r--Templates/MSBuild/FlagTables/v11_CSharp.json6
-rw-r--r--Templates/MSBuild/FlagTables/v12_CSharp.json6
-rw-r--r--Templates/MSBuild/FlagTables/v140_CSharp.json6
-rw-r--r--Templates/MSBuild/FlagTables/v141_CSharp.json6
-rw-r--r--Templates/MSBuild/FlagTables/v142_CSharp.json6
-rw-r--r--Templates/MSBuild/FlagTables/v143_CSharp.json6
-rw-r--r--Tests/RunCMake/Ninja/Intl-build-check.cmake5
-rw-r--r--Tests/RunCMake/Ninja/Intl-common.cmake1
-rw-r--r--Tests/RunCMake/Ninja/Intl.cmake7
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake9
-rw-r--r--Tests/SwiftMix/CMain.c13
-rw-r--r--Tests/SwiftMix/CMakeLists.txt1
-rw-r--r--Tests/SwiftMix/SwiftMain.swift20
28 files changed, 163 insertions, 74 deletions
diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst
index 46a8909..a56c327 100644
--- a/Help/guide/tutorial/Adding a Library.rst
+++ b/Help/guide/tutorial/Adding a Library.rst
@@ -236,11 +236,12 @@ Getting Started
Start with the resulting files from Exercise 1. Complete ``TODO 7`` through
``TODO 13``.
-First create a variable ``MY_MATH`` using the :command:`option` command
+First create a variable ``USE_MYMATH`` using the :command:`option` command
in the top-level ``CMakeLists.txt`` file. In that same file, use that option
to determine whether to build and use the ``MathFunctions`` library.
-Then, update ``tutorial.cxx`` and ``TutorialConfig.h.in`` to use ``MY_MATH``.
+Then, update ``tutorial.cxx`` and ``TutorialConfig.h.in`` to use
+``USE_MYMATH``.
Build and Run
-------------
@@ -314,9 +315,9 @@ Next, create an :command:`if` statement which checks the value of
:command:`add_subdirectory` command from Exercise 1 with the additional
:command:`list` commands.
-When ``MY_MATH`` is ``ON``, the lists will be generated and will be added to
-our project. When ``MY_MATH`` is ``OFF``, the lists stay empty. With this
-strategy, we allow users to toggle ``MY_MATH`` to manipulate what library is
+When ``USE_MYMATH`` is ``ON``, the lists will be generated and will be added to
+our project. When ``USE_MYMATH`` is ``OFF``, the lists stay empty. With this
+strategy, we allow users to toggle ``USE_MYMATH`` to manipulate what library is
used in the build.
The top-level CMakeLists.txt file will now look like the following:
@@ -380,7 +381,7 @@ will cover the modern approach in the Step 3 of the tutorial.
The corresponding changes to the source code are fairly straightforward.
First, in ``tutorial.cxx``, we include the ``MathFunctions.h`` header if
-``MY_MATH`` is defined.
+``USE_MYMATH`` is defined.
.. raw:: html
diff --git a/Help/guide/tutorial/Step2/CMakeLists.txt b/Help/guide/tutorial/Step2/CMakeLists.txt
index 2f7d56e..2b96128 100644
--- a/Help/guide/tutorial/Step2/CMakeLists.txt
+++ b/Help/guide/tutorial/Step2/CMakeLists.txt
@@ -7,7 +7,7 @@ project(Tutorial VERSION 1.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
-# TODO 7: Create a variable MY_MATH using option and set default to ON
+# TODO 7: Create a variable USE_MYMATH using option and set default to ON
# configure a header file to pass some of the CMake settings
# to the source code
diff --git a/Help/guide/tutorial/Step2/TutorialConfig.h.in b/Help/guide/tutorial/Step2/TutorialConfig.h.in
index adb4c55..6c09e1a 100644
--- a/Help/guide/tutorial/Step2/TutorialConfig.h.in
+++ b/Help/guide/tutorial/Step2/TutorialConfig.h.in
@@ -2,4 +2,4 @@
#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@
#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
-// TODO 13: use cmakedefine to define MY_MATH
+// TODO 13: use cmakedefine to define USE_MYMATH
diff --git a/Help/guide/tutorial/Step2/tutorial.cxx b/Help/guide/tutorial/Step2/tutorial.cxx
index f83aa7e..87f5e0f 100644
--- a/Help/guide/tutorial/Step2/tutorial.cxx
+++ b/Help/guide/tutorial/Step2/tutorial.cxx
@@ -5,7 +5,7 @@
#include "TutorialConfig.h"
-// TODO 11: Only include MathFunctions if MY_MATH is defined
+// TODO 11: Only include MathFunctions if USE_MYMATH is defined
// TODO 5: Include MathFunctions.h
@@ -22,7 +22,7 @@ int main(int argc, char* argv[])
// convert input to double
const double inputValue = std::stod(argv[1]);
- // TODO 12: Use mysqrt if MY_MATH is defined and sqrt otherwise
+ // TODO 12: Use mysqrt if USE_MYMATH is defined and sqrt otherwise
// TODO 6: Replace sqrt with mysqrt
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst
index ae6dcb1..da699d8 100644
--- a/Help/manual/cmake-presets.7.rst
+++ b/Help/manual/cmake-presets.7.rst
@@ -161,7 +161,7 @@ that may contain the following fields:
presets by default (except ``name``, ``hidden``, ``inherits``,
``description``, and ``displayName``), but can override them as
desired. If multiple ``inherits`` presets provide conflicting values for
- the same field, the earlier preset in the ``inherits`` list will be
+ the same field, the earlier preset in the ``inherits`` array will be
preferred.
A preset can only inherit from another preset that is defined in the
@@ -202,7 +202,7 @@ that may contain the following fields:
Optional fields representing the platform and toolset, respectively, for
:manual:`generators <cmake-generators(7)>` that support them.
- See :option:`cmake -A` option for for possible values for ``architecture``
+ See :option:`cmake -A` option for possible values for ``architecture``
and :option:`cmake -T` for ``toolset``.
Each may be either a string or an object with the following fields:
@@ -226,6 +226,9 @@ that may contain the following fields:
ignore the field, but the IDE can use them to set up the environment
before invoking CMake.
+ If no ``strategy`` field is given, or if the field uses the string form
+ rather than the object form, the behavior is the same as ``"set"``.
+
``toolchainFile``
An optional string representing the path to the toolchain file.
This field supports `macro expansion`_. If a relative path is specified,
@@ -388,7 +391,7 @@ that may contain the following fields:
``inherits`` presets by default (except ``name``, ``hidden``,
``inherits``, ``description``, and ``displayName``), but can override
them as desired. If multiple ``inherits`` presets provide conflicting
- values for the same field, the earlier preset in the ``inherits`` list
+ values for the same field, the earlier preset in the ``inherits`` array
will be preferred.
A preset can only inherit from another preset that is defined in the
@@ -549,7 +552,7 @@ that may contain the following fields:
``inherits`` presets by default (except ``name``, ``hidden``,
``inherits``, ``description``, and ``displayName``), but can override
them as desired. If multiple ``inherits`` presets provide conflicting
- values for the same field, the earlier preset in the ``inherits`` list
+ values for the same field, the earlier preset in the ``inherits`` array
will be preferred.
A preset can only inherit from another preset that is defined in the
@@ -891,7 +894,7 @@ fields:
``inherits`` presets by default (except ``name``, ``hidden``,
``inherits``, ``description``, and ``displayName``), but can override
them as desired. If multiple ``inherits`` presets provide conflicting
- values for the same field, the earlier preset in the ``inherits`` list
+ values for the same field, the earlier preset in the ``inherits`` array
will be preferred.
A preset can only inherit from another preset that is defined in the
@@ -948,10 +951,10 @@ fields:
explicitly specified in this package preset.
``generators``
- An optional list of strings representing generators for CPack to use.
+ An optional array of strings representing generators for CPack to use.
``configurations``
- An optional list of strings representing build configurations for CPack to
+ An optional array of strings representing build configurations for CPack to
package.
``variables``
@@ -1073,7 +1076,7 @@ object, it has the following fields:
A required string to search for. This field supports macro expansion.
``list``
- A required list of strings to search. This field supports macro
+ A required array of strings to search. This field supports macro
expansion, and uses short-circuit evaluation.
``"matches"``
diff --git a/Help/release/3.25.rst b/Help/release/3.25.rst
index c119fae..199e067 100644
--- a/Help/release/3.25.rst
+++ b/Help/release/3.25.rst
@@ -21,7 +21,7 @@ Presets
* The :manual:`cmake-presets(7)` format now supports a
``workflowPresets`` field to specify presets for :option:`cmake --workflow`.
-* The :manual:`cmake-presets(7)` format now supports a
+* The :manual:`cmake-presets(7)` format now supports an
``outputJUnitFile`` field to specify JUnit output in test presets.
Languages
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 828d9ca..7c3ad6b 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -217,7 +217,8 @@ installers. The most commonly-used variables are:
to the user by the produced installer (often with an explicit "Accept"
button, for graphical installers) prior to installation. This license
file is NOT added to the installed files but is used by some CPack generators
- like NSIS. If you want to install a license file (may be the same as this
+ like NSIS. If you want to use UTF-8 characters, the file needs to be encoded
+ in UTF-8 BOM. If you want to install a license file (may be the same as this
one) along with your project, you must add an appropriate CMake
:command:`install` command in your ``CMakeLists.txt``.
diff --git a/Modules/Platform/Windows-LLVMFlang-Fortran.cmake b/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
index 42c283a..64dc0da 100644
--- a/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
+++ b/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
@@ -1,2 +1,3 @@
include(Platform/Windows-GNU)
+__windows_compiler_gnu(Fortran)
# TODO: MSVC ABI Support
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 631bfd9..f06946b 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -173,8 +173,8 @@ int main(int argc, char const* const* argv)
CommandArgument{ "--debug", CommandArgument::Values::Zero, debugLambda },
CommandArgument{ "--config", CommandArgument::Values::One,
CommandArgument::setToValue(cpackConfigFile) },
- CommandArgument{ "--trace", CommandArgument::Values::One, traceLambda },
- CommandArgument{ "--trace-expand", CommandArgument::Values::One,
+ CommandArgument{ "--trace", CommandArgument::Values::Zero, traceLambda },
+ CommandArgument{ "--trace-expand", CommandArgument::Values::Zero,
traceExpandLambda },
CommandArgument{ "-C", CommandArgument::Values::One,
CommandArgument::setToValue(cpackBuildConfig) },
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index c326ca6..077de42 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1030,19 +1030,6 @@ bool cmGlobalNinjaGenerator::OpenBuildFileStreams()
return false;
}
- // New buffer size 8 MiB
- constexpr auto buildFileStreamBufferSize = 8 * 1024 * 1024;
-
- // Ensure the buffer is allocated
- if (!this->BuildFileStreamBuffer) {
- this->BuildFileStreamBuffer =
- cm::make_unique<char[]>(buildFileStreamBufferSize);
- }
-
- // Enlarge the internal buffer of the `BuildFileStream`
- this->BuildFileStream->rdbuf()->pubsetbuf(this->BuildFileStreamBuffer.get(),
- buildFileStreamBufferSize);
-
// Write a comment about this file.
*this->BuildFileStream
<< "# This file contains all the build statements describing the\n"
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index dc4f444..defa264 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -531,7 +531,6 @@ private:
/// The file containing the build statement. (the relationship of the
/// compilation DAG).
std::unique_ptr<cmGeneratedFileStream> BuildFileStream;
- std::unique_ptr<char[]> BuildFileStreamBuffer;
/// The file containing the rule statements. (The action attached to each
/// edge of the compilation DAG).
std::unique_ptr<cmGeneratedFileStream> RulesFileStream;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index a1af268..6328d29 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2387,7 +2387,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
gtgt->GetName());
return;
}
- std::string const& langForPreprocessor = llang;
+
+ // Choose a language to use for target-wide preprocessor definitions.
+ static const char* ppLangs[] = { "CXX", "C", "OBJCXX", "OBJC" };
+ std::string langForPreprocessor;
+ if (cm::contains(ppLangs, llang)) {
+ langForPreprocessor = llang;
+ } else {
+ for (const char* l : ppLangs) {
+ if (languages.count(l)) {
+ langForPreprocessor = l;
+ break;
+ }
+ }
+ }
if (gtgt->IsIPOEnabled(llang, configName)) {
const char* ltoValue =
@@ -2404,13 +2417,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Add preprocessor definitions for this target and configuration.
BuildObjectListOrString ppDefs(this, true);
- if (languages.count("Swift")) {
- // FIXME: Xcode warns that Swift does not support definition values.
- // C/CXX sources mixed in Swift targets will not see CMAKE_INTDIR.
- } else {
- this->AppendDefines(
- ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
- }
+ this->AppendDefines(
+ ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
if (const std::string* exportMacro = gtgt->GetExportMacro()) {
// Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro->c_str());
@@ -2424,15 +2432,28 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
buildSettings->AddAttribute("GCC_PREPROCESSOR_DEFINITIONS",
ppDefs.CreateList());
if (languages.count("Swift")) {
+ // Swift uses a separate attribute for definitions.
+ std::vector<std::string> targetSwiftDefines;
+ gtgt->GetCompileDefinitions(targetSwiftDefines, configName, "Swift");
+ // Remove the '=value' parts, as Swift does not support them.
+ std::for_each(targetSwiftDefines.begin(), targetSwiftDefines.end(),
+ [](std::string& def) {
+ std::string::size_type pos = def.find('=');
+ if (pos != std::string::npos) {
+ def.erase(pos);
+ }
+ });
if (this->XcodeVersion < 80) {
std::string defineString;
- std::set<std::string> defines(targetDefines.begin(),
- targetDefines.end());
+ std::set<std::string> defines(targetSwiftDefines.begin(),
+ targetSwiftDefines.end());
this->CurrentLocalGenerator->JoinDefines(defines, defineString, "Swift");
cflags["Swift"] += " " + defineString;
} else {
+ BuildObjectListOrString swiftDefs(this, true);
+ this->AppendDefines(swiftDefs, targetSwiftDefines);
buildSettings->AddAttribute("SWIFT_ACTIVE_COMPILATION_CONDITIONS",
- ppDefs.CreateList());
+ swiftDefs.CreateList());
}
}
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index 1a3e72e..8764f21 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -300,13 +300,32 @@ bool cmVSSetupAPIHelper::IsEWDKEnabled()
return false;
}
+#if !defined(CMAKE_BOOTSTRAP)
+namespace {
+std::string FindVsWhereCommand()
+{
+ std::string vswhere;
+ static const char* programFiles[] = { "ProgramFiles(x86)", "ProgramFiles" };
+ for (const char* pf : programFiles) {
+ if (cmSystemTools::GetEnv(pf, vswhere)) {
+ vswhere += "/Microsoft Visual Studio/Installer/vswhere.exe";
+ if (cmSystemTools::FileExists(vswhere)) {
+ return vswhere;
+ }
+ }
+ }
+ vswhere = "vswhere.exe";
+ return vswhere;
+}
+}
+#endif
+
bool cmVSSetupAPIHelper::EnumerateVSInstancesWithVswhere(
std::vector<VSInstanceInfo>& VSInstances)
{
#if !defined(CMAKE_BOOTSTRAP)
// Construct vswhere command to get installed VS instances in JSON format
- std::string vswhereExe = getenv("ProgramFiles(x86)") +
- std::string(R"(\Microsoft Visual Studio\Installer\vswhere.exe)");
+ std::string vswhereExe = FindVsWhereCommand();
std::vector<std::string> vswhereCmd = { vswhereExe, "-format", "json" };
// Execute vswhere command and capture JSON output
diff --git a/Templates/MSBuild/FlagTables/v10_CSharp.json b/Templates/MSBuild/FlagTables/v10_CSharp.json
index 5341841..526bcda 100644
--- a/Templates/MSBuild/FlagTables/v10_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v10_CSharp.json
@@ -477,21 +477,21 @@
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib",
"comment": "",
"value": "true",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib-",
"comment": "",
"value": "false",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib+",
"comment": "",
"value": "true",
diff --git a/Templates/MSBuild/FlagTables/v11_CSharp.json b/Templates/MSBuild/FlagTables/v11_CSharp.json
index 5341841..526bcda 100644
--- a/Templates/MSBuild/FlagTables/v11_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v11_CSharp.json
@@ -477,21 +477,21 @@
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib",
"comment": "",
"value": "true",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib-",
"comment": "",
"value": "false",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib+",
"comment": "",
"value": "true",
diff --git a/Templates/MSBuild/FlagTables/v12_CSharp.json b/Templates/MSBuild/FlagTables/v12_CSharp.json
index 5341841..526bcda 100644
--- a/Templates/MSBuild/FlagTables/v12_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v12_CSharp.json
@@ -477,21 +477,21 @@
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib",
"comment": "",
"value": "true",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib-",
"comment": "",
"value": "false",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib+",
"comment": "",
"value": "true",
diff --git a/Templates/MSBuild/FlagTables/v140_CSharp.json b/Templates/MSBuild/FlagTables/v140_CSharp.json
index 5341841..526bcda 100644
--- a/Templates/MSBuild/FlagTables/v140_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v140_CSharp.json
@@ -477,21 +477,21 @@
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib",
"comment": "",
"value": "true",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib-",
"comment": "",
"value": "false",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib+",
"comment": "",
"value": "true",
diff --git a/Templates/MSBuild/FlagTables/v141_CSharp.json b/Templates/MSBuild/FlagTables/v141_CSharp.json
index 5341841..526bcda 100644
--- a/Templates/MSBuild/FlagTables/v141_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v141_CSharp.json
@@ -477,21 +477,21 @@
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib",
"comment": "",
"value": "true",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib-",
"comment": "",
"value": "false",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib+",
"comment": "",
"value": "true",
diff --git a/Templates/MSBuild/FlagTables/v142_CSharp.json b/Templates/MSBuild/FlagTables/v142_CSharp.json
index 9ea8f4b..d57a97e 100644
--- a/Templates/MSBuild/FlagTables/v142_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v142_CSharp.json
@@ -495,21 +495,21 @@
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib",
"comment": "",
"value": "true",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib-",
"comment": "",
"value": "false",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib+",
"comment": "",
"value": "true",
diff --git a/Templates/MSBuild/FlagTables/v143_CSharp.json b/Templates/MSBuild/FlagTables/v143_CSharp.json
index 9ea8f4b..d57a97e 100644
--- a/Templates/MSBuild/FlagTables/v143_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v143_CSharp.json
@@ -495,21 +495,21 @@
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib",
"comment": "",
"value": "true",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib-",
"comment": "",
"value": "false",
"flags": []
},
{
- "name": "NoStandardLib",
+ "name": "NoStdLib",
"switch": "nostdlib+",
"comment": "",
"value": "true",
diff --git a/Tests/RunCMake/Ninja/Intl-build-check.cmake b/Tests/RunCMake/Ninja/Intl-build-check.cmake
new file mode 100644
index 0000000..77f013c
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl-build-check.cmake
@@ -0,0 +1,5 @@
+include(${RunCMake_SOURCE_DIR}/Intl-common.cmake)
+set(output "${RunCMake_TEST_BINARY_DIR}/${intl}-output.txt")
+if(NOT EXISTS "${output}")
+ set(RunCMake_TEST_FAILED "Expected output does not exist:\n ${output}")
+endif()
diff --git a/Tests/RunCMake/Ninja/Intl-common.cmake b/Tests/RunCMake/Ninja/Intl-common.cmake
new file mode 100644
index 0000000..7703976
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl-common.cmake
@@ -0,0 +1 @@
+set(intl "intl-ë®")
diff --git a/Tests/RunCMake/Ninja/Intl.cmake b/Tests/RunCMake/Ninja/Intl.cmake
new file mode 100644
index 0000000..50e4ee4
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl.cmake
@@ -0,0 +1,7 @@
+include(Intl-common.cmake)
+set(input "${CMAKE_CURRENT_BINARY_DIR}/${intl}-input.txt")
+set(output "${CMAKE_CURRENT_BINARY_DIR}/${intl}-output.txt")
+file(WRITE "${input}" "${intl}\n")
+add_custom_command(OUTPUT "${output}"
+ COMMAND ${CMAKE_COMMAND} -E copy "${input}" "${output}")
+add_custom_target(drive ALL DEPENDS "${output}")
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 9f078e6..44a7ba1 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -33,6 +33,15 @@ function(run_NinjaToolMissing)
endfunction()
run_NinjaToolMissing()
+function(run_Intl)
+ run_cmake(Intl)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Intl-build)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(Intl-build ${CMAKE_COMMAND} --build .)
+endfunction()
+run_Intl()
+
function(run_NoWorkToDo)
run_cmake(NoWorkToDo)
set(RunCMake_TEST_NO_CLEAN 1)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index a3a3451..7245471 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -95,10 +95,11 @@ run_cmake(Inspect)
include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
# FIXME: Support more compilers and default standard levels.
-if (CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|AppleClang)$"
- AND DEFINED CMAKE_CXX_STANDARD_DEFAULT
- AND DEFINED CMAKE_CXX_EXTENSIONS_DEFAULT
- )
+if (DEFINED CMAKE_CXX_STANDARD_DEFAULT AND
+ DEFINED CMAKE_CXX_EXTENSIONS_DEFAULT AND (
+ (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.7) OR
+ (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ ))
run_cmake(CMP0128-WARN)
if(NOT CMAKE_CXX_STANDARD_DEFAULT EQUAL 11)
run_cmake(CMP0128-NEW)
diff --git a/Tests/SwiftMix/CMain.c b/Tests/SwiftMix/CMain.c
index 519058e..b274322 100644
--- a/Tests/SwiftMix/CMain.c
+++ b/Tests/SwiftMix/CMain.c
@@ -1,3 +1,16 @@
+#if !defined(FOO)
+# error "FOO not defined"
+#endif
+#if BAR != 3
+# error "FOO not defined to 3"
+#endif
+#if CCOND != 2
+# error "CCOND not defined to 2"
+#endif
+#if defined(SWIFTCOND)
+# error "SWIFTCOND defined"
+#endif
+
extern int ObjCMain(void);
int main(void)
{
diff --git a/Tests/SwiftMix/CMakeLists.txt b/Tests/SwiftMix/CMakeLists.txt
index 6d8e48b..e8b6521 100644
--- a/Tests/SwiftMix/CMakeLists.txt
+++ b/Tests/SwiftMix/CMakeLists.txt
@@ -4,3 +4,4 @@ project(SwiftMix C Swift)
add_executable(SwiftMix CMain.c ObjCMain.m SwiftMain.swift ObjC-Swift.h)
set_property(TARGET SwiftMix PROPERTY XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "ObjC-Swift.h")
target_compile_options(SwiftMix PRIVATE "$<$<COMPILE_LANGUAGE:C>:-Werror=objc-method-access>")
+target_compile_definitions(SwiftMix PRIVATE "$<IF:$<COMPILE_LANGUAGE:Swift>,SWIFTCOND,CCOND=2>" FOO BAR=3)
diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift
index d9c8cd7..238059d 100644
--- a/Tests/SwiftMix/SwiftMain.swift
+++ b/Tests/SwiftMix/SwiftMain.swift
@@ -3,6 +3,26 @@ import Foundation
@objc class SwiftMainClass : NSObject {
@objc class func SwiftMain() -> Int32 {
dump("Hello World!");
+#if FOO
+ dump("FOO defined");
+#else
+ fatalError("FOO not defined");
+#endif
+#if BAR
+ dump("BAR defined");
+#else
+ fatalError("BAR not defined");
+#endif
+#if CCOND
+ fatalError("CCOND defined");
+#else
+ dump("CCOND not defined");
+#endif
+#if SWIFTCOND
+ dump("SWIFTCOND defined");
+#else
+ fatalError("SWIFTCOND not defined");
+#endif
return 0;
}
}