diff options
author | Christophe Giboudeaux <christophe@krop.fr> | 2021-05-17 11:44:44 +0200 |
---|---|---|
committer | Christophe Giboudeaux <christophe@krop.fr> | 2021-05-25 08:07:34 +0000 |
commit | c6e575539a4c0f370df65d15001e7f1b942b7e91 (patch) | |
tree | 5a472c6d8ff4b74b0ff7c74caa742fb00c80d03d /modules | |
parent | 1312c40ca85e2e5bab6781897b4224cfd04f805a (diff) | |
download | extra-cmake-modules-c6e575539a4c0f370df65d15001e7f1b942b7e91.tar.gz extra-cmake-modules-c6e575539a4c0f370df65d15001e7f1b942b7e91.tar.bz2 |
Clean ECM files after the minimum version change
- Remove deprecated version checks
- Use VERSION_GREATER_EQUAL
Diffstat (limited to 'modules')
-rw-r--r-- | modules/ECMAddQtDesignerPlugin.cmake | 2 | ||||
-rw-r--r-- | modules/ECMFindModuleHelpers.cmake | 8 | ||||
-rw-r--r-- | modules/ECMGenerateExportHeader.cmake | 27 | ||||
-rw-r--r-- | modules/ECMGeneratePkgConfigFile.cmake | 3 | ||||
-rw-r--r-- | modules/ECMGeneratePriFile.cmake | 2 | ||||
-rw-r--r-- | modules/ECMPackageConfigHelpers.cmake | 4 | ||||
-rw-r--r-- | modules/ECMSetupQtPluginMacroNames.cmake | 112 | ||||
-rw-r--r-- | modules/ECMSetupVersion.cmake | 9 |
8 files changed, 68 insertions, 99 deletions
diff --git a/modules/ECMAddQtDesignerPlugin.cmake b/modules/ECMAddQtDesignerPlugin.cmake index eaf3660f..7d3dfb69 100644 --- a/modules/ECMAddQtDesignerPlugin.cmake +++ b/modules/ECMAddQtDesignerPlugin.cmake @@ -618,7 +618,7 @@ QList<QDesignerCustomWidgetInterface*> ${_collection_classname}::customWidgets() # setup plugin binary add_library(${target} MODULE ${_srcs}) - if(Qt5UiPlugin_VERSION AND NOT Qt5UiPlugin_VERSION VERSION_LESS "5.9.0") + if(Qt5UiPlugin_VERSION AND Qt5UiPlugin_VERSION VERSION_GREATER_EQUAL 5.9.0) list(APPEND ARGS_LINK_LIBRARIES Qt5::UiPlugin) else() # For Qt <5.9 include dir variables needed diff --git a/modules/ECMFindModuleHelpers.cmake b/modules/ECMFindModuleHelpers.cmake index 1d9b8eea..aec2abb4 100644 --- a/modules/ECMFindModuleHelpers.cmake +++ b/modules/ECMFindModuleHelpers.cmake @@ -105,11 +105,11 @@ Since pre-1.0.0. include(CMakeParseArguments) macro(ecm_find_package_version_check module_name) - if(CMAKE_VERSION VERSION_LESS 2.8.12) - message(FATAL_ERROR "CMake 2.8.12 is required by Find${module_name}.cmake") + if(CMAKE_VERSION VERSION_LESS 3.16.0) + message(FATAL_ERROR "CMake 3.16.0 is required by Find${module_name}.cmake") endif() - if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) - message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Find${module_name}.cmake") + if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.16.0) + message(AUTHOR_WARNING "Your project should require at least CMake 3.16.0 to use Find${module_name}.cmake") endif() endmacro() diff --git a/modules/ECMGenerateExportHeader.cmake b/modules/ECMGenerateExportHeader.cmake index 7cd1418e..7b05e6fc 100644 --- a/modules/ECMGenerateExportHeader.cmake +++ b/modules/ECMGenerateExportHeader.cmake @@ -394,9 +394,7 @@ function(_ecm_geh_generate_hex_number _var_name _version) string(REGEX REPLACE ${version_regex} "\\2" _version_minor "${_version}") string(REGEX REPLACE ${version_regex} "\\3" _version_patch "${_version}") set(_outputformat) - if (NOT CMAKE_VERSION VERSION_LESS 3.13) - set(_outputformat OUTPUT_FORMAT HEXADECIMAL) - endif() + set(_outputformat OUTPUT_FORMAT HEXADECIMAL) math(EXPR _hexnumber "${_version_major}*65536 + ${_version_minor}*256 + ${_version_patch}" ${_outputformat}) set(${_var_name} ${_hexnumber} PARENT_SCOPE) endfunction() @@ -471,9 +469,6 @@ function(ecm_generate_export_header target) elseif(NOT ARGS_VERSION MATCHES ${_version_triple_regexp}) message(FATAL_ERROR "VERSION expected to be in x.y.z format when calling ecm_generate_export_header().") endif() - if (ARGS_INCLUDE_GUARD_NAME AND CMAKE_VERSION VERSION_LESS 3.11) - message(FATAL_ERROR "Argument INCLUDE_GUARD_NAME needs at least CMake 3.11 when calling ecm_generate_export_header().") - endif() if (NOT ARGS_EXCLUDE_DEPRECATED_BEFORE_AND_AT) set(ARGS_EXCLUDE_DEPRECATED_BEFORE_AND_AT 0) elseif(ARGS_EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT") @@ -771,9 +766,7 @@ function(ecm_generate_export_header target) # for older cmake verions we have to manually append our generated content # for newer we use CUSTOM_CONTENT_FROM_VARIABLE set(_custom_content_args) - if (NOT CMAKE_VERSION VERSION_LESS 3.7) - set(_custom_content_args CUSTOM_CONTENT_FROM_VARIABLE _output) - endif() + set(_custom_content_args CUSTOM_CONTENT_FROM_VARIABLE _output) generate_export_header(${target} BASE_NAME ${ARGS_BASE_NAME} DEPRECATED_MACRO_NAME "${_macro_base_name}_DECL_DEPRECATED" @@ -786,14 +779,13 @@ function(ecm_generate_export_header target) ${_custom_content_args} ) - if (CMAKE_VERSION VERSION_LESS 3.7) - if (ARGS_INCLUDE_GUARD_NAME) - set(_include_guard "ECM_GENERATEEXPORTHEADER_${ARGS_INCLUDE_GUARD_NAME}") - else() - set(_include_guard "ECM_GENERATEEXPORTHEADER_${_upper_base_name}_EXPORT_H") - endif() + if (ARGS_INCLUDE_GUARD_NAME) + set(_include_guard "ECM_GENERATEEXPORTHEADER_${ARGS_INCLUDE_GUARD_NAME}") + else() + set(_include_guard "ECM_GENERATEEXPORTHEADER_${_upper_base_name}_EXPORT_H") + endif() - file(APPEND ${_header_work_file} " + file(APPEND ${_header_work_file} " #ifndef ${_include_guard} #define ${_include_guard} @@ -802,8 +794,7 @@ ${_output} #endif /* ${_include_guard} */ " - ) - endif() + ) # avoid rebuilding if there was no change execute_process( diff --git a/modules/ECMGeneratePkgConfigFile.cmake b/modules/ECMGeneratePkgConfigFile.cmake index fde6e5d9..2fb45c83 100644 --- a/modules/ECMGeneratePkgConfigFile.cmake +++ b/modules/ECMGeneratePkgConfigFile.cmake @@ -61,8 +61,7 @@ subsequent calls. To properly use this macro a version needs to be set. To retrieve it, ``ECM_PKGCONFIG_INSTALL_DIR`` uses ``PROJECT_VERSION``. To set it, use the -project() command (only available since CMake 3.0) or the ecm_setup_version() -macro. +project() command or the ecm_setup_version() macro Example usage: diff --git a/modules/ECMGeneratePriFile.cmake b/modules/ECMGeneratePriFile.cmake index c679cbd9..63139aef 100644 --- a/modules/ECMGeneratePriFile.cmake +++ b/modules/ECMGeneratePriFile.cmake @@ -122,7 +122,7 @@ function(ECM_GENERATE_PRI_FILE) message(FATAL_ERROR "Unknown keywords given to ECM_GENERATE_PRI_FILE(): \"${EGPF_UNPARSED_ARGUMENTS}\"") endif() - if("${ECM_GLOBAL_FIND_VERSION}" VERSION_LESS "5.83.0") + if(ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.83.0) set(_support_backward_compat_version_string_var TRUE) else() set(_support_backward_compat_version_string_var FALSE) diff --git a/modules/ECMPackageConfigHelpers.cmake b/modules/ECMPackageConfigHelpers.cmake index 6bff6927..f320ebc2 100644 --- a/modules/ECMPackageConfigHelpers.cmake +++ b/modules/ECMPackageConfigHelpers.cmake @@ -59,9 +59,7 @@ include(${CMAKE_ROOT}/Modules/CMakePackageConfigHelpers.cmake) set(_ecm_package_config_helpers_included TRUE) -if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.13) - message(AUTHOR_WARNING "Your project already requires a version of CMake that includes the find_dependency macro via the CMakeFindDependencyMacro module. You should use CMakePackageConfigHelpers instead of ECMPackageConfigHelpers.") -endif() +message(AUTHOR_WARNING "Your project already requires a version of CMake that includes the find_dependency macro via the CMakeFindDependencyMacro module. You should use CMakePackageConfigHelpers instead of ECMPackageConfigHelpers.") function(ECM_CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) diff --git a/modules/ECMSetupQtPluginMacroNames.cmake b/modules/ECMSetupQtPluginMacroNames.cmake index 632149ca..348ad38e 100644 --- a/modules/ECMSetupQtPluginMacroNames.cmake +++ b/modules/ECMSetupQtPluginMacroNames.cmake @@ -111,42 +111,34 @@ macro(ecm_setup_qtplugin_macro_names) endif() # CMAKE_AUTOMOC_MACRO_NAMES - if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") - # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. - # 3.10+ lets us provide more macro names that require automoc. - list(APPEND CMAKE_AUTOMOC_MACRO_NAMES - ${ESQMN_JSON_NONE} - ${ESQMN_JSON_ARG1} - ${ESQMN_JSON_ARG2} - ${ESQMN_JSON_ARG3} - ) - endif() + list(APPEND CMAKE_AUTOMOC_MACRO_NAMES + ${ESQMN_JSON_NONE} + ${ESQMN_JSON_ARG1} + ${ESQMN_JSON_ARG2} + ${ESQMN_JSON_ARG3} + ) # CMAKE_AUTOMOC_DEPEND_FILTERS - if(NOT CMAKE_VERSION VERSION_LESS "3.9.0") - # CMake's automoc needs help to find names of plugin metadata files in case Q_PLUGIN_METADATA - # is indirectly used via other C++ preprocessor macros - # 3.9+ lets us provide some filter rule pairs (keyword, regexp) to match the names of such files - # in the plain text of the sources. See AUTOMOC_DEPEND_FILTERS docs for details. - foreach(macro_name ${ESQMN_JSON_ARG1}) - list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS - "${macro_name}" - "[\n^][ \t]*${macro_name}[ \t\n]*\\([ \t\n]*\"([^\"]+)\"" - ) - endforeach() - foreach(macro_name ${ESQMN_JSON_ARG2}) - list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS - "${macro_name}" - "[\n^][ \t]*${macro_name}[ \t\n]*\\([^,]*,[ \t\n]*\"([^\"]+)\"" - ) - endforeach() - foreach(macro_name ${ESQMN_JSON_ARG3}) - list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS - "${macro_name}" - "[\n^][ \t]*${macro_name}[ \t\n]*\\([^,]*,[^,]*,[ \t\n]*\"([^\"]+)\"" - ) - endforeach() - endif() + # CMake's automoc needs help to find names of plugin metadata files in case Q_PLUGIN_METADATA + # is indirectly used via other C++ preprocessor macros + foreach(macro_name ${ESQMN_JSON_ARG1}) + list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS + "${macro_name}" + "[\n^][ \t]*${macro_name}[ \t\n]*\\([ \t\n]*\"([^\"]+)\"" + ) + endforeach() + foreach(macro_name ${ESQMN_JSON_ARG2}) + list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS + "${macro_name}" + "[\n^][ \t]*${macro_name}[ \t\n]*\\([^,]*,[ \t\n]*\"([^\"]+)\"" + ) + endforeach() + foreach(macro_name ${ESQMN_JSON_ARG3}) + list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS + "${macro_name}" + "[\n^][ \t]*${macro_name}[ \t\n]*\\([^,]*,[^,]*,[ \t\n]*\"([^\"]+)\"" + ) + endforeach() if (ESQMN_CONFIG_CODE_VARIABLE) set(_content @@ -160,52 +152,46 @@ macro(ecm_setup_qtplugin_macro_names) ${ESQMN_JSON_ARG3} ) string(APPEND _content " -if(NOT CMAKE_VERSION VERSION_LESS \"3.10.0\") - # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. - # 3.10+ lets us provide more macro names that require automoc. - list(APPEND CMAKE_AUTOMOC_MACRO_NAMES ${_all_macro_names}) -endif() +# CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. +# 3.10+ lets us provide more macro names that require automoc. +list(APPEND CMAKE_AUTOMOC_MACRO_NAMES ${_all_macro_names}) ") if(ESQMN_JSON_ARG1 OR ESQMN_JSON_ARG2 OR ESQMN_JSON_ARG3) string(APPEND _content " -if(NOT CMAKE_VERSION VERSION_LESS \"3.9.0\") - # CMake's automoc needs help to find names of plugin metadata files in case Q_PLUGIN_METADATA - # is indirectly used via other C++ preprocessor macros - # 3.9+ lets us provide some filter rule pairs (keyword, regexp) to match the names of such files - # in the plain text of the sources. See AUTOMOC_DEPEND_FILTERS docs for details. +# CMake's automoc needs help to find names of plugin metadata files in case Q_PLUGIN_METADATA +# is indirectly used via other C++ preprocessor macros ") if(ESQMN_JSON_ARG1) string(APPEND _content -" foreach(macro_name ${ESQMN_JSON_ARG1}) - list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS - \"\${macro_name}\" - \"[\\n^][ \\t]*\${macro_name}[ \\t\\n]*\\\\([ \\t\\n]*\\\"([^\\\"]+)\\\"\" - ) - endforeach() +"foreach(macro_name ${ESQMN_JSON_ARG1}) + list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS + \"\${macro_name}\" + \"[\\n^][ \\t]*\${macro_name}[ \\t\\n]*\\\\([ \\t\\n]*\\\"([^\\\"]+)\\\"\" + ) +endforeach() ") endif() if(ESQMN_JSON_ARG2) string(APPEND _content -" foreach(macro_name ${ESQMN_JSON_ARG2}) - list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS - \"\${macro_name}\" - \"[\\n^][ \\t]*\${macro_name}[ \\t\\n]*\\\\([^,]*,[ \\t\\n]*\\\"([^\\\"]+)\\\"\" - ) - endforeach() +"foreach(macro_name ${ESQMN_JSON_ARG2}) + list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS + \"\${macro_name}\" + \"[\\n^][ \\t]*\${macro_name}[ \\t\\n]*\\\\([^,]*,[ \\t\\n]*\\\"([^\\\"]+)\\\"\" + ) +endforeach() ") endif() if(ESQMN_JSON_ARG3) string(APPEND _content -" foreach(macro_name ${ESQMN_JSON_ARG3}) - list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS - \"\${macro_name}\" - \"[\\n^][ \\t]*\${macro_name}[ \\t\\n]*\\\\([^,]*,[^,]*,[ \\t\\n]*\\\"([^\\\"]+)\\\"\" - ) - endforeach() +"foreach(macro_name ${ESQMN_JSON_ARG3}) + list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS + \"\${macro_name}\" + \"[\\n^][ \\t]*\${macro_name}[ \\t\\n]*\\\\([^,]*,[^,]*,[ \\t\\n]*\\\"([^\\\"]+)\\\"\" + ) +endforeach() ") endif() - string(APPEND _content "endif()") endif() string(APPEND _content " ####################################################################################" diff --git a/modules/ECMSetupVersion.cmake b/modules/ECMSetupVersion.cmake index b67ed0d0..f4b2e700 100644 --- a/modules/ECMSetupVersion.cmake +++ b/modules/ECMSetupVersion.cmake @@ -110,12 +110,7 @@ function(ecm_setup_version _version) set(project_manages_version FALSE) set(use_project_version FALSE) - # CMP0048 only exists in CMake 3.0.0 and later - if(CMAKE_VERSION VERSION_LESS 3.0.0) - set(project_version_policy "OLD") - else() - cmake_policy(GET CMP0048 project_version_policy) - endif() + cmake_policy(GET CMP0048 project_version_policy) if(project_version_policy STREQUAL "NEW") set(project_manages_version TRUE) if(_version STREQUAL "PROJECT") @@ -150,7 +145,7 @@ function(ecm_setup_version _version) set(ESV_SOVERSION ${_major}) endif() - if("${ECM_GLOBAL_FIND_VERSION}" VERSION_LESS "5.83.0") + if(ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.83.0) set(_set_backward_compat_version_string_vars TRUE) else() set(_set_backward_compat_version_string_vars FALSE) |