diff options
Diffstat (limited to 'Modules/Internal')
-rw-r--r-- | Modules/Internal/CPack/CPack.NuGet.nuspec.in | 5 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPackDeb.cmake | 23 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPackNuGet.cmake | 80 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPackRPM.cmake | 111 | ||||
-rw-r--r-- | Modules/Internal/CPack/NSIS.template.in | 7 | ||||
-rw-r--r-- | Modules/Internal/CheckCompilerFlag.cmake | 9 | ||||
-rw-r--r-- | Modules/Internal/CheckSourceCompiles.cmake | 3 | ||||
-rw-r--r-- | Modules/Internal/CheckSourceRuns.cmake | 3 | ||||
-rw-r--r-- | Modules/Internal/FeatureTesting.cmake | 14 |
9 files changed, 221 insertions, 34 deletions
diff --git a/Modules/Internal/CPack/CPack.NuGet.nuspec.in b/Modules/Internal/CPack/CPack.NuGet.nuspec.in index b7beb5d..d89d69f 100644 --- a/Modules/Internal/CPack/CPack.NuGet.nuspec.in +++ b/Modules/Internal/CPack/CPack.NuGet.nuspec.in @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> +<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <!-- Required elements--> <id>@CPACK_NUGET_PACKAGE_NAME@</id> @@ -12,11 +12,14 @@ @_CPACK_NUGET_OWNERS_TAG@ @_CPACK_NUGET_PROJECTURL_TAG@ @_CPACK_NUGET_LICENSEURL_TAG@ + @_CPACK_NUGET_LICENSE_TAG@ @_CPACK_NUGET_ICONURL_TAG@ + @_CPACK_NUGET_ICON_TAG@ @_CPACK_NUGET_REQUIRELICENSEACCEPTANCE_TAG@ @_CPACK_NUGET_SUMMARY_TAG@ @_CPACK_NUGET_RELEASENOTES_TAG@ @_CPACK_NUGET_COPYRIGHT_TAG@ + @_CPACK_NUGET_LANGUAGE_TAG@ @_CPACK_NUGET_TAGS_TAG@ @_CPACK_NUGET_DEPENDENCIES_TAG@ </metadata> diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index 431b074..2ceab10 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -310,10 +310,23 @@ function(cpack_deb_prepare_package_vars) set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info") endif() + if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS) + unset(PRIVATE_SEARCH_DIR_OPTIONS) + # Add -l option if the tool supports it + if(DEFINED SHLIBDEPS_EXECUTABLE_VERSION AND SHLIBDEPS_EXECUTABLE_VERSION VERSION_GREATER_EQUAL 1.17.0) + foreach(dir IN LISTS CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS) + list(APPEND PRIVATE_SEARCH_DIR_OPTIONS "-l${dir}") + endforeach() + else() + message(WARNING "CPackDeb: dkpg-shlibdeps is too old. \"CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS\" is therefore ignored.") + endif() + endif() + # Execute dpkg-shlibdeps # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package + # -l<dir>: make dpkg-shlibdeps also search in this directory for (private) shared library dependencies # -O : print to STDOUT - execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES} + execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${PRIVATE_SEARCH_DIR_OPTIONS} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES} WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE SHLIBDEPS_OUTPUT RESULT_VARIABLE SHLIBDEPS_RESULT @@ -325,7 +338,7 @@ function(cpack_deb_prepare_package_vars) endif() if(NOT SHLIBDEPS_RESULT EQUAL 0) message(FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n" - "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n" + "executed command: '${SHLIBDEPS_EXECUTABLE} ${PRIVATE_SEARCH_DIR_OPTIONS} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n" "found files: '${INSTALL_FILE_}';\n" "files info: '${CPACK_DEB_INSTALL_FILES}';\n" "binary files: '${CPACK_DEB_BINARY_FILES}'") @@ -544,7 +557,7 @@ function(cpack_deb_prepare_package_vars) string(APPEND _description_failure_message " or CPACK_DEBIAN_${_local_component_name}_DESCRIPTION") endif() - message(FATAL_ERROR _description_failure_message) + message(FATAL_ERROR "${_description_failure_message}") endif() # Ok, description has set. According to the `Debian Policy Manual`_ the first @@ -768,6 +781,10 @@ function(cpack_deb_prepare_package_vars) set(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME "${CPACK_DBGSYM_OUTPUT_FILE_NAME}" PARENT_SCOPE) list(JOIN BUILD_IDS " " BUILD_IDS) set(GEN_BUILD_IDS "${BUILD_IDS}" PARENT_SCOPE) + else() + unset(GEN_DBGSYMDIR PARENT_SCOPE) + unset(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME PARENT_SCOPE) + unset(GEN_BUILD_IDS PARENT_SCOPE) endif() endfunction() diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake index 20eed2e..fb363f4 100644 --- a/Modules/Internal/CPack/CPackNuGet.cmake +++ b/Modules/Internal/CPack/CPackNuGet.cmake @@ -107,21 +107,44 @@ endfunction() function(_cpack_nuget_variable_fallback_and_wrap_into_element ELEMENT NUGET_VAR_NAME) set(_options) set(_one_value_args) - set(_multi_value_args FALLBACK_VARS) - cmake_parse_arguments(PARSE_ARGV 0 _args "${_options}" "${_one_value_args}" "${_multi_value_args}") + set(_multi_value_args FALLBACK_VARS ATTRIBUTES) + cmake_parse_arguments(PARSE_ARGV 2 _args "${_options}" "${_one_value_args}" "${_multi_value_args}") + + if(_args_ATTRIBUTES) + list(JOIN _args_ATTRIBUTES " " _attributes) + string(PREPEND _attributes " ") + endif() _cpack_nuget_variable_fallback(_value ${NUGET_VAR_NAME} ${ARGN} USE_CDATA) + string(TOUPPER "${ELEMENT}" _ELEMENT_UP) if(_value) - string(TOUPPER "${ELEMENT}" _ELEMENT_UP) set( _CPACK_NUGET_${_ELEMENT_UP}_TAG - "<${ELEMENT}>${_value}</${ELEMENT}>" + "<${ELEMENT}${_attributes}>${_value}</${ELEMENT}>" + PARENT_SCOPE + ) + elseif(_attributes) + set( + _CPACK_NUGET_${_ELEMENT_UP}_TAG + "<${ELEMENT}${_attributes} />" PARENT_SCOPE ) endif() endfunction() +# Warn of obsolete nuspec fields, referencing CMake variables and suggested +# replacement, if any +function(_cpack_nuget_deprecation_warning NUGET_ELEMENT VARNAME REPLACEMENT) + if(${VARNAME}) + if(REPLACEMENT) + message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider replacing `${VARNAME}` with `${REPLACEMENT}`") + else() + message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider removing `${VARNAME}`") + endif() + endif() +endfunction() + # Print some debug info _cpack_nuget_debug("---[CPack NuGet Input Variables]---") _cpack_nuget_debug_var(CPACK_PACKAGE_NAME) @@ -168,6 +191,21 @@ function(_cpack_nuget_render_spec) set(CPACK_NUGET_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") endif() + # Warn about deprecated nuspec elements; warnings only display if + # variable is set + # Note that while nuspec's "summary" element is deprecated, there + # is no suggested replacement so (for now) no deprecation warning + # is shown for `CPACK_NUGET_*_DESCRIPTION_SUMMARY` + _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_PACKAGE_LICENSEURL + "CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME or CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION") + _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSEURL + "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_FILE_NAME or CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_EXPRESSION") + _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_PACKAGE_ICONURL + "CPACK_NUGET_PACKAGE_ICON") + _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICONURL + "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICON") + + # Set nuspec fields _cpack_nuget_variable_fallback( CPACK_NUGET_PACKAGE_VERSION VERSION FALLBACK_VARS @@ -207,8 +245,35 @@ function(_cpack_nuget_render_spec) FALLBACK_VARS CPACK_PACKAGE_HOMEPAGE_URL ) + + # "licenseUrl" is deprecated in favor of "license" _cpack_nuget_variable_fallback_and_wrap_into_element(licenseUrl LICENSEURL) + + # "iconUrl" is deprecated in favor of "icon" _cpack_nuget_variable_fallback_and_wrap_into_element(iconUrl ICONURL) + + # "license" takes a "type" attribute of either "file" or "expression" + # "file" refers to a file path of a .txt or .md file relative to the installation root + # "expression" refers to simple or compound expression of license identifiers + # listed at https://spdx.org/licenses/ + # Note that only one of CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME and + # CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION may be specified. If both are specified, + # CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME takes precedence and CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION is ignored. + if(CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME) + _cpack_nuget_variable_fallback_and_wrap_into_element( + license LICENSE_FILE_NAME + ATTRIBUTES [[type="file"]] + ) + elseif(CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION) + _cpack_nuget_variable_fallback_and_wrap_into_element( + license LICENSE_EXPRESSION + ATTRIBUTES [[type="expression"]] + ) + endif() + + # "icon" refers to a file path relative to the installation root + _cpack_nuget_variable_fallback_and_wrap_into_element(icon ICON) + # "summary" is deprecated in favor of "description" _cpack_nuget_variable_fallback_and_wrap_into_element( summary DESCRIPTION_SUMMARY FALLBACK_VARS @@ -222,7 +287,12 @@ function(_cpack_nuget_render_spec) endif() _cpack_nuget_variable_fallback_and_wrap_into_element(releaseNotes RELEASE_NOTES) _cpack_nuget_variable_fallback_and_wrap_into_element(copyright COPYRIGHT) + # "language" is a locale identifier such as "en_CA" + _cpack_nuget_variable_fallback_and_wrap_into_element(language LANGUAGE) _cpack_nuget_variable_fallback_and_wrap_into_element(tags TAGS LIST_GLUE " ") + # "repository" holds repository metadata consisting of four optional + # attributes: "type", "url", "branch", and "commit". While all fields are + # considered optional, they are not independent. Currently unsupported. # Handle dependencies _cpack_nuget_variable_fallback(_deps DEPENDENCIES) @@ -262,7 +332,7 @@ endfunction() function(_cpack_nuget_make_files_tag) set(_files) foreach(_comp IN LISTS ARGN) - string(APPEND _files " <file src=\"${_comp}\\**\" target=\".\" />\n") + string(APPEND _files " <file src=\"${_comp}/**\" target=\".\" />\n") endforeach() set(_CPACK_NUGET_FILES_TAG "<files>\n${_files} </files>" PARENT_SCOPE) endfunction() diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 08bbc68..47d2a5c 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -6,6 +6,56 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST +function(set_spec_script_if_enabled TYPE PACKAGE_NAME VAR) + if(NOT "${VAR}" STREQUAL "" AND NOT "${VAR}" STREQUAL "\n") + if(PACKAGE_NAME) + set(PACKAGE_NAME " -n ${PACKAGE_NAME}") + endif() + set(${TYPE}_ + "%${TYPE}${PACKAGE_NAME}\n" + "${VAR}\n" PARENT_SCOPE) + else() + set(${TYPE} "" PARENT_SCOPE) + endif() +endfunction() + +macro(set_spec_scripts PACKAGE_NAME) + # we should only set scripts that were provided + # as script announcement without content inside + # spec file will generate unneeded dependency + # on shell + + set_spec_script_if_enabled( + "post" + "${PACKAGE_NAME}" + "${RPM_SYMLINK_POSTINSTALL}\n${CPACK_RPM_SPEC_POSTINSTALL}") + + set_spec_script_if_enabled( + "posttrans" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_POSTTRANS}") + + set_spec_script_if_enabled( + "postun" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_POSTUNINSTALL}") + + set_spec_script_if_enabled( + "pre" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_PREINSTALL}") + + set_spec_script_if_enabled( + "pretrans" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_PRETRANS}") + + set_spec_script_if_enabled( + "preun" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_PREUNINSTALL}") +endmacro() + function(get_file_permissions FILE RETURN_VAR) execute_process(COMMAND ls -l ${FILE} OUTPUT_VARIABLE permissions_ @@ -1024,6 +1074,21 @@ function(cpack_rpm_generate_package) OUTPUT_STRIP_TRAILING_WHITESPACE) string(REPLACE "\n" ";" RPMBUILD_TAG_LIST "${RPMBUILD_TAG_LIST}") + # In some versions of RPM, weak dependency tags are present in the --querytags + # list, but unsupported by rpmbuild. A different method must be used to check + # if they are supported. + + execute_process( + COMMAND ${RPM_EXECUTABLE} --suggests + ERROR_QUIET + RESULT_VARIABLE RPMBUILD_SUGGESTS_RESULT) + + if(NOT RPMBUILD_SUGGESTS_RESULT EQUAL 0) + foreach(_WEAK_DEP SUGGESTS RECOMMENDS SUPPLEMENTS ENHANCES) + list(REMOVE_ITEM RPMBUILD_TAG_LIST ${_WEAK_DEP}) + endforeach() + endif() + if(CPACK_RPM_PACKAGE_EPOCH) set(TMP_RPM_EPOCH "Epoch: ${CPACK_RPM_PACKAGE_EPOCH}") endif() @@ -1349,15 +1414,21 @@ function(cpack_rpm_generate_package) continue() endif() - file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE + file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES true RELATIVE "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}" "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*") foreach(f_ IN LISTS files_for_move_) - get_filename_component(dir_path_ "${f_}" DIRECTORY) set(src_file_ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/${f_}") + if(IS_DIRECTORY "${src_file_}") + file(MAKE_DIRECTORY "${WDIR}/${f_}") + continue() + endif() + + get_filename_component(dir_path_ "${f_}" DIRECTORY) + # check that we are not overriding an existing file that doesn't # match the file that we want to copy if(EXISTS "${src_file_}" AND EXISTS "${WDIR}/${f_}") @@ -1607,6 +1678,9 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ ) elseif(GENERATE_SPEC_PARTS) # binary rpm with single debuginfo package + + set_spec_scripts("${CPACK_RPM_PACKAGE_NAME}") + file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- %package -n \@CPACK_RPM_PACKAGE_NAME\@ @@ -1637,6 +1711,13 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ %description -n \@CPACK_RPM_PACKAGE_NAME\@ \@CPACK_RPM_PACKAGE_DESCRIPTION\@ +\@post_\@ +\@posttrans_\@ +\@postun_\@ +\@pre_\@ +\@pretrans_\@ +\@preun_\@ + %files -n \@CPACK_RPM_PACKAGE_NAME\@ %defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@) \@CPACK_RPM_INSTALL_FILES\@ @@ -1662,6 +1743,8 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ set(RPMBUILD_FLAGS "-bb") if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) + set_spec_scripts("") + file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# Restore old style debuginfo creation for rpm >= 4.14. %undefine _debugsource_packages @@ -1725,24 +1808,12 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT %clean -%post -\@RPM_SYMLINK_POSTINSTALL\@ -\@CPACK_RPM_SPEC_POSTINSTALL\@ - -%posttrans -\@CPACK_RPM_SPEC_POSTTRANS\@ - -%postun -\@CPACK_RPM_SPEC_POSTUNINSTALL\@ - -%pre -\@CPACK_RPM_SPEC_PREINSTALL\@ - -%pretrans -\@CPACK_RPM_SPEC_PRETRANS\@ - -%preun -\@CPACK_RPM_SPEC_PREUNINSTALL\@ +\@post_\@ +\@posttrans_\@ +\@postun_\@ +\@pre_\@ +\@pretrans_\@ +\@preun_\@ %files %defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@) diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in index 6009ce0..0a9c487 100644 --- a/Modules/Internal/CPack/NSIS.template.in +++ b/Modules/Internal/CPack/NSIS.template.in @@ -1,4 +1,4 @@ -; CPack install script designed for a nmake build +; CPack install script designed for a nmake build ;-------------------------------- ; You must define these values @@ -42,6 +42,7 @@ @CPACK_NSIS_DEFINES@ @CPACK_NSIS_MANIFEST_DPI_AWARE_CODE@ +@CPACK_NSIS_BRANDING_TEXT_CODE@ !include Sections.nsh @@ -918,8 +919,8 @@ Function .onInit ;Run the uninstaller uninst: ClearErrors - StrLen $2 "\Uninstall.exe" - StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path + StrLen $2 "\@CPACK_NSIS_UNINSTALL_NAME@.exe" + StrCpy $3 $0 -$2 # remove "\@CPACK_NSIS_UNINSTALL_NAME@.exe" from UninstallString to get path ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file IfErrors uninst_failed inst diff --git a/Modules/Internal/CheckCompilerFlag.cmake b/Modules/Internal/CheckCompilerFlag.cmake index 99efc37..f6a4cc9 100644 --- a/Modules/Internal/CheckCompilerFlag.cmake +++ b/Modules/Internal/CheckCompilerFlag.cmake @@ -13,10 +13,12 @@ function(CMAKE_CHECK_COMPILER_FLAG _lang _flag _var) if(_lang STREQUAL "C") set(_lang_src "int main(void) { return 0; }") - set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C") + set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C" + FAIL_REGEX "-Werror=.* argument .* is not valid for C") elseif(_lang STREQUAL "CXX") set(_lang_src "int main() { return 0; }") - set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+") + set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+" + FAIL_REGEX "-Werror=.* argument .* is not valid for C\\+\\+") elseif(_lang STREQUAL "CUDA") set(_lang_src "__host__ int main() { return 0; }") set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+" # Host GNU @@ -24,6 +26,9 @@ function(CMAKE_CHECK_COMPILER_FLAG _lang _flag _var) elseif(_lang STREQUAL "Fortran") set(_lang_src " program test\n stop\n end program") set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for Fortran") + elseif(_lang STREQUAL "HIP") + set(_lang_src "__host__ int main() { return 0; }") + set(_lang_fail_regex FAIL_REGEX "argument unused during compilation: .*") # Clang elseif(_lang STREQUAL "OBJC") set(_lang_src [=[ #ifndef __OBJC__ diff --git a/Modules/Internal/CheckSourceCompiles.cmake b/Modules/Internal/CheckSourceCompiles.cmake index 3b2152a..8c3a418 100644 --- a/Modules/Internal/CheckSourceCompiles.cmake +++ b/Modules/Internal/CheckSourceCompiles.cmake @@ -22,6 +22,9 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var) elseif(_lang STREQUAL "Fortran") set(_lang_textual "Fortran") set(_lang_ext "F90") + elseif(_lang STREQUAL "HIP") + set(_lang_textual "HIP") + set(_lang_ext "hip") elseif(_lang STREQUAL "ISPC") set(_lang_textual "ISPC") set(_lang_ext "ispc") diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake index 676f3d0..75e9896 100644 --- a/Modules/Internal/CheckSourceRuns.cmake +++ b/Modules/Internal/CheckSourceRuns.cmake @@ -22,6 +22,9 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var) elseif(_lang STREQUAL "Fortran") set(_lang_textual "Fortran") set(_lang_ext "F90") + elseif(_lang STREQUAL "HIP") + set(_lang_textual "HIP") + set(_lang_ext "hip") elseif(_lang STREQUAL "OBJC") set(_lang_textual "Objective-C") set(_lang_ext "m") diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index 72d96b3..b6f3c09 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -99,6 +99,16 @@ macro(_record_compiler_features_cuda std) unset(lang_level_has_features) endmacro() +macro(_record_compiler_features_hip std) + list(APPEND CMAKE_HIP${std}_COMPILE_FEATURES hip_std_${std}) + + get_property(lang_level_has_features GLOBAL PROPERTY CMAKE_HIP${std}_KNOWN_FEATURES) + if(lang_level_has_features) + _record_compiler_features(HIP "${CMAKE_HIP${std}_STANDARD_COMPILE_OPTION}" CMAKE_HIP${std}_COMPILE_FEATURES) + endif() + unset(lang_level_has_features) +endmacro() + macro(_has_compiler_features lang level compile_flags feature_list) # presume all known features are supported get_property(known_features GLOBAL PROPERTY CMAKE_${lang}${level}_KNOWN_FEATURES) @@ -117,3 +127,7 @@ macro(_has_compiler_features_cuda std) list(APPEND CMAKE_CUDA${std}_COMPILE_FEATURES cuda_std_${std}) _has_compiler_features(CUDA ${std} "${CMAKE_CUDA${std}_STANDARD_COMPILE_OPTION}" CMAKE_CUDA${std}_COMPILE_FEATURES) endmacro() +macro(_has_compiler_features_hip std) + list(APPEND CMAKE_HIP${std}_COMPILE_FEATURES hip_std_${std}) + _has_compiler_features(HIP ${std} "${CMAKE_HIP${std}_STANDARD_COMPILE_OPTION}" CMAKE_HIP${std}_COMPILE_FEATURES) +endmacro() |