summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab/os-linux.yml31
-rw-r--r--Help/command/add_custom_command.rst55
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/release/dev/vs-version-var.rst6
-rw-r--r--Help/variable/CMAKE_GENERATOR_INSTANCE.rst21
-rw-r--r--Help/variable/CMAKE_VS_VERSION_BUILD_NUMBER.rst14
-rw-r--r--Help/variable/CMAKE_VS_VERSION_BUILD_NUMBER_COMPONENTS.txt18
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CursesDialog/form/form.h3
-rw-r--r--Source/cmFindPackageCommand.cxx7
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx10
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h1
-rw-r--r--Tests/RunCMake/FindBoost/CommonNotFound.cmake4
-rw-r--r--Tests/RunCMake/GeneratorInstance/DefaultInstance-stdout.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake2
15 files changed, 130 insertions, 46 deletions
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index cf671ef..8f547cb 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -269,76 +269,65 @@
### CUDA builds
-.cuda9.2:
- image: "kitware/cmake:ci-cuda9.2-x86_64-2021-10-01"
-
+.cuda:
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
- CMAKE_ARCH: x86_64
CTEST_LABELS: "CUDA"
CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP: 1
+.cuda9.2:
+ extends: .cuda
+ image: "kitware/cmake:ci-cuda9.2-x86_64-2021-10-01"
+ variables:
+ CMAKE_ARCH: x86_64
+
.cuda9.2_nvidia:
extends: .cuda9.2
-
variables:
CMAKE_CONFIGURATION: cuda9.2_nvidia
CMAKE_GENERATOR: "Ninja Multi-Config"
.cuda10.2:
+ extends: .cuda
image: "kitware/cmake:ci-cuda10.2-x86_64-2021-06-16"
-
variables:
- GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
CMAKE_ARCH: x86_64
- CTEST_LABELS: "CUDA"
- CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP: 1
.cuda10.2_nvidia:
extends: .cuda10.2
-
variables:
CMAKE_CONFIGURATION: cuda10.2_nvidia
CTEST_NO_WARNINGS_ALLOWED: 1
.cuda10.2_clang:
extends: .cuda10.2
-
variables:
CMAKE_CONFIGURATION: cuda10.2_clang
CTEST_NO_WARNINGS_ALLOWED: 1
.cuda11.6:
+ extends: .cuda
image: "kitware/cmake:ci-cuda11.6-x86_64-2022-02-28"
-
variables:
- GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
CMAKE_ARCH: x86_64
- CTEST_LABELS: "CUDA"
- CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP: 1
.cuda11.6_nvidia:
extends: .cuda11.6
-
variables:
CMAKE_CONFIGURATION: cuda11.6_nvidia
CTEST_NO_WARNINGS_ALLOWED: 1
.cuda11.6_clang:
extends: .cuda11.6
-
variables:
CMAKE_CONFIGURATION: cuda11.6_clang
CTEST_NO_WARNINGS_ALLOWED: 1
.cuda11.8_minimal:
+ extends: .cuda
image: "kitware/cmake:ci-cuda11.8-minimal-x86_64-2022-12-06"
-
variables:
- GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
CMAKE_ARCH: x86_64
- CTEST_LABELS: "CUDA"
- CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP: 1
.cuda11.8_minimal_nvidia:
extends: .cuda11.8_minimal
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index 5878997..9dd8b95 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -31,14 +31,12 @@ This defines a command to generate specified ``OUTPUT`` file(s).
A target created in the same directory (``CMakeLists.txt`` file)
that specifies any output of the custom command as a source file
is given a rule to generate the file using the command at build time.
-Do not list the output in more than one independent target that
-may build in parallel or the two instances of the rule may conflict
-(instead use the :command:`add_custom_target` command to drive the
-command and make the other targets depend on that one).
-In makefile terms this creates a new target in the following form::
- OUTPUT: MAIN_DEPENDENCY DEPENDS
- COMMAND
+Do not list the output in more than one independent target that
+may build in parallel or the instances of the rule may conflict.
+Instead, use the :command:`add_custom_target` command to drive the
+command and make the other targets depend on that one. See the
+`Example: Generating Files for Multiple Targets`_ below.
The options are:
@@ -389,6 +387,49 @@ will re-run whenever ``in.txt`` changes.
where ``<config>`` is the build configuration, and then compile the generated
source as part of a library.
+Example: Generating Files for Multiple Targets
+""""""""""""""""""""""""""""""""""""""""""""""
+
+If multiple independent targets need the same custom command output,
+it must be attached to a single custom target on which they all depend.
+Consider the following example:
+
+.. code-block:: cmake
+
+ add_custom_command(
+ OUTPUT table.csv
+ COMMAND makeTable -i ${CMAKE_CURRENT_SOURCE_DIR}/input.dat
+ -o table.csv
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/input.dat
+ VERBATIM)
+ add_custom_target(generate_table_csv DEPENDS table.csv)
+
+ add_custom_command(
+ OUTPUT foo.cxx
+ COMMAND genFromTable -i table.csv -case foo -o foo.cxx
+ DEPENDS table.csv # file-level dependency
+ generate_table_csv # target-level dependency
+ VERBATIM)
+ add_library(foo foo.cxx)
+
+ add_custom_command(
+ OUTPUT bar.cxx
+ COMMAND genFromTable -i table.csv -case bar -o bar.cxx
+ DEPENDS table.csv # file-level dependency
+ generate_table_csv # target-level dependency
+ VERBATIM)
+ add_library(bar bar.cxx)
+
+Output ``foo.cxx`` is needed only by target ``foo`` and output ``bar.cxx``
+is needed only by target ``bar``, but *both* targets need ``table.csv``,
+transitively. Since ``foo`` and ``bar`` are independent targets that may
+build concurrently, we prevent them from racing to generate ``table.csv``
+by placing its custom command in a separate target, ``generate_table_csv``.
+The custom commands generating ``foo.cxx`` and ``bar.cxx`` each specify a
+target-level dependency on ``generate_table_csv``, so the targets using them,
+``foo`` and ``bar``, will not build until after target ``generate_table_csv``
+is built.
+
.. _`add_custom_command(TARGET)`:
Build Events
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 2a1e017..23d8256 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -131,6 +131,7 @@ Variables that Provide Information
/variable/CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER
/variable/CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION
/variable/CMAKE_VS_TARGET_FRAMEWORK_VERSION
+ /variable/CMAKE_VS_VERSION_BUILD_NUMBER
/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION
/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM
/variable/CMAKE_XCODE_BUILD_SYSTEM
diff --git a/Help/release/dev/vs-version-var.rst b/Help/release/dev/vs-version-var.rst
new file mode 100644
index 0000000..09daab7
--- /dev/null
+++ b/Help/release/dev/vs-version-var.rst
@@ -0,0 +1,6 @@
+vs-version-var
+--------------
+
+* A :variable:`CMAKE_VS_VERSION_BUILD_NUMBER` variable is now set by
+ :ref:`Visual Studio Generators` for VS 2017 and above to report the
+ four-component Visual Studio version number.
diff --git a/Help/variable/CMAKE_GENERATOR_INSTANCE.rst b/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
index 6bfabe0..4317622 100644
--- a/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
+++ b/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
@@ -43,24 +43,8 @@ Supported pairs are:
.. versionadded:: 3.23
Specify the 4-component VS Build Version, a.k.a. Build Number.
- The components are:
- ``<major>.<minor>``
-
- The VS major and minor version numbers.
- These are the same as the release version numbers.
-
- ``<date>``
-
- A build date in the format ``MMMDD``, where ``MMM`` is a month index
- since an epoch used by Microsoft, and ``DD`` is a day in that month.
-
- ``<build>``
-
- A build index on the day represented by ``<date>``.
-
- The build number is reported by ``vswhere`` as ``installationVersion``.
- For example, VS 16.11.10 has build number ``16.11.32126.315``.
+ .. include:: CMAKE_VS_VERSION_BUILD_NUMBER_COMPONENTS.txt
.. versionadded:: 3.23
@@ -75,3 +59,6 @@ to hold the value persistently. If an environment variable of the form
is set and points to the ``Common7/Tools`` directory within one of the
VS instances, that instance will be used. Otherwise, if more than one
VS instance is installed we do not define which one is chosen by default.
+
+The VS version build number of the selected VS instance is provided in
+the :variable:`CMAKE_VS_VERSION_BUILD_NUMBER` variable.
diff --git a/Help/variable/CMAKE_VS_VERSION_BUILD_NUMBER.rst b/Help/variable/CMAKE_VS_VERSION_BUILD_NUMBER.rst
new file mode 100644
index 0000000..f86ed7c
--- /dev/null
+++ b/Help/variable/CMAKE_VS_VERSION_BUILD_NUMBER.rst
@@ -0,0 +1,14 @@
+CMAKE_VS_VERSION_BUILD_NUMBER
+-----------------------------
+
+.. versionadded:: 3.26
+
+Visual Studio version.
+
+:ref:`Visual Studio Generators` for VS 2017 and above set this
+variable to the Visual Studio version build number in the format
+``<major>.<minor>.<date>.<build>``.
+
+.. include:: CMAKE_VS_VERSION_BUILD_NUMBER_COMPONENTS.txt
+
+See also the :variable:`CMAKE_GENERATOR_INSTANCE` variable.
diff --git a/Help/variable/CMAKE_VS_VERSION_BUILD_NUMBER_COMPONENTS.txt b/Help/variable/CMAKE_VS_VERSION_BUILD_NUMBER_COMPONENTS.txt
new file mode 100644
index 0000000..6bdede7
--- /dev/null
+++ b/Help/variable/CMAKE_VS_VERSION_BUILD_NUMBER_COMPONENTS.txt
@@ -0,0 +1,18 @@
+The components are:
+
+``<major>.<minor>``
+
+ The VS major and minor version numbers.
+ These are the same as the release version numbers.
+
+``<date>``
+
+ A build date in the format ``MMMDD``, where ``MMM`` is a month index
+ since an epoch used by Microsoft, and ``DD`` is a day in that month.
+
+``<build>``
+
+ A build index on the day represented by ``<date>``.
+
+The build number is reported by ``vswhere`` as ``installationVersion``.
+For example, VS 16.11.10 has build number ``16.11.32126.315``.
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index f74a79f..a980320 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 25)
-set(CMake_VERSION_PATCH 20221207)
+set(CMake_VERSION_PATCH 20221209)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CursesDialog/form/form.h b/Source/CursesDialog/form/form.h
index 39ed75a..b590c97 100644
--- a/Source/CursesDialog/form/form.h
+++ b/Source/CursesDialog/form/form.h
@@ -54,6 +54,9 @@
# if defined(__hpux) && !defined(HAVE__XOPEN_SOURCE_EXTENDED)
# undef _XOPEN_SOURCE_EXTENDED
# endif
+ /* Some curses/term headers define lower-case macros that
+ conflict with our source code. Undefine them. */
+# undef newline
# endif
#include <eti.h>
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 60b0a7b..71c7e13 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -379,6 +379,8 @@ private:
# pragma diag_suppress 3288 // parameter was declared but never referenced
# define CM_LCC_DIAG_SUPPRESS_3301
# pragma diag_suppress 3301 // parameter was declared but never referenced
+# define CM_LCC_DIAG_SUPPRESS_3308
+# pragma diag_suppress 3308 // parameter was declared but never referenced
#endif
void ResetGenerator()
@@ -423,6 +425,11 @@ bool TryGeneratedPaths(CallbackFn&& filesCollector,
return false;
}
+#ifdef CM_LCC_DIAG_SUPPRESS_3308
+# undef CM_LCC_DIAG_SUPPRESS_3308
+# pragma diag_default 3308
+#endif
+
#ifdef CM_LCC_DIAG_SUPPRESS_3301
# undef CM_LCC_DIAG_SUPPRESS_3301
# pragma diag_default 3301
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 59f1dc2..415eb7c 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -521,6 +521,7 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
{
if (this->LastGeneratorInstanceString &&
i == *(this->LastGeneratorInstanceString)) {
+ this->SetVSVersionVar(mf);
return true;
}
@@ -592,6 +593,8 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
cmStateEnums::INTERNAL);
}
+ this->SetVSVersionVar(mf);
+
// The selected instance may have a different MSBuild than previously found.
this->MSBuildCommandInitialized = false;
@@ -672,6 +675,13 @@ bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance(
return true;
}
+void cmGlobalVisualStudioVersionedGenerator::SetVSVersionVar(cmMakefile* mf)
+{
+ if (cm::optional<std::string> vsVer = this->GetVSInstanceVersion()) {
+ mf->AddDefinition("CMAKE_VS_VERSION_BUILD_NUMBER", *vsVer);
+ }
+}
+
bool cmGlobalVisualStudioVersionedGenerator::ProcessGeneratorInstanceField(
std::string const& key, std::string const& value)
{
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index 4c69aeb..45aca74 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -93,6 +93,7 @@ private:
mutable cmVSSetupAPIHelper vsSetupAPIHelper;
bool ParseGeneratorInstance(std::string const& is, cmMakefile* mf);
+ void SetVSVersionVar(cmMakefile* mf);
std::string GeneratorInstance;
std::string GeneratorInstanceVersion;
diff --git a/Tests/RunCMake/FindBoost/CommonNotFound.cmake b/Tests/RunCMake/FindBoost/CommonNotFound.cmake
index 864a549..b146d3d 100644
--- a/Tests/RunCMake/FindBoost/CommonNotFound.cmake
+++ b/Tests/RunCMake/FindBoost/CommonNotFound.cmake
@@ -1,2 +1,6 @@
+set(CMAKE_FIND_USE_CMAKE_PATH OFF)
+set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF)
+set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH OFF)
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
# Make sure to use the module mode signature here to not bypass FindBoost
find_package(Boost 1.80 COMPONENTS timer foobar)
diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance-stdout.txt b/Tests/RunCMake/GeneratorInstance/DefaultInstance-stdout.txt
new file mode 100644
index 0000000..078d96e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_VS_VERSION_BUILD_NUMBER='[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
index 9761f0c..5c5ec56 100644
--- a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
+++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
@@ -12,3 +12,5 @@ elseif(NOT IS_DIRECTORY "${CMAKE_GENERATOR_INSTANCE}")
"which is not an existing directory.")
endif()
file(WRITE "${CMAKE_BINARY_DIR}/instance.txt" "${CMAKE_GENERATOR_INSTANCE}")
+
+message(STATUS "CMAKE_VS_VERSION_BUILD_NUMBER='${CMAKE_VS_VERSION_BUILD_NUMBER}'")