diff options
26 files changed, 393 insertions, 275 deletions
diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst index f47615a..c84c5b5 100644 --- a/Help/command/cmake_host_system_information.rst +++ b/Help/command/cmake_host_system_information.rst @@ -261,6 +261,8 @@ Example: .. _man 5 os-release: https://www.freedesktop.org/software/systemd/man/os-release.html .. _various distribution-specific files: http://linuxmafia.com/faq/Admin/release-files.html +.. _Query Windows registry: + Query Windows registry ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst index 4bdd388..4bfe087 100644 --- a/Help/command/get_filename_component.rst +++ b/Help/command/get_filename_component.rst @@ -4,10 +4,16 @@ get_filename_component Get a specific component of a full filename. .. versionchanged:: 3.20 - This command been superseded by :command:`cmake_path` command, except - ``REALPATH`` now offered by :ref:`file(REAL_PATH) <REAL_PATH>` command and + This command has been superseded by :command:`cmake_path` command, except + ``REALPATH`` now offered by :ref:`file(REAL_PATH)<REAL_PATH>` command and ``PROGRAM`` now available in :command:`separate_arguments(PROGRAM)` command. +.. versionchanged:: 3.24 + The undocumented feature offering the capability to query the ``Windows`` + registry is superseded by + :ref:`cmake_host_system_information(QUERY WINDOWS_REGISTRY)<Query Windows registry>` + command. + .. code-block:: cmake get_filename_component(<var> <FileName> <mode> [CACHE]) diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index ea07482..853d655 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -52,6 +52,7 @@ if(CMAKE_CUDA_ABI_COMPILED) set(CMAKE_CUDA_ARCHITECTURES_NATIVE "${_CUDA_ARCHS_OUTPUT}") endif() list(REMOVE_DUPLICATES CMAKE_CUDA_ARCHITECTURES_NATIVE) + list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_NATIVE APPEND "-real") else() if(NOT _CUDA_ARCHS_RESULT MATCHES "[0-9]+") set(_CUDA_ARCHS_STATUS " (${_CUDA_ARCHS_RESULT})") diff --git a/Modules/CUDA/architectures.cmake b/Modules/CUDA/architectures.cmake index fa3a5a1..79c1252 100644 --- a/Modules/CUDA/architectures.cmake +++ b/Modules/CUDA/architectures.cmake @@ -44,3 +44,14 @@ if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.4 AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")) list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 87) endif() + +# only generate jit code for the newest arch for all/all-major +list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL _latest_arch) +list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL APPEND "-real") +list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL ${_latest_arch}) + +list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR _latest_arch) +list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR APPEND "-real") +list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR ${_latest_arch}) + +unset(_latest_arch) diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 8391f16..6edfbea 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -674,7 +674,7 @@ endfunction() function (_PYTHON_GET_LAUNCHER _PYTHON_PGL_NAME) cmake_parse_arguments (PARSE_ARGV 1 _PGL "INTERPRETER;COMPILER" "" "") - unset ({_PYTHON_PGL_NAME} PARENT_SCOPE) + unset (${_PYTHON_PGL_NAME} PARENT_SCOPE) if ((_PGL_INTERPRETER AND NOT _${_PYTHON_PREFIX}_EXECUTABLE) OR (_PGL_COMPILER AND NOT _${_PYTHON_PREFIX}_COMPILER)) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index c1531a4..a2304c2 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -156,41 +156,27 @@ macro(_threads_check_flag_pthread) endif() endmacro() -# Do we have pthreads? -if(CMAKE_C_COMPILER_LOADED) - CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H) -else() - CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H) +# Check if pthread functions are in normal C library. +# We list some pthread functions in PTHREAD_C_CXX_TEST_SOURCE test code. +# If the pthread functions already exist in C library, we could just use +# them instead of linking to the additional pthread library. +_threads_check_libc() + +# Check for -pthread first if enabled. This is the recommended +# way, but not backwards compatible as one must also pass -pthread +# as compiler flag then. +if (THREADS_PREFER_PTHREAD_FLAG) + _threads_check_flag_pthread() +endif () + +if(CMAKE_SYSTEM MATCHES "GHS-MULTI") + _threads_check_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE) endif() +_threads_check_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) +_threads_check_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) -if(CMAKE_HAVE_PTHREAD_H) - # - # We have pthread.h - # Let's check for the library now. - # - - # Check if pthread functions are in normal C library. - # We list some pthread functions in PTHREAD_C_CXX_TEST_SOURCE test code. - # If the pthread functions already exist in C library, we could just use - # them instead of linking to the additional pthread library. - _threads_check_libc() - - # Check for -pthread first if enabled. This is the recommended - # way, but not backwards compatible as one must also pass -pthread - # as compiler flag then. - if (THREADS_PREFER_PTHREAD_FLAG) - _threads_check_flag_pthread() - endif () - - if(CMAKE_SYSTEM MATCHES "GHS-MULTI") - _threads_check_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE) - endif() - _threads_check_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) - _threads_check_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) - - if (NOT THREADS_PREFER_PTHREAD_FLAG) - _threads_check_flag_pthread() - endif() +if (NOT THREADS_PREFER_PTHREAD_FLAG) + _threads_check_flag_pthread() endif() if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_PTHREAD) diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in index 23c45c7..42a44d9 100644 --- a/Modules/Internal/CPack/NSIS.template.in +++ b/Modules/Internal/CPack/NSIS.template.in @@ -48,7 +48,7 @@ ;--- Component support macros: --- ; The code for the add/remove functionality is from: -; http://nsis.sourceforge.net/Add/Remove_Functionality +; https://nsis.sourceforge.io/Add/Remove_Functionality ; It has been modified slightly and extended to provide ; inter-component dependencies. Var AR_SecFlags @@ -383,7 +383,7 @@ Function un.RemoveFromPath FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Uninstall sutff +; Uninstall stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ########################################### @@ -487,15 +487,15 @@ Done: Exch $R1 FunctionEnd -Function ConditionalAddToRegisty +Function ConditionalAddToRegistry Pop $0 Pop $1 - StrCmp "$0" "" ConditionalAddToRegisty_EmptyString + StrCmp "$0" "" ConditionalAddToRegistry_EmptyString WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ "$1" "$0" ;MessageBox MB_OK "Set Registry: '$1' to '$0'" DetailPrint "Set install registry entry: '$1' to '$0'" - ConditionalAddToRegisty_EmptyString: + ConditionalAddToRegistry_EmptyString: FunctionEnd ;-------------------------------- @@ -665,44 +665,44 @@ Section "-Core installation" WriteUninstaller "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe" Push "DisplayName" Push "@CPACK_NSIS_DISPLAY_NAME@" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "DisplayVersion" Push "@CPACK_PACKAGE_VERSION@" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "Publisher" Push "@CPACK_PACKAGE_VENDOR@" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "UninstallString" Push "$\"$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe$\"" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "NoRepair" Push "1" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry !ifdef CPACK_NSIS_ADD_REMOVE ;Create add/remove functionality Push "ModifyPath" Push "$INSTDIR\AddRemove.exe" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry !else Push "NoModify" Push "1" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry !endif ; Optional registration Push "DisplayIcon" Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "HelpLink" Push "@CPACK_NSIS_HELP_LINK@" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "URLInfoAbout" Push "@CPACK_NSIS_URL_INFO_ABOUT@" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "Contact" Push "@CPACK_NSIS_CONTACT@" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application @@ -720,19 +720,19 @@ Section "-Core installation" ; Write special uninstall registry entries Push "StartMenu" Push "$STARTMENU_FOLDER" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "DoNotAddToPath" Push "$DO_NOT_ADD_TO_PATH" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "AddToPathAllUsers" Push "$ADD_TO_PATH_ALL_USERS" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "AddToPathCurrentUser" Push "$ADD_TO_PATH_CURRENT_USER" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry Push "InstallToDesktop" Push "$INSTALL_DESKTOP" - Call ConditionalAddToRegisty + Call ConditionalAddToRegistry !insertmacro MUI_STARTMENU_WRITE_END @@ -880,7 +880,7 @@ Section "Uninstall" StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop startMenuDeleteLoopDone: - ; If the user changed the shortcut, then untinstall may not work. This should + ; If the user changed the shortcut, then uninstall may not work. This should ; try to fix it. StrCpy $MUI_TEMP "$START_MENU" Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 74ebee0..121322c 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 20220503) +set(CMake_VERSION_PATCH 20220505) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 129ef4b..b172c20 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCommonTargetGenerator.h" -#include <set> +#include <algorithm> #include <sstream> #include <utility> @@ -13,9 +13,11 @@ #include "cmLocalCommonGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmRange.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmTarget.h" @@ -321,3 +323,29 @@ std::string cmCommonTargetGenerator::GetLinkerLauncher( } return std::string(); } + +bool cmCommonTargetGenerator::HaveRequiredLanguages( + const std::vector<cmSourceFile const*>& sources, + std::set<std::string>& languagesNeeded) const +{ + for (cmSourceFile const* sf : sources) { + languagesNeeded.insert(sf->GetLanguage()); + } + + auto* makefile = this->Makefile; + auto* state = makefile->GetState(); + auto unary = [&state, &makefile](const std::string& lang) -> bool { + const bool valid = state->GetLanguageEnabled(lang); + if (!valid) { + makefile->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("The language ", lang, + " was requested for compilation but was not enabled." + " To enable a language it needs to be specified in a" + " 'project' or 'enable_language' command in the root" + " CMakeLists.txt")); + } + return valid; + }; + return std::all_of(languagesNeeded.cbegin(), languagesNeeded.cend(), unary); +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 5aba1c6..1b804b4 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -5,6 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include <map> +#include <set> #include <string> #include <vector> @@ -74,6 +75,9 @@ protected: std::string GetLinkerLauncher(const std::string& config); + bool HaveRequiredLanguages(const std::vector<cmSourceFile const*>& sources, + std::set<std::string>& languagesNeeded) const; + private: using ByLanguageMap = std::map<std::string, std::string>; struct ByConfig diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 1c92c7f..aec6577 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -305,9 +305,14 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() std::vector<cmSourceFile const*> objectSources; this->GeneratorTarget->GetObjectSources(objectSources, this->GetConfigName()); - for (cmSourceFile const* sf : objectSources) { - // Generate this object file's rule file. - this->WriteObjectRuleFiles(*sf); + + // validate that all languages requested are enabled. + std::set<std::string> requiredLangs; + if (this->HaveRequiredLanguages(objectSources, requiredLangs)) { + for (cmSourceFile const* sf : objectSources) { + // Generate this object file's rule file. + this->WriteObjectRuleFiles(*sf); + } } } @@ -532,8 +537,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( cmSourceFile const& source) { // Identify the language of the source file. - const std::string& lang = - this->LocalGenerator->GetSourceFileLanguage(source); + const std::string& lang = source.GetLanguage(); if (lang.empty()) { // don't know anything about this file so skip it return; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 1c5bac8..4f6da0e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -126,15 +126,11 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules( std::set<std::string> languages; std::vector<cmSourceFile const*> sourceFiles; this->GetGeneratorTarget()->GetObjectSources(sourceFiles, config); - for (cmSourceFile const* sf : sourceFiles) { - std::string const lang = sf->GetLanguage(); - if (!lang.empty()) { - languages.insert(lang); + if (this->HaveRequiredLanguages(sourceFiles, languages)) { + for (std::string const& language : languages) { + this->WriteLanguageRules(language, config); } } - for (std::string const& language : languages) { - this->WriteLanguageRules(language, config); - } } const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index cf0cb17..1739b5a 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3832,63 +3832,15 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions( return false; } - // Would like to use: - // cmLinkLineDeviceComputer computer(this->LocalGenerator, - // this->LocalGenerator->GetStateSnapshot().GetDirectory()); - // std::string computed_libs = computer.ComputeLinkLibraries(cli, - // std::string{}); but it outputs in "<libA> <libB>" format instead of - // "<libA>;<libB>" - // Note: - // Any modification of this algorithm should be reflected also in - // cmLinkLineDeviceComputer cmComputeLinkInformation& cli = *pcli; + cmLinkLineDeviceComputer computer( + this->LocalGenerator, + this->LocalGenerator->GetStateSnapshot().GetDirectory()); + std::vector<BT<std::string>> btLibVec; + computer.ComputeLinkLibraries(cli, std::string{}, btLibVec); std::vector<std::string> libVec; - const auto& libs = cli.GetItems(); - for (cmComputeLinkInformation::Item const& l : libs) { - - if (l.Target) { - auto managedType = l.Target->GetManagedType(configName); - // Do not allow C# targets to be added to the LIB listing. LIB files - // are used for linking C++ dependencies. C# libraries do not have lib - // files. Instead, they compile down to C# reference libraries (DLL - // files). The - // `<ProjectReference>` elements added to the vcxproj are enough for - // the IDE to deduce the DLL file required by other C# projects that - // need its reference library. - if (managedType == cmGeneratorTarget::ManagedType::Managed) { - continue; - } - const auto type = l.Target->GetType(); - - bool skip = false; - switch (type) { - case cmStateEnums::SHARED_LIBRARY: - case cmStateEnums::MODULE_LIBRARY: - case cmStateEnums::INTERFACE_LIBRARY: - skip = true; - break; - case cmStateEnums::STATIC_LIBRARY: - skip = l.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS"); - break; - default: - break; - } - if (skip) { - continue; - } - } - - if (l.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) { - std::string path = - this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value); - ConvertToWindowsSlash(path); - if (!cmVS10IsTargetsFile(l.Value.Value)) { - libVec.push_back(l.HasFeature() ? l.GetFormattedItem(path).Value - : path); - } - } else { - libVec.push_back(l.Value.Value); - } + for (auto const& item : btLibVec) { + libVec.emplace_back(item.Value); } cudaLinkOptions.AddFlag("AdditionalDependencies", libVec); diff --git a/Tests/CudaOnly/ArchSpecial/CMakeLists.txt b/Tests/CudaOnly/ArchSpecial/CMakeLists.txt index 46f4ada..88eff8a 100644 --- a/Tests/CudaOnly/ArchSpecial/CMakeLists.txt +++ b/Tests/CudaOnly/ArchSpecial/CMakeLists.txt @@ -10,6 +10,7 @@ function(verify_output flag) string(REPLACE "-" "_" architectures "${flag}") string(TOUPPER "${architectures}" architectures) set(architectures "${CMAKE_CUDA_ARCHITECTURES_${architectures}}") + list(TRANSFORM architectures REPLACE "-real" "") if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") set(match_regex "-target-cpu sm_([0-9]+)") diff --git a/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt index ee0a5f7..4153699 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt @@ -1,4 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='all-major' --- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='([0-9]+-real;)*[0-9]+-real' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt index fd738e4..32c61de0 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt @@ -1,4 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='all' --- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='([0-9]+-real;)*[0-9]+-real' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt index af49e00..7f6f19e 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt @@ -1,4 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='native' --- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='([0-9]+-real;)*[0-9]+-real' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stdout.txt index 22ed7f6..90b3552 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stdout.txt @@ -1,4 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='[0-9]+-real;[0-9]+-virtual;' --- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='([0-9]+-real;)*[0-9]+-real' diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake b/Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake index 9f9fb14..97a4ecc 100644 --- a/Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake +++ b/Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake @@ -1,12 +1,4 @@ -# check Windows architecture -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status) -if (status STREQUAL "") - set(HOST_64BIT TRUE) -else() - set(HOST_64BIT FALSE) -endif() - # helper function for test validation function(CHECK key result status expression) if(status STREQUAL "") @@ -25,33 +17,51 @@ set(KEY "HKCU/Software/Classes/CLSID/CMake-Tests/chsi-registry") cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" ERROR_VARIABLE status) check("${KEY}" "${result}" "${status}" - "(HOST_64BIT AND result STREQUAL \"default 64bit\") - OR (NOT HOST_64BIT AND result STREQUAL \"default 32bit\")") + "result STREQUAL \"default ${ARCH}\"") # query value using special name should be identical to default value cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE "(default)" ERROR_VARIABLE status) check("${KEY}{(default)}" "${result2}" "${status}" "result2 STREQUAL result") cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW HOST ERROR_VARIABLE status) check("${KEY}" "${result}" "${status}" - "(HOST_64BIT AND result STREQUAL \"default 64bit\") - OR (NOT HOST_64BIT AND result STREQUAL \"default 32bit\")") + "result STREQUAL \"default ${ARCH}\"") # VIEW TARGET should have same value as VIEW HOST cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VIEW TARGET ERROR_VARIABLE status) check("${KEY}" "${result2}" "${status}" "result2 STREQUAL result") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64 ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"") +if (ARCH STREQUAL "64bit") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64 ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32 ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") + + # reg 64bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64_32 ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32 ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") + # reg 32bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32_64 ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") -# reg 64bit is read first -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64_32 ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"") +else() #32bit -# reg 32bit is read first -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32_64 ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64 ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"\"") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32 ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") + + # reg 64bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64_32 ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") + + # reg 32bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32_64 ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") + +endif() # HKCU/Software/CMake-Tests/chsi-registry: Query named value @@ -60,37 +70,58 @@ set(KEY "HKCU/Software/Classes/CLSID/CMake-Tests/chsi-registry") cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE ERROR_VARIABLE status) check("${KEY}{BYTE_SIZE}" "${result}" "${status}" - "(HOST_64BIT AND result STREQUAL \"64bit\") - OR (NOT HOST_64BIT AND result STREQUAL \"32bit\")") + "result STREQUAL \"${ARCH}\"") cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE VIEW HOST ERROR_VARIABLE status) check("${KEY}{BYTE_SIZE}" "${result}" "${status}" - "(HOST_64BIT AND result STREQUAL \"64bit\") - OR (NOT HOST_64BIT AND result STREQUAL \"32bit\")") + "result STREQUAL \"${ARCH}\"") # VIEW TARGET should have same value as VIEW HOST cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE VIEW TARGET ERROR_VARIABLE status) check("${KEY}{BYTE_SIZE}" "${result2}" "${status}" "result2 STREQUAL result") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE - VIEW 64 ERROR_VARIABLE status) -check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"64bit\"") +if (ARCH STREQUAL "64bit") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE - VIEW 32 ERROR_VARIABLE status) -check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW 64 ERROR_VARIABLE status) + check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"64bit\"") -# reg 64bit is read first -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE - VIEW 64_32 ERROR_VARIABLE status) -check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"64bit\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW 32 ERROR_VARIABLE status) + check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"") -# reg 32bit is read first -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE - VIEW 32_64 ERROR_VARIABLE status) -check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"") + # reg 64bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW 64_32 ERROR_VARIABLE status) + check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"64bit\"") + + # reg 32bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW 32_64 ERROR_VARIABLE status) + check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"") + +else() # 32bit + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW 64 ERROR_VARIABLE status) + check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW 32 ERROR_VARIABLE status) + check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"") + + # reg 64bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW 64_32 ERROR_VARIABLE status) + check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"") + + # reg 32bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW 32_64 ERROR_VARIABLE status) + check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"") + +endif() # HKCU/Software/CMake-Tests/chsi-registry: check retrieval of various types cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE VALUE_SZ ERROR_VARIABLE status) @@ -114,119 +145,192 @@ check("${KEY}{VALUE_QWORD}" "${result}" "${status}" "result EQUAL \"513\"") # HKCU/Software/CMake-Tests/chsi-registry: check retrieval of value names -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - ERROR_VARIABLE status) -check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") -# VIEW BOTH should have same result as default view -cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW BOTH ERROR_VARIABLE status) -check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") +if (ARCH STREQUAL "64bit") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + # VIEW BOTH should have same result as default view + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW BOTH ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW HOST ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" + "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + # VIEW TARGET should have same result as VIEW HOST + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW 64 ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" + "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW 32 ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\"") + + # reg 64bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW 64_32 ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" + "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + + # reg 32bit is read first. Result is the same as with view 64_32 + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW 32_64 ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW HOST ERROR_VARIABLE status) -check("${KEY}[VALUE_NAMES]" "${result}" "${status}" - "(HOST_64BIT AND result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\") - OR (NOT HOST_64BIT AND result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\")") -# VIEW TARGET should have same result as VIEW HOST -cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" - "(HOST_64BIT AND result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\") - OR (NOT HOST_64BIT AND result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\")") +else() -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW 64 ERROR_VARIABLE status) -check("${KEY}[VALUE_NAMES]" "${result}" "${status}" - "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + # VIEW BOTH should have same result as default view + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW BOTH ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result STREQUAL result2") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW HOST ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" + "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ") + # VIEW TARGET should have same result as VIEW HOST + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW 64 ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"\"") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW 32 ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + + # reg 64bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW 64_32 ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result}" "${status}" + "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + + # reg 32bit is read first. Result is the same as with view 64_32 + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW 32_64 ERROR_VARIABLE status) + check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW 32 ERROR_VARIABLE status) -check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\"") +endif() -# reg 64bit is read first -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW 64_32 ERROR_VARIABLE status) -check("${KEY}[VALUE_NAMES]" "${result}" "${status}" - "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") -# reg 32bit is read first. Result is the same as with view 64_32 -cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW 32_64 ERROR_VARIABLE status) -check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result") +# HKCU/Software/CMake-Tests/chsi-registry: check retrieval of sub keys +if (ARCH STREQUAL "64bit") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2;subkey3\"") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW HOST ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"") + # VIEW TARGET should have same result as VIEW HOST + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result2 STREQUAL result") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW 64 ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW 32 ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey3\"") + + # reg 64bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW 64_32 ERROR_VARIABLE status) + check("${KEY}[SUBLEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2;subkey3\"") + + # reg 32bit is read first. Result is the same as with view 64_32 + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW 32_64 ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result2}" "${status}" "result2 STREQUAL result") +else() -# HKCU/Software/CMake-Tests/chsi-registry: check retrieval of sub keys -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - ERROR_VARIABLE status) -check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2;subkey3\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - VIEW HOST ERROR_VARIABLE status) -check("${KEY}[SUBKEYS]" "${result}" "${status}" - "(HOST_64BIT AND result STREQUAL \"subkey1;subkey2\") - OR (NOT HOST_64BIT AND result STREQUAL \"subkey1;subkey3\")") -# VIEW TARGET should have same result as VIEW HOST -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}[SUBKEYS]" "${result}" "${status}" - "(HOST_64BIT AND result STREQUAL \"subkey1;subkey2\") - OR (NOT HOST_64BIT AND result STREQUAL \"subkey1;subkey3\")") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW HOST ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"") + # VIEW TARGET should have same result as VIEW HOST + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result2 STREQUAL result") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - VIEW 64 ERROR_VARIABLE status) -check("${KEY}[SUBKEYS]" "${result}" "${status}" - "result STREQUAL \"subkey1;subkey2\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW 64 ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"\"") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - VIEW 32 ERROR_VARIABLE status) -check("${KEY}[SUBKEYS]" "${result}" "${status}" - "result STREQUAL \"subkey1;subkey3\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW 32 ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"") -# reg 64bit is read first -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - VIEW 64_32 ERROR_VARIABLE status) -check("${KEY}[SUBLEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2;subkey3\"") + # reg 64bit is read first + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW 64_32 ERROR_VARIABLE status) + check("${KEY}[SUBLEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"") -# reg 32bit is read first. Result is the same as with view 64_32 -cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - VIEW 32_64 ERROR_VARIABLE status) -check("${KEY}[SUBKEYS]" "${result2}" "${status}" "result2 STREQUAL result") + # reg 32bit is read first. Result is the same as with view 64_32 + cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW 32_64 ERROR_VARIABLE status) + check("${KEY}[SUBKEYS]" "${result2}" "${status}" "result2 STREQUAL result") +endif() -# Check influence of variable CMAKE_SIZEOF_VOID_P -set(CMAKE_SIZEOF_VOID_P 8) -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"") +if (ARCH STREQUAL "64bit") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"64bit\"") + # Check influence of variable CMAKE_SIZEOF_VOID_P + set(CMAKE_SIZEOF_VOID_P 8) -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"64bit\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"") -set(CMAKE_SIZEOF_VOID_P 4) + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"32bit\"") + set(CMAKE_SIZEOF_VOID_P 4) -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"") -cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS - VIEW TARGET ERROR_VARIABLE status) -check("${KEY}" "${result}" "${status}" "result STREQUAL \"subkey1;subkey3\"") + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"32bit\"") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\"") + + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS + VIEW TARGET ERROR_VARIABLE status) + check("${KEY}" "${result}" "${status}" "result STREQUAL \"subkey1;subkey3\"") + +endif() diff --git a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake index d857bee..9122470 100644 --- a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake @@ -36,12 +36,24 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") # Tests using the Windows registry find_program(REG NAMES "reg.exe" NO_CACHE) if (REG) + ## check host architecture + cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status) + if (status STREQUAL "") + set(ARCH "64bit") + else() + set(ARCH "32bit") + endif() + # crete some entries in the registry - cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_data.reg" TO_NATIVE_PATH_LIST registry_data) + cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_host${ARCH}.reg" TO_NATIVE_PATH_LIST registry_data) execute_process(COMMAND "${REG}" import "${registry_data}" OUTPUT_QUIET ERROR_QUIET) - run_cmake(Registry_Query) + + run_cmake_with_options(Registry_Query -DARCH=${ARCH}) + # clean-up registry - execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests" /f OUTPUT_QUIET ERROR_QUIET) - execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests" /f OUTPUT_QUIET ERROR_QUIET) + execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests\\chsi-registry" /f OUTPUT_QUIET ERROR_QUIET) + if (ARCH STREQUAL "64bit") + execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\chsi-registry" /f OUTPUT_QUIET ERROR_QUIET) + endif() endif() endif() diff --git a/Tests/RunCMake/cmake_host_system_information/registry_host32bit.reg b/Tests/RunCMake/cmake_host_system_information/registry_host32bit.reg Binary files differnew file mode 100644 index 0000000..2bbd6a2 --- /dev/null +++ b/Tests/RunCMake/cmake_host_system_information/registry_host32bit.reg diff --git a/Tests/RunCMake/cmake_host_system_information/registry_data.reg b/Tests/RunCMake/cmake_host_system_information/registry_host64bit.reg Binary files differindex 8596648..8596648 100644 --- a/Tests/RunCMake/cmake_host_system_information/registry_data.reg +++ b/Tests/RunCMake/cmake_host_system_information/registry_host64bit.reg diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt new file mode 100644 index 0000000..bf9157b --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + The language CXX was requested for compilation but was not enabled. To + enable a language it needs to be specified in a 'project' or + 'enable_language' command in the root CMakeLists.txt diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake b/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake new file mode 100644 index 0000000..caab687 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake @@ -0,0 +1,3 @@ + +add_executable(UsesCXXLang empty.cxx) +set_source_files_properties(empty.cxx PROPERTIES GENERATED TRUE LANGUAGE CXX ) diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 349e8ac..d7dab12 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -8,6 +8,9 @@ run_cmake(LanguagesEmpty) run_cmake(LanguagesNONE) run_cmake(LanguagesTwice) run_cmake(LanguagesUnordered) +if(RunCMake_GENERATOR MATCHES "Make|Ninja") + run_cmake(LanguagesUsedButNotEnabled) +endif() run_cmake(ProjectDescription) run_cmake(ProjectDescription2) run_cmake(ProjectDescriptionNoArg) |