diff options
-rw-r--r-- | Help/command/string.rst | 2 | ||||
-rw-r--r-- | Help/variable/CMAKE_CACHEFILE_DIR.rst | 7 | ||||
-rw-r--r-- | Modules/CMakeDependentOption.cmake | 19 | ||||
-rw-r--r-- | Modules/GNUInstallDirs.cmake | 6 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 34 | ||||
-rw-r--r-- | Tests/CudaOnly/WithDefs/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt | 4 |
9 files changed, 44 insertions, 36 deletions
diff --git a/Help/command/string.rst b/Help/command/string.rst index 9b707eb..b1ca2cb 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -612,7 +612,7 @@ Requires an element of object type. .. code-block:: cmake string(JSON <out-var> [ERROR_VARIABLE <error-variable>] - LENGTH <json-string> <member|index> [<member|index> ...]) + LENGTH <json-string> [<member|index> ...]) Get the length of an element in ``<json-string>`` at the location given by the list of ``<member|index>`` arguments. diff --git a/Help/variable/CMAKE_CACHEFILE_DIR.rst b/Help/variable/CMAKE_CACHEFILE_DIR.rst index 8604d0e..3fee09f 100644 --- a/Help/variable/CMAKE_CACHEFILE_DIR.rst +++ b/Help/variable/CMAKE_CACHEFILE_DIR.rst @@ -1,7 +1,6 @@ CMAKE_CACHEFILE_DIR ------------------- -The directory with the ``CMakeCache.txt`` file. - -This is the full path to the directory that has the ``CMakeCache.txt`` -file in it. This is the same as :variable:`CMAKE_BINARY_DIR`. +This variable is used internally by CMake, and may not be set during +the first configuration of a build tree. When it is set, it has the +same value as :variable:`CMAKE_BINARY_DIR`. Use that variable instead. diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake index b7c478f..ac0e262 100644 --- a/Modules/CMakeDependentOption.cmake +++ b/Modules/CMakeDependentOption.cmake @@ -16,13 +16,18 @@ conditions are true. cmake_dependent_option(<option> "<help_text>" <value> <depends> <force>) - Makes ``<option>`` available to the user if ``<depends>`` is true. When - ``<option>`` is available, the given ``<help_text>`` and initial ``<value>`` - are used. If the ``<depends>`` condition is not true, ``<option>`` will not be - presented and will always have the value given by ``<force>``. Any value set by - the user is preserved for when the option is presented again. In case ``<depends>`` - is a :ref:`semicolon-separated list <CMake Language Lists>`, all elements must - be true in order to initialize ``<option>`` with ``<value>``. + Makes ``<option>`` available to the user if the + :ref:`semicolon-separated list <CMake Language Lists>` of conditions in + ``<depends>`` are all true. Otherwise, a local variable named ``<option>`` + is set to ``<force>``. + + When ``<option>`` is available, the given ``<help_text>`` and initial + ``<value>`` are used. Otherwise, any value set by the user is preserved for + when ``<depends>`` is satisfied in the future. + + Note that the ``<option>`` variable only has a value which satisfies the + ``<depends>`` condition within the scope of the caller because it is a local + variable. Example invocation: diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 4e7f87b..bd72901 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -55,7 +55,7 @@ where ``<dir>`` is one of: object code libraries (``lib`` or ``lib64``) On Debian, this may be ``lib/<multiarch-tuple>`` when - :variable:`CMAKE_INSTALL_PREFIX` is ``/``, ``/usr``, or ``/usr/local``. + :variable:`CMAKE_INSTALL_PREFIX` is ``/usr``. ``INCLUDEDIR`` C header files (``include``) ``OLDINCLUDEDIR`` @@ -273,9 +273,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set if(__system_type_for_install STREQUAL "debian") if(CMAKE_LIBRARY_ARCHITECTURE) - if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/" - OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$" - OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$") + if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") endif() if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1ea4df3..0fdb51c 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 23) -set(CMake_VERSION_PATCH 20220330) +set(CMake_VERSION_PATCH 20220331) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index dd7d244..e61b4b6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1678,28 +1678,32 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( compileObjectVars.Includes = includes.c_str(); // Rule for compiling object file. - std::vector<std::string> compileCmds; + std::string cudaCompileMode; if (language == "CUDA") { - std::string cmdVar; if (this->GeneratorTarget->GetPropertyAsBool( "CUDA_SEPARABLE_COMPILATION")) { - cmdVar = "CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION"; - } else if (this->GeneratorTarget->GetPropertyAsBool( - "CUDA_PTX_COMPILATION")) { - cmdVar = "CMAKE_CUDA_COMPILE_PTX_COMPILATION"; + const std::string& rdcFlag = + this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_RDC_FLAG"); + cudaCompileMode = cmStrCat(cudaCompileMode, rdcFlag, " "); + } + if (this->GeneratorTarget->GetPropertyAsBool("CUDA_PTX_COMPILATION")) { + const std::string& ptxFlag = + this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_PTX_FLAG"); + cudaCompileMode = cmStrCat(cudaCompileMode, ptxFlag); } else { - cmdVar = "CMAKE_CUDA_COMPILE_WHOLE_COMPILATION"; + const std::string& wholeFlag = + this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_WHOLE_FLAG"); + cudaCompileMode = cmStrCat(cudaCompileMode, wholeFlag); } - const std::string& compileCmd = - this->GetMakefile()->GetRequiredDefinition(cmdVar); - cmExpandList(compileCmd, compileCmds); - } else { - const std::string cmdVar = cmStrCat("CMAKE_", language, "_COMPILE_OBJECT"); - const std::string& compileCmd = - this->GetMakefile()->GetRequiredDefinition(cmdVar); - cmExpandList(compileCmd, compileCmds); + compileObjectVars.CudaCompileMode = cudaCompileMode.c_str(); } + std::vector<std::string> compileCmds; + const std::string cmdVar = cmStrCat("CMAKE_", language, "_COMPILE_OBJECT"); + const std::string& compileCmd = + this->Makefile->GetRequiredDefinition(cmdVar); + cmExpandList(compileCmd, compileCmds); + std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( this->GetLocalGenerator()->CreateRulePlaceholderExpander()); diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index 02f043f..39bcd91 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.18) project(WithDefs CUDA) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + set(release_compile_defs DEFREL) #Goal for this example: diff --git a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt index 2019459..25f80d3 100644 --- a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt @@ -4,7 +4,7 @@ CMAKE_INSTALL_DATAROOTDIR='usr/share' CMAKE_INSTALL_DOCDIR='usr/share/doc/Root' CMAKE_INSTALL_INCLUDEDIR='usr/include' CMAKE_INSTALL_INFODIR='usr/share/info' -CMAKE_INSTALL_LIBDIR='usr/lib/arch' +CMAKE_INSTALL_LIBDIR='usr/lib' CMAKE_INSTALL_LIBEXECDIR='usr/libexec' CMAKE_INSTALL_LOCALEDIR='usr/share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' @@ -19,7 +19,7 @@ CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root' CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' -CMAKE_INSTALL_FULL_LIBDIR='/usr/lib/arch' +CMAKE_INSTALL_FULL_LIBDIR='/usr/lib' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt index 0830138..30795c8 100644 --- a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt @@ -4,7 +4,7 @@ CMAKE_INSTALL_DATAROOTDIR='share' CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal' CMAKE_INSTALL_INCLUDEDIR='include' CMAKE_INSTALL_INFODIR='share/info' -CMAKE_INSTALL_LIBDIR='lib/arch' +CMAKE_INSTALL_LIBDIR='lib' CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' @@ -19,7 +19,7 @@ CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share' CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal' CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include' CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info' -CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib/arch' +CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' |