diff options
112 files changed, 438 insertions, 585 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7440f2..cf7cb26 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ - when: never .fedora31: &fedora31 - image: "kitware/cmake:ci-fedora31-x86_64-2020-05-08" + image: "kitware/cmake:ci-fedora31-x86_64-2020-06-01" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -57,6 +57,14 @@ CMAKE_CONFIGURATION: fedora31_ninja CTEST_NO_WARNINGS_ALLOWED: 1 +.fedora31_ninja_multi: &fedora31_ninja_multi + extends: .fedora31 + + variables: + CMAKE_CONFIGURATION: fedora31_ninja_multi + CTEST_NO_WARNINGS_ALLOWED: 1 + CMAKE_GENERATOR: "Ninja Multi-Config" + .fedora31_makefiles: &fedora31_makefiles extends: .fedora31 @@ -297,6 +305,20 @@ interruptible: true +.cmake_test_unix_external: &cmake_test_unix_external + stage: test-ext + + script: + - *before_script_unix + - .gitlab/ci/sccache.sh + # Allow the server to already be running. + - "sccache --start-server || :" + - sccache --show-stats + - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake" + - sccache --show-stats + + interruptible: true + .cmake_test_windows_external: &cmake_test_windows_external stage: test-ext @@ -321,7 +343,7 @@ build:fedora31-tidy: <<: - *fedora31_tidy - *cmake_build_unix - - *linux_builder_tags + - *linux_builder_tags_qt rules: *rules_settings build:fedora31-sphinx: @@ -336,7 +358,7 @@ build:fedora31-ninja: - *fedora31_ninja - *cmake_build_unix - *cmake_build_artifacts - - *linux_builder_tags + - *linux_builder_tags_qt rules: *manual_rules_settings test:fedora31-ninja: @@ -344,18 +366,30 @@ test:fedora31-ninja: - *fedora31_ninja - *cmake_test_unix - *linux_builder_tags_qt + - *cmake_test_artifacts rules: *rules_settings dependencies: - build:fedora31-ninja needs: - build:fedora31-ninja +test:fedora31-ninja-multi: + <<: + - *fedora31_ninja_multi + - *cmake_test_unix_external + - *linux_builder_tags_qt + rules: *rules_settings + dependencies: + - test:fedora31-ninja + needs: + - test:fedora31-ninja + build:fedora31-makefiles: <<: - *fedora31_makefiles - *cmake_build_unix - *cmake_build_artifacts - - *linux_builder_tags + - *linux_builder_tags_qt rules: *manual_rules_settings test:fedora31-makefiles: diff --git a/.gitlab/ci/configure_fedora31_common.cmake b/.gitlab/ci/configure_fedora31_common.cmake new file mode 100644 index 0000000..dc068d5 --- /dev/null +++ b/.gitlab/ci/configure_fedora31_common.cmake @@ -0,0 +1,4 @@ +set(BUILD_CursesDialog ON CACHE BOOL "") +set(BUILD_QtDialog ON CACHE BOOL "") + +include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/configure_fedora31_makefiles.cmake b/.gitlab/ci/configure_fedora31_makefiles.cmake index 33f0db0..74768b7 100644 --- a/.gitlab/ci/configure_fedora31_makefiles.cmake +++ b/.gitlab/ci/configure_fedora31_makefiles.cmake @@ -1 +1 @@ -include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora31_common.cmake") diff --git a/.gitlab/ci/configure_fedora31_ninja.cmake b/.gitlab/ci/configure_fedora31_ninja.cmake index 33f0db0..74768b7 100644 --- a/.gitlab/ci/configure_fedora31_ninja.cmake +++ b/.gitlab/ci/configure_fedora31_ninja.cmake @@ -1 +1 @@ -include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora31_common.cmake") diff --git a/.gitlab/ci/configure_fedora31_ninja_multi.cmake b/.gitlab/ci/configure_fedora31_ninja_multi.cmake new file mode 100644 index 0000000..20863a2 --- /dev/null +++ b/.gitlab/ci/configure_fedora31_ninja_multi.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/.gitlab/ci/configure_fedora31_tidy.cmake b/.gitlab/ci/configure_fedora31_tidy.cmake index f41ad82..55d022c 100644 --- a/.gitlab/ci/configure_fedora31_tidy.cmake +++ b/.gitlab/ci/configure_fedora31_tidy.cmake @@ -1,3 +1,3 @@ set(CMake_RUN_CLANG_TIDY ON CACHE BOOL "") -include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora31_common.cmake") diff --git a/.gitlab/ci/docker/fedora31/install_deps.sh b/.gitlab/ci/docker/fedora31/install_deps.sh index bcb1564..0d857c1 100755 --- a/.gitlab/ci/docker/fedora31/install_deps.sh +++ b/.gitlab/ci/docker/fedora31/install_deps.sh @@ -1,8 +1,10 @@ #!/bin/sh # Install build requirements. -dnf install -y \ - openssl-devel +dnf install --setopt=install_weak_deps=False -y \ + ncurses-devel \ + openssl-devel \ + qt5-qtbase-devel # Install development tools. dnf install --setopt=install_weak_deps=False -y \ diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 8d41ed8..e98038a 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.18 .. toctree:: :maxdepth: 1 + CMP0108: A target cannot link to itself through an alias. </policy/CMP0108> CMP0107: An ALIAS target cannot overwrite another target. </policy/CMP0107> CMP0106: The Documentation module is removed. </policy/CMP0106> CMP0105: Device link step uses the link options. </policy/CMP0105> diff --git a/Help/policy/CMP0108.rst b/Help/policy/CMP0108.rst new file mode 100644 index 0000000..0d54cfa --- /dev/null +++ b/Help/policy/CMP0108.rst @@ -0,0 +1,19 @@ +CMP0108 +------- + +A target is not allowed to link to itself even through an ``ALIAS`` target. + +In CMake 3.17 and below, a target can link to a target aliased to itself. + +The ``OLD`` behavior for this policy is to allow a target to link to a target +aliased to itself. + +The ``NEW`` behavior of this policy is to prevent a target to link to itself +through an ``ALIAS`` target. + +This policy was introduced in CMake version 3.17. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/prop_tgt/C_STANDARD.rst b/Help/prop_tgt/C_STANDARD.rst index e7f7904..6a05139 100644 --- a/Help/prop_tgt/C_STANDARD.rst +++ b/Help/prop_tgt/C_STANDARD.rst @@ -6,8 +6,8 @@ The C standard whose features are requested to build this target. This property specifies the C standard whose features are requested to build this target. For some compilers, this results in adding a flag such as ``-std=gnu11`` to the compile line. For compilers that -have no notion of a standard level, such as Microsoft Visual C++ before -2015 Update 3, this has no effect. +have no notion of a C standard level, such as all versions of +MSVC known as of this version of CMake, this has no effect. Supported values are ``90``, ``99`` and ``11``. diff --git a/Help/release/dev/self-link-through-alias.rst b/Help/release/dev/self-link-through-alias.rst new file mode 100644 index 0000000..d91d7ae --- /dev/null +++ b/Help/release/dev/self-link-through-alias.rst @@ -0,0 +1,5 @@ +self-link-through-alias +----------------------- + +* Linking a target to itself through an alias now raise an error. + See policy :policy:`CMP0108`. diff --git a/Modules/Compiler/GNU-ASM.cmake b/Modules/Compiler/GNU-ASM.cmake index 3daa57d..94af401 100644 --- a/Modules/Compiler/GNU-ASM.cmake +++ b/Modules/Compiler/GNU-ASM.cmake @@ -9,4 +9,5 @@ if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH STREQUAL "GNU assembler") set(CMAKE_DEPFILE_FLAGS_ASM${ASM_DIALECT} "--MD <DEPFILE>") set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_ASM_DEFINE_FLAG "--defsym ") endif() diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index df6d6b8..668a6a9 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -111,11 +111,13 @@ macro(__compiler_gnu lang) endif() list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") - set(CMAKE_PCH_EXTENSION .gch) - if (NOT CMAKE_GENERATOR MATCHES "Xcode") - set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header") + if(NOT "x${lang}" STREQUAL "xFortran") + set(CMAKE_PCH_EXTENSION .gch) + if (NOT CMAKE_GENERATOR MATCHES "Xcode") + set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header") + endif() + set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch) + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -include <PCH_HEADER>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -x ${__pch_header_${lang}} -include <PCH_HEADER>) endif() - set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch) - set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -include <PCH_HEADER>) - set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -x ${__pch_header_${lang}} -include <PCH_HEADER>) endmacro() diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake index 63a20af..9a760c8 100644 --- a/Modules/Compiler/Intel.cmake +++ b/Modules/Compiler/Intel.cmake @@ -33,12 +33,14 @@ else() endif() list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") - # Precompile Headers - set(CMAKE_PCH_EXTENSION .pchi) - set(CMAKE_LINK_PCH ON) - set(CMAKE_PCH_EPILOGUE "#pragma hdrstop") - set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch) - set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Wno-pch-messages -pch-use <PCH_FILE> -include <PCH_HEADER>) - set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Wno-pch-messages -pch-create <PCH_FILE> -include <PCH_HEADER>) + if(NOT "x${lang}" STREQUAL "xFortran") + # Precompile Headers + set(CMAKE_PCH_EXTENSION .pchi) + set(CMAKE_LINK_PCH ON) + set(CMAKE_PCH_EPILOGUE "#pragma hdrstop") + set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch) + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Wno-pch-messages -pch-use <PCH_FILE> -include <PCH_HEADER>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Wno-pch-messages -pch-create <PCH_FILE> -include <PCH_HEADER>) + endif() endmacro() endif() diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 0a4d4e1..c6de3b0 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -42,6 +42,7 @@ endif() set(CMAKE_SHARED_LIBRARY_PREFIX "lib") set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".tbd" ".so") set(CMAKE_SHARED_MODULE_PREFIX "lib") set(CMAKE_SHARED_MODULE_SUFFIX ".so") set(CMAKE_MODULE_EXISTS 1) @@ -156,6 +157,13 @@ if(_CMAKE_OSX_SYSROOT_PATH) break() endif() endforeach() + + if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/lib) + list(INSERT CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/lib) + endif() + if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/lib) + list(INSERT CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/lib) + endif() endif() if (OSX_DEVELOPER_ROOT AND EXISTS "${OSX_DEVELOPER_ROOT}/Library/Frameworks") list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH @@ -208,11 +216,19 @@ set(CMAKE_SYSTEM_APPBUNDLE_PATH unset(_apps_paths) include(Platform/UnixPaths) -if(_CMAKE_OSX_SYSROOT_PATH AND EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include) - list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_CMAKE_OSX_SYSROOT_PATH}/usr) - foreach(lang C CXX OBJC OBJCXX Swift) - list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/include) - endforeach() +if(_CMAKE_OSX_SYSROOT_PATH) + if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include) + list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr) + foreach(lang C CXX OBJC OBJCXX Swift) + list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/include) + endforeach() + endif() + if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/include) + list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/local) + foreach(lang C CXX OBJC OBJCXX Swift) + list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/include) + endforeach() + endif() endif() list(APPEND CMAKE_SYSTEM_PREFIX_PATH /sw # Fink diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index f6a20f8..a60e05e 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -41,6 +41,14 @@ Defines the following command for use with ``SWIG``: configuration-specific files generated by ``SWIG``. All build configurations must result in the same generated source file. + .. note:: + + For Make-based generators, ``swig_add_library`` does not track file + dependencies, so depending on the ``<name>_swig_compilation`` custom target + is required for targets which require the ``swig``-generated files to + exist. Other generators may depend on the source files that would be + generated by SWIG. + ``TYPE`` ``SHARED``, ``MODULE`` and ``STATIC`` have the same semantic as for the :command:`add_library` command. If ``USE_BUILD_SHARED_LIBS`` is specified, diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9eaf22c..72d71e6 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 17) -set(CMake_VERSION_PATCH 20200602) +set(CMake_VERSION_PATCH 20200603) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 08fd2a2..288dc58 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -921,11 +921,11 @@ int cmCPackGenerator::InstallCMakeProject( } } - if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { + if (auto d = mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { if (!absoluteDestFiles.empty()) { absoluteDestFiles += ";"; } - absoluteDestFiles += mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); + absoluteDestFiles += d; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Got some ABSOLUTE DESTINATION FILES: " << absoluteDestFiles << std::endl); @@ -936,8 +936,7 @@ int cmCPackGenerator::InstallCMakeProject( GetComponentInstallDirNameSuffix(component); if (nullptr != this->GetOption(absoluteDestFileComponent)) { std::string absoluteDestFilesListComponent = - cmStrCat(this->GetOption(absoluteDestFileComponent), ';', - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); + cmStrCat(this->GetOption(absoluteDestFileComponent), ';', d); this->SetOption(absoluteDestFileComponent, absoluteDestFilesListComponent.c_str()); } else { diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 2989025..ea36df5 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -21,6 +21,7 @@ #include "cmCurl.h" #include "cmDuration.h" #include "cmGeneratedFileStream.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 9250fbc..35f09fd 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -15,6 +15,7 @@ #include "cmCursesPathWidget.h" #include "cmCursesStringWidget.h" #include "cmCursesWidget.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index df34283..6fc556c 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -17,6 +17,7 @@ #include "cmCursesStandardIncludes.h" #include "cmCursesStringWidget.h" #include "cmCursesWidget.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" @@ -853,11 +854,7 @@ void cmCursesMainForm::HandleInput() } // switch advanced on/off else if (key == 't') { - if (this->AdvancedMode) { - this->AdvancedMode = false; - } else { - this->AdvancedMode = true; - } + this->AdvancedMode = !this->AdvancedMode; getmaxyx(stdscr, y, x); this->RePost(); this->Render(1, 1, x, y); diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index c629478..4830d63 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -105,12 +105,10 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) { return false; } - // enter edit with return and i (vim binding) - if (!this->InEdit && (key == 10 || key == KEY_ENTER || key == 'i')) { - this->OnReturn(fm, w); - } - // leave edit with return (but not i -- not a toggle) - else if (this->InEdit && (key == 10 || key == KEY_ENTER)) { + // toggle edit with return + if ((key == 10 || key == KEY_ENTER) + // enter edit with i (and not-edit mode) + || (!this->InEdit && key == 'i')) { this->OnReturn(fm, w); } else if (key == KEY_DOWN || key == ctrl('n') || key == KEY_UP || key == ctrl('p') || key == KEY_NPAGE || key == ctrl('d') || diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 930f300..6dbfe11 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -595,7 +595,11 @@ void CMakeSetupDialog::doHelp() QDialog dialog; QFontMetrics met(this->font()); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + int msgWidth = met.horizontalAdvance(msg); +#else int msgWidth = met.width(msg); +#endif dialog.setMinimumSize(msgWidth / 15, 20); dialog.setWindowTitle(tr("Help")); QVBoxLayout* l = new QVBoxLayout(&dialog); @@ -1056,14 +1060,7 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) this->GenerateAction->setEnabled(false); this->OpenProjectButton->setEnabled(false); this->GenerateButton->setText(tr("&Stop")); - } else if (s == ReadyConfigure) { - this->setEnabledState(true); - this->GenerateButton->setEnabled(true); - this->GenerateAction->setEnabled(true); - this->ConfigureButton->setEnabled(true); - this->ConfigureButton->setText(tr("&Configure")); - this->GenerateButton->setText(tr("&Generate")); - } else if (s == ReadyGenerate) { + } else if (s == ReadyConfigure || s == ReadyGenerate) { this->setEnabledState(true); this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 3e6a49e..40cc89c 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -209,6 +209,10 @@ void QCMakeCacheModel::clear() void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) + this->beginResetModel(); +#endif + QSet<QCMakeProperty> newProps; QSet<QCMakeProperty> newProps2; @@ -231,8 +235,13 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) if (View == FlatView) { QCMakePropertyList newP = newProps.toList(); QCMakePropertyList newP2 = newProps2.toList(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) + std::sort(newP.begin(), newP.end()); + std::sort(newP2.begin(), newP2.end()); +#else qSort(newP); qSort(newP2); +#endif int row_count = 0; foreach (QCMakeProperty const& p, newP) { this->insertRow(row_count); @@ -262,10 +271,17 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) parentItems.append( new QStandardItem(key.isEmpty() ? tr("Ungrouped Entries") : key)); parentItems.append(new QStandardItem()); +#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) + parentItems[0]->setData(QBrush(QColor(255, 100, 100)), + Qt::BackgroundRole); + parentItems[1]->setData(QBrush(QColor(255, 100, 100)), + Qt::BackgroundRole); +#else parentItems[0]->setData(QBrush(QColor(255, 100, 100)), Qt::BackgroundColorRole); parentItems[1]->setData(QBrush(QColor(255, 100, 100)), Qt::BackgroundColorRole); +#endif parentItems[0]->setData(1, GroupRole); parentItems[1]->setData(1, GroupRole); root->appendRow(parentItems); @@ -305,7 +321,11 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) } this->blockSignals(b); +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) + this->endResetModel(); +#else this->reset(); +#endif } QCMakeCacheModel::ViewType QCMakeCacheModel::viewType() const @@ -315,6 +335,10 @@ QCMakeCacheModel::ViewType QCMakeCacheModel::viewType() const void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) + this->beginResetModel(); +#endif + this->View = t; QCMakePropertyList props = this->properties(); @@ -330,7 +354,11 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t) this->setProperties(oldProps); this->setProperties(props); this->blockSignals(b); +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) + this->endResetModel(); +#else this->reset(); +#endif } void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1, @@ -356,10 +384,15 @@ void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1, } if (isNew) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) + this->setData(idx1, QBrush(QColor(255, 100, 100)), Qt::BackgroundRole); + this->setData(idx2, QBrush(QColor(255, 100, 100)), Qt::BackgroundRole); +#else this->setData(idx1, QBrush(QColor(255, 100, 100)), Qt::BackgroundColorRole); this->setData(idx2, QBrush(QColor(255, 100, 100)), Qt::BackgroundColorRole); +#endif } } @@ -409,7 +442,11 @@ void QCMakeCacheModel::breakProperties( reorgProps.append((*iter)[0]); iter = tmp.erase(iter); } else { +#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) + std::sort(iter->begin(), iter->end()); +#else qSort(*iter); +#endif ++iter; } } @@ -639,9 +676,15 @@ QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option, // increase to checkbox size QStyleOptionButton opt; opt.QStyleOption::operator=(option); +#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) + sz = sz.expandedTo( + style->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &opt, nullptr) + .size()); +#else sz = sz.expandedTo( style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, nullptr) .size()); +#endif return sz; } diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx index 746fd8a..6194940 100644 --- a/Source/QtDialog/RegexExplorer.cxx +++ b/Source/QtDialog/RegexExplorer.cxx @@ -147,9 +147,6 @@ bool RegexExplorer::stripEscapes(std::string& source) } else if (nextc == 'n') { result.append(1, '\n'); in++; - } else if (nextc == 't') { - result.append(1, '\t'); - in++; } else if (isalnum(nextc) || nextc == '\0') { return false; } else { diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 9b023d9..bca7540 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -54,6 +54,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmProcessOutput.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 3d946b4..f036258 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -12,6 +12,7 @@ #include <utility> #include <vector> +#include "cmProperty.h" #include "cmPropertyMap.h" #include "cmStateTypes.h" diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 0516d26..87eb91c 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -11,6 +11,7 @@ #include "cmCommandArgumentLexer.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 32a33ee..051eff6 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -14,6 +14,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 8723d08..4c5f57d 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -21,6 +21,7 @@ #include "cmOrderDirectories.h" #include "cmOutputConverter.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" @@ -1330,18 +1331,13 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() std::vector<std::string> implicitDirVec; // Get platform-wide implicit directories. - if (const char* implicitLinks = this->Makefile->GetDefinition( - "CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES")) { - cmExpandList(implicitLinks, implicitDirVec); - } + this->Makefile->GetDefExpandList( + "CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", implicitDirVec); // Get language-specific implicit directories. std::string implicitDirVar = cmStrCat( "CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"); - if (const char* implicitDirs = - this->Makefile->GetDefinition(implicitDirVar)) { - cmExpandList(implicitDirs, implicitDirVec); - } + this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec); this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(), implicitDirVec.end()); @@ -1554,10 +1550,8 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() std::vector<std::string> implicitDirVec; // Get platform-wide implicit directories. - if (const char* implicitLinks = (this->Makefile->GetDefinition( - "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES"))) { - cmExpandList(implicitLinks, implicitDirVec); - } + this->Makefile->GetDefExpandList("CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES", + implicitDirVec); // Append library architecture to all implicit platform directories // and add them to the set @@ -1571,10 +1565,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() // Get language-specific implicit directories. std::string implicitDirVar = cmStrCat("CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_DIRECTORIES"); - if (const char* implicitDirs = - this->Makefile->GetDefinition(implicitDirVar)) { - cmExpandList(implicitDirs, implicitDirVec); - } + this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec); // Store implicit link directories. this->ImplicitLinkDirs.insert(implicitDirVec.begin(), implicitDirVec.end()); @@ -1583,10 +1574,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() std::vector<std::string> implicitLibVec; std::string implicitLibVar = cmStrCat("CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_LIBRARIES"); - if (const char* implicitLibs = - this->Makefile->GetDefinition(implicitLibVar)) { - cmExpandList(implicitLibs, implicitLibVec); - } + this->Makefile->GetDefExpandList(implicitLibVar, implicitLibVec); // Store implicit link libraries. for (std::string const& item : implicitLibVec) { @@ -1598,10 +1586,8 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() } // Get platform specific rpath link directories - if (const char* rpathDirs = - (this->Makefile->GetDefinition("CMAKE_PLATFORM_RUNTIME_PATH"))) { - cmExpandList(rpathDirs, this->RuntimeLinkDirs); - } + this->Makefile->GetDefExpandList("CMAKE_PLATFORM_RUNTIME_PATH", + this->RuntimeLinkDirs); } std::vector<std::string> const& diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 0fe19b6..60504ba 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -14,6 +14,7 @@ #include "cmGeneratorTarget.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 4499a66..e05c964 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -384,9 +384,7 @@ void cmDependsC::SetupTransforms() // Get the transformation rules. std::vector<std::string> transformRules; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - if (const char* xform = mf->GetDefinition("CMAKE_INCLUDE_TRANSFORMS")) { - cmExpandList(xform, transformRules, true); - } + mf->GetDefExpandList("CMAKE_INCLUDE_TRANSFORMS", transformRules, true); for (std::string const& tr : transformRules) { this->ParseTransform(tr); } diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 95dfc4e..8f02d95 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -80,10 +80,7 @@ cmDependsFortran::cmDependsFortran(cmLocalUnixMakefileGenerator3* lg) // Get the list of definitions. std::vector<std::string> definitions; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - if (const char* c_defines = - mf->GetDefinition("CMAKE_TARGET_DEFINITIONS_Fortran")) { - cmExpandList(c_defines, definitions); - } + mf->GetDefExpandList("CMAKE_TARGET_DEFINITIONS_Fortran", definitions); // translate i.e. FOO=BAR to FOO and add it to the list of defined // preprocessor symbols @@ -243,10 +240,7 @@ void cmDependsFortran::LocateModules() // Load information about other targets. cmMakefile* mf = this->LocalGenerator->GetMakefile(); std::vector<std::string> infoFiles; - if (const char* infoFilesValue = - mf->GetDefinition("CMAKE_TARGET_LINKED_INFO_FILES")) { - cmExpandList(infoFilesValue, infoFiles); - } + mf->GetDefExpandList("CMAKE_TARGET_LINKED_INFO_FILES", infoFiles); for (std::string const& i : infoFiles) { std::string targetDir = cmSystemTools::GetFilenamePath(i); std::string fname = targetDir + "/fortran.internal"; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index ed0689a..4d0e099 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -21,6 +21,7 @@ #include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmPropertyMap.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index be63278..7f31dd2 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -23,8 +24,6 @@ class cmListFileBacktrace; -using cmProp = const std::string*; - static void FinalAction(cmMakefile& makefile, std::string const& filename, bool append) { diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 46056c1..c6b6184 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmTarget.h" diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 582a9f0..7bc4536 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -19,6 +19,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmProperty.h" #include "cmSourceFile.h" #include "cmSourceGroup.h" #include "cmState.h" diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 253834f..613a943 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -17,14 +17,13 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmProperty.h" #include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmake.h" -using cmProp = const std::string*; // just to silence IWYU - /* Sublime Text 2 Generator Author: Morné Chamberlain diff --git a/Source/cmFileAPICache.cxx b/Source/cmFileAPICache.cxx index 25e5916..3ba943a 100644 --- a/Source/cmFileAPICache.cxx +++ b/Source/cmFileAPICache.cxx @@ -10,6 +10,7 @@ #include <cm3p/json/value.h> #include "cmFileAPI.h" +#include "cmProperty.h" #include "cmState.h" #include "cmake.h" diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index b7daebe..fe331ec 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -31,6 +31,7 @@ #include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmSourceFile.h" #include "cmSourceGroup.h" #include "cmState.h" diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index b5553b8..743ac75 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -10,6 +10,7 @@ #include <cmext/algorithm> #include "cmMakefile.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmSearchPath.h" #include "cmState.h" diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 82acfed..3e97150 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -4,7 +4,6 @@ #include <algorithm> #include <array> -#include <cstring> #include <utility> #include <cmext/algorithm> @@ -280,12 +279,7 @@ void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore) // Construct the list of path roots with no trailing slashes. for (const char** pathName = paths; *pathName; ++pathName) { // Get the list of paths to ignore from the variable. - const char* ignorePath = this->Makefile->GetDefinition(*pathName); - if ((ignorePath == nullptr) || (strlen(ignorePath) == 0)) { - continue; - } - - cmExpandList(ignorePath, ignore); + this->Makefile->GetDefExpandList(*pathName, ignore); } for (std::string& i : ignore) { diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index d1517fe..8d5b177 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -24,6 +24,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmSearchPath.h" #include "cmState.h" @@ -504,9 +505,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) case cmPolicies::NEW: { // NEW behavior is to honor the <pkg>_ROOT variables. std::string const rootVar = this->Name + "_ROOT"; - if (const char* pkgRoot = this->Makefile->GetDefinition(rootVar)) { - cmExpandList(pkgRoot, rootPaths, false); - } + this->Makefile->GetDefExpandList(rootVar, rootPaths, false); cmSystemTools::GetPath(rootPaths, rootVar.c_str()); } break; } diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 32e7892..3b82e0a 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -113,8 +113,8 @@ bool cmForEachFunctionBlocker::ReplayItems( // At end of for each execute recorded commands // store the old value std::string oldDef; - if (mf.GetDefinition(this->Args.front())) { - oldDef = mf.GetDefinition(this->Args.front()); + if (auto d = mf.GetDefinition(this->Args.front())) { + oldDef = d; } auto restore = false; @@ -186,8 +186,8 @@ bool cmForEachFunctionBlocker::ReplayZipLists( // Store old values for iteration variables std::map<std::string, std::string> oldDefs; for (auto i = 0u; i < values.size(); ++i) { - if (mf.GetDefinition(iterationVars[i])) { - oldDefs.emplace(iterationVars[i], mf.GetDefinition(iterationVars[i])); + if (auto d = mf.GetDefinition(iterationVars[i])) { + oldDefs.emplace(iterationVars[i], d); } } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index e3de2d8..906df2b 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -35,6 +35,7 @@ #include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmState.h" #include "cmStateSnapshot.h" diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 39224d1..250910a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1486,11 +1486,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths( } std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugSources = !this->DebugSourcesDone && cm::contains(debugProperties, "SOURCES"); @@ -3306,11 +3303,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories( nullptr, nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugIncludes = !this->DebugIncludesDone && cm::contains(debugProperties, "INCLUDE_DIRECTORIES"); @@ -3493,11 +3487,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions( nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugOptions = !this->DebugCompileOptionsDone && cm::contains(debugProperties, "COMPILE_OPTIONS"); @@ -3538,11 +3529,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures( nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugFeatures = !this->DebugCompileFeaturesDone && cm::contains(debugProperties, "COMPILE_FEATURES"); @@ -3585,11 +3573,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions( nullptr, nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugDefines = !this->DebugCompileDefinitionsDone && cm::contains(debugProperties, "COMPILE_DEFINITIONS"); @@ -3645,11 +3630,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders( nullptr, nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugDefines = !this->DebugPrecompileHeadersDone && std::find(debugProperties.begin(), debugProperties.end(), @@ -4024,11 +4006,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions( nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugOptions = !this->DebugLinkOptionsDone && cm::contains(debugProperties, "LINK_OPTIONS"); @@ -4286,11 +4265,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories( nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugDirectories = !this->DebugLinkDirectoriesDone && cm::contains(debugProperties, "LINK_DIRECTORIES"); @@ -5811,11 +5787,8 @@ void cmGeneratorTarget::ReportPropertyOrigin( const std::string& compatibilityType) const { std::vector<std::string> debugProperties; - const char* debugProp = this->Target->GetMakefile()->GetDefinition( - "CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Target->GetMakefile()->GetDefExpandList( + "CMAKE_DEBUG_TARGET_PROPERTIES", debugProperties); bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] && cm::contains(debugProperties, p); @@ -7030,6 +7003,13 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( // Skip entries that resolve to the target itself or are empty. std::string name = this->CheckCMP0004(lib); + if (this->GetPolicyStatusCMP0108() == cmPolicies::NEW) { + // resolve alias name + auto target = this->Makefile->FindTargetToUse(name); + if (target) { + name = target->GetName(); + } + } if (name == this->GetName() || name.empty()) { if (name == this->GetName()) { bool noMessage = false; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 788fa23..7aa7d32 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -31,7 +31,7 @@ class cmTarget; struct cmGeneratorExpressionContext; struct cmGeneratorExpressionDAGChecker; -using cmProp = const std::string*; +#include "cmProperty.h" class cmGeneratorTarget { diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 0480876..79cbe44 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -7,6 +7,7 @@ #include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStringAlgorithms.h" diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 2833977..fa4a40b 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -7,6 +7,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmSystemTools.h" namespace { diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 6b850d1..e5a3669 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -9,6 +9,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmTarget.h" #include "cmTargetPropertyComputer.h" diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index a5e496b..358d65a 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -19,6 +19,7 @@ #include "cmLocalGhsMultiGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" #include "cmSourceGroup.h" diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx index f57ef04..9dc86f4 100644 --- a/Source/cmGlobalCommonGenerator.cxx +++ b/Source/cmGlobalCommonGenerator.cxx @@ -7,6 +7,7 @@ #include "cmGeneratorTarget.h" #include "cmLocalGenerator.h" +#include "cmProperty.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d388224..4dc4092 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -42,6 +42,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmSourceFile.h" #include "cmState.h" @@ -2523,9 +2524,8 @@ void cmGlobalGenerator::AddGlobalTarget_Test( cmCustomCommandLine singleLine; singleLine.push_back(cmSystemTools::GetCTestCommand()); singleLine.push_back("--force-new-ctest-process"); - if (auto testArgs = mf->GetDefinition("CMAKE_CTEST_ARGUMENTS")) { - std::vector<std::string> args; - cmExpandList(testArgs, args); + std::vector<std::string> args; + if (mf->GetDefExpandList("CMAKE_CTEST_ARGUMENTS", args)) { for (auto const& arg : args) { singleLine.push_back(arg); } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 651bfbd..d36adfb 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -19,6 +19,7 @@ #include "cmLocalGenerator.h" #include "cmLocalGhsMultiGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 5363ea5..c31983b 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -20,6 +20,7 @@ #include "cmMakefile.h" #include "cmMakefileTargetGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateDirectory.h" #include "cmStateTypes.h" diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 0932d06..c688da2 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -167,7 +167,7 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) if (this->ExpressEdition) { fout << "# Visual Studio Express 16 for Windows Desktop\n"; } else { - fout << "# Visual Studio 16\n"; + fout << "# Visual Studio Version 16\n"; } break; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index cda3338..a5ce5d1 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3204,10 +3204,9 @@ std::string cmGlobalXCodeGenerator::GetObjectsDirectory( void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) { this->Architectures.clear(); - const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT"); - if (osxArch && sysroot) { - cmExpandList(std::string(osxArch), this->Architectures); + if (sysroot) { + mf->GetDefExpandList("CMAKE_OSX_ARCHITECTURES", this->Architectures); } if (this->Architectures.empty()) { diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index ac57bc2..178af73 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -28,6 +28,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSubcommandTable.h" diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 37d8c28..178d5df 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -18,14 +18,13 @@ #include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmake.h" -using cmProp = const std::string*; // just to silence IWYU - cmInstallTargetGenerator::cmInstallTargetGenerator( std::string targetName, std::string const& dest, bool implib, std::string file_permissions, std::vector<std::string> const& configurations, diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index a4f78bc..9f17f15 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -28,6 +28,7 @@ #include "cmLinkLineComputer.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmPropertyMap.h" #include "cmSourceFile.h" #include "cmState.h" diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index eebf328..c50a786 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -15,6 +15,7 @@ #include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ff05024..3fca2d4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -34,6 +34,7 @@ #include "cmInstallTargetGenerator.h" #include "cmLinkLineComputer.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" @@ -1235,11 +1236,10 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( // * Compilers like gfortran do not search their own implicit include // directories for modules ('.mod' files). if (lang != "Fortran") { - const char* value = this->Makefile->GetDefinition( - cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES")); - if (value != nullptr) { - size_t const impDirVecOldSize = impDirVec.size(); - cmExpandList(value, impDirVec); + size_t const impDirVecOldSize = impDirVec.size(); + if (this->Makefile->GetDefExpandList( + cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES"), + impDirVec)) { // FIXME: Use cmRange with 'advance()' when it supports non-const. for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) { cmSystemTools::ConvertToUnixSlashes(impDirVec[i]); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index e52e0d3..87e8aa4 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -23,6 +23,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmNinjaTargetGenerator.h" +#include "cmProperty.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" #include "cmState.h" diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 4c7c8c4..4545a8e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -28,6 +28,7 @@ #include "cmMakefile.h" #include "cmMakefileTargetGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 154da50..c527a49 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2745,6 +2745,18 @@ const std::string& cmMakefile::GetSafeDefinition(const std::string& name) const return *def; } +bool cmMakefile::GetDefExpandList(const std::string& name, + std::vector<std::string>& out, + bool emptyArgs) const +{ + cmProp def = this->GetDef(name); + if (!def) { + return false; + } + cmExpandList(*def, out, emptyArgs); + return true; +} + std::vector<std::string> cmMakefile::GetDefinitions() const { std::vector<std::string> res = this->StateSnapshot.ClosureKeys(); @@ -3273,10 +3285,7 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs, bool singleConfig) const { if (this->GetGlobalGenerator()->IsMultiConfig()) { - if (const char* configTypes = - this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { - cmExpandList(configTypes, configs); - } + this->GetDefExpandList("CMAKE_CONFIGURATION_TYPES", configs); return ""; } const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 04a1f2d..8dfa5b0 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -26,6 +26,7 @@ #include "cmMessageType.h" #include "cmNewLineStyle.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmSourceFileLocationKind.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" @@ -58,8 +59,6 @@ class cmTestGenerator; class cmVariableWatch; class cmake; -using cmProp = const std::string*; - /** Flag if byproducts shall also be considered. */ enum class cmSourceOutputKind { @@ -513,6 +512,8 @@ public: const std::string& GetSafeDefinition(const std::string&) const; const std::string& GetRequiredDefinition(const std::string& name) const; bool IsDefinitionSet(const std::string&) const; + bool GetDefExpandList(const std::string& name, std::vector<std::string>& out, + bool emptyArgs = false) const; /** * Get the list of all variables in the current space. If argument * cacheonly is specified and is greater than 0, then only cache diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e15b016..446f225 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -478,9 +478,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // add it now. std::string implibRuleVar = cmStrCat("CMAKE_", linkLanguage, "_CREATE_IMPORT_LIBRARY"); - if (const char* rule = this->Makefile->GetDefinition(implibRuleVar)) { - cmExpandList(rule, real_link_commands); - } + this->Makefile->GetDefExpandList(implibRuleVar, real_link_commands); } bool useResponseFileForObjects = diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2d360e6..5809b4a 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -642,27 +642,21 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( arCreateVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( arCreateVar, linkLanguage, this->GetConfigName()); - if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) { - cmExpandList(rule, archiveCreateCommands); - } + this->Makefile->GetDefExpandList(arCreateVar, archiveCreateCommands); std::string arAppendVar = cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_APPEND"); arAppendVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( arAppendVar, linkLanguage, this->GetConfigName()); - if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) { - cmExpandList(rule, archiveAppendCommands); - } + this->Makefile->GetDefExpandList(arAppendVar, archiveAppendCommands); std::string arFinishVar = cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_FINISH"); arFinishVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( arFinishVar, linkLanguage, this->GetConfigName()); - if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) { - cmExpandList(rule, archiveFinishCommands); - } + this->Makefile->GetDefExpandList(arFinishVar, archiveFinishCommands); } // Decide whether to use archiving rules. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index c98e3a9..8396fa3 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -26,6 +26,7 @@ #include "cmMakefileLibraryTargetGenerator.h" #include "cmMakefileUtilityTargetGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index f87eba7..b92548f 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -29,6 +29,7 @@ #include "cmNinjaTypes.h" #include "cmOSXBundleGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" #include "cmState.h" @@ -453,14 +454,12 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd() case cmStateEnums::STATIC_LIBRARY: case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: { - const std::string cudaLinkCmd( - this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_LIBRARY")); - cmExpandList(cudaLinkCmd, linkCmds); + this->GetMakefile()->GetDefExpandList("CMAKE_CUDA_DEVICE_LINK_LIBRARY", + linkCmds); } break; case cmStateEnums::EXECUTABLE: { - const std::string cudaLinkCmd(this->GetMakefile()->GetDefinition( - "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE")); - cmExpandList(cudaLinkCmd, linkCmds); + this->GetMakefile()->GetDefExpandList( + "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE", linkCmds); } break; default: break; @@ -557,9 +556,8 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd( case cmStateEnums::EXECUTABLE: if (this->TargetLinkLanguage(config) == "Swift") { if (this->GeneratorTarget->IsExecutableWithExports()) { - const std::string flags = - this->Makefile->GetSafeDefinition("CMAKE_EXE_EXPORTS_Swift_FLAG"); - cmExpandList(flags, linkCmds); + this->Makefile->GetDefExpandList("CMAKE_EXE_EXPORTS_Swift_FLAG", + linkCmds); } } break; @@ -1027,8 +1025,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( gt->GetFullNameComponents(prefix, base, suffix, config); std::string dbg_suffix = ".dbg"; // TODO: Where to document? - if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) { - dbg_suffix = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX"); + if (auto d = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) { + dbg_suffix = d; } vars["TARGET_PDB"] = base + suffix + dbg_suffix; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c77a85b..d406c99 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -29,6 +29,7 @@ #include "cmNinjaNormalTargetGenerator.h" #include "cmNinjaUtilityTargetGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" @@ -749,9 +750,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, if (!mf->GetIsSourceFileTryCompile()) { rule.DepType = "gcc"; rule.DepFile = "$DEP_FILE"; - const std::string cl = mf->GetDefinition("CMAKE_C_COMPILER") - ? mf->GetSafeDefinition("CMAKE_C_COMPILER") - : mf->GetSafeDefinition("CMAKE_CXX_COMPILER"); + auto d = mf->GetDefinition("CMAKE_C_COMPILER"); + const std::string cl = + d ? d : mf->GetSafeDefinition("CMAKE_CXX_COMPILER"); cldeps = cmStrCat('"', cmSystemTools::GetCMClDepsCommand(), "\" ", lang, ' ', vars.Source, " $DEP_FILE $out \"", mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX"), diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index b0b7953..8d863c3 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -17,6 +17,7 @@ #include "cmLocalNinjaGenerator.h" #include "cmNinjaTypes.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index a9adf99..a58e2f8 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -6,6 +6,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index b18c205..aa5abcb 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -15,13 +15,12 @@ #include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmSourceFile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" -using cmProp = const std::string*; - namespace { /** \class cmDependInformation * \brief Store dependency information for a single source file. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 4dff1d8..a82f421 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -318,6 +318,8 @@ class cmMakefile; SELECT(POLICY, CMP0106, "The Documentation module is removed.", 3, 18, 0, \ cmPolicies::WARN) \ SELECT(POLICY, CMP0107, "An ALIAS target cannot overwrite another target.", \ + 3, 18, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0108, "A target cannot link to itself through an alias.", \ 3, 18, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) @@ -350,7 +352,8 @@ class cmMakefile; F(CMP0095) \ F(CMP0099) \ F(CMP0104) \ - F(CMP0105) + F(CMP0105) \ + F(CMP0108) /** \class cmPolicies * \brief Handles changes in CMake behavior and policies diff --git a/Source/cmProperty.h b/Source/cmProperty.h index 80f131a..b0fcce7 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -5,6 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include <string> + class cmProperty { public: @@ -22,4 +24,6 @@ public: }; }; +using cmProp = const std::string*; + #endif diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 40ac356..5fc46a2 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -10,7 +10,7 @@ #include <utility> #include <vector> -using cmProp = const std::string*; +#include "cmProperty.h" /** \class cmPropertyMap * \brief String property map. diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 48c4b10..795c2ee 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -5,6 +5,7 @@ #include "cmCustomCommandLines.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmSourceFile.h" #include "cmStringAlgorithms.h" diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index a32f3e7..3d4f5d7 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -13,6 +13,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmProcessOutput.h" +#include "cmProperty.h" #include "cmQtAutoGen.h" #include "cmQtAutoGenInitializer.h" #include "cmState.h" diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 003a300..511a018 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -35,6 +35,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmQtAutoGen.h" #include "cmQtAutoGenGlobalInitializer.h" #include "cmSourceFile.h" @@ -570,9 +571,8 @@ bool cmQtAutoGenInitializer::InitMoc() if (this->GenTarget->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && (this->QtVersion >= IntegerVersion(5, 8))) { // Command - cmExpandList(this->Makefile->GetSafeDefinition( - "CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"), - this->Moc.PredefsCmd); + this->Makefile->GetDefExpandList("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND", + this->Moc.PredefsCmd); // Header if (!this->Moc.PredefsCmd.empty()) { ConfigFileNames(this->Moc.PredefsFile, diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 00ac337..4f7131f 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -20,14 +20,13 @@ #include "cmJsonObjectDictionary.h" #include "cmJsonObjects.h" #include "cmMessageType.h" +#include "cmProperty.h" #include "cmServer.h" #include "cmServerDictionary.h" #include "cmState.h" #include "cmSystemTools.h" #include "cmake.h" -using cmProp = const std::string*; // just to silence IWYU - // Get rid of some windows macros: #undef max diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 5c55427..354b4c3 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -5,6 +5,7 @@ #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmState.h" #include "cmStateTypes.h" diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index e2dfdc1..e669015 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -11,14 +11,13 @@ #include "cmCustomCommand.h" #include "cmListFileCache.h" +#include "cmProperty.h" #include "cmPropertyMap.h" #include "cmSourceFileLocation.h" #include "cmSourceFileLocationKind.h" class cmMakefile; -using cmProp = const std::string*; - /** \class cmSourceFile * \brief Represent a class loaded from a makefile. * diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 18d8537..0b6b40f 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -26,8 +26,6 @@ #include "cmSystemTools.h" #include "cmake.h" -using cmProp = const std::string*; - cmState::cmState() { this->CacheManager = cm::make_unique<cmCacheManager>(); diff --git a/Source/cmState.h b/Source/cmState.h index 125e4dd..885496a 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -29,8 +29,6 @@ class cmStateSnapshot; class cmMessenger; class cmExecutionStatus; -using cmProp = const std::string*; - class cmState { friend class cmStateSnapshot; diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h index 8144160..765af6f 100644 --- a/Source/cmStateDirectory.h +++ b/Source/cmStateDirectory.h @@ -12,12 +12,11 @@ #include "cmAlgorithms.h" #include "cmLinkedTree.h" #include "cmListFileCache.h" +#include "cmProperty.h" #include "cmStatePrivate.h" #include "cmStateSnapshot.h" #include "cmStringAlgorithms.h" -using cmProp = const std::string*; - class cmStateDirectory { cmStateDirectory( diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index d79df6f..c223431 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -11,6 +11,7 @@ #include "cmDefinitions.h" #include "cmListFileCache.h" +#include "cmProperty.h" #include "cmPropertyMap.h" #include "cmState.h" #include "cmStateDirectory.h" diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 6bd47f7..f0ddb68 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -15,6 +15,7 @@ #include "cmAlgorithms.h" #include "cmListFileCache.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmTargetLinkLibraryType.h" @@ -28,8 +29,6 @@ class cmPropertyMap; class cmSourceFile; class cmTargetInternals; -using cmProp = const std::string*; - /** \class cmTarget * \brief Represent a library or executable target loaded from a makefile. * diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 6325837..e714720 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -5,12 +5,11 @@ #include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmStateTypes.h" #include "cmTarget.h" #include "cmake.h" -using cmProp = const std::string*; - cmTargetPropCommandBase::cmTargetPropCommandBase(cmExecutionStatus& status) : Makefile(&status.GetMakefile()) , Status(status) diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index 5387e00..f87b7c2 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -8,14 +8,13 @@ #include <string> #include "cmListFileCache.h" +#include "cmProperty.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" class cmMessenger; -using cmProp = const std::string*; - class cmTargetPropertyComputer { public: diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 4e41993..e10a8e2 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -12,6 +12,7 @@ #include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmPropertyMap.h" #include "cmRange.h" #include "cmStateTypes.h" diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 329b3b9..64d71bc 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -9,6 +9,7 @@ #include "cmDuration.h" #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmState.h" #include "cmStateTypes.h" diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 5865a19..6de78ff 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -84,8 +84,8 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args, std::string utilityDirectory = status.GetMakefile().GetCurrentBinaryDirectory(); std::string exePath; - if (status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) { - exePath = status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH"); + if (auto d = status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) { + exePath = d; } if (!exePath.empty()) { utilityDirectory = exePath; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 65d5f10..162e807 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2286,9 +2286,7 @@ int cmake::CheckBuildSystem() // If any byproduct of makefile generation is missing we must re-run. std::vector<std::string> products; - if (const char* productStr = mf.GetDefinition("CMAKE_MAKEFILE_PRODUCTS")) { - cmExpandList(productStr, products); - } + mf.GetDefExpandList("CMAKE_MAKEFILE_PRODUCTS", products); for (std::string const& p : products) { if (!(cmSystemTools::FileExists(p) || cmSystemTools::FileIsSymlink(p))) { if (verbose) { @@ -2303,11 +2301,8 @@ int cmake::CheckBuildSystem() // Get the set of dependencies and outputs. std::vector<std::string> depends; std::vector<std::string> outputs; - const char* dependsStr = mf.GetDefinition("CMAKE_MAKEFILE_DEPENDS"); - const char* outputsStr = mf.GetDefinition("CMAKE_MAKEFILE_OUTPUTS"); - if (dependsStr && outputsStr) { - cmExpandList(dependsStr, depends); - cmExpandList(outputsStr, outputs); + if (mf.GetDefExpandList("CMAKE_MAKEFILE_DEPENDS", depends)) { + mf.GetDefExpandList("CMAKE_MAKEFILE_OUTPUTS", outputs); } if (depends.empty() || outputs.empty()) { // Not enough information was provided to do the test. Just rerun. diff --git a/Source/cmake.h b/Source/cmake.h index cd152cb..086ec87 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -22,6 +22,7 @@ #include "cmInstalledFile.h" #include "cmListFileCache.h" #include "cmMessageType.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index b12990b..75280fb 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -18,6 +18,7 @@ #include "cmDocumentationEntry.h" // IWYU pragma: keep #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" diff --git a/Tests/RunCMake/BuildDepends/GNU-AS.cmake b/Tests/RunCMake/BuildDepends/GNU-AS.cmake index 21921ef..0c7249a 100644 --- a/Tests/RunCMake/BuildDepends/GNU-AS.cmake +++ b/Tests/RunCMake/BuildDepends/GNU-AS.cmake @@ -5,6 +5,7 @@ message(STATUS "CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH='${CMAKE_ASM${A add_library(gnu_as STATIC gnu_as.s) target_include_directories(gnu_as PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_compile_definitions(gnu_as PRIVATE "TEST_DEF=Hello") file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " set(check_pairs diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 868eb24..65d5e44 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -356,6 +356,7 @@ function(add_RunCMake_test_try_compile) CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_STANDARD_DEFAULT CMake_TEST_CUDA + CMake_TEST_FILESYSTEM_1S CMAKE_OBJC_STANDARD_DEFAULT CMAKE_OBJCXX_STANDARD_DEFAULT ) diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 2d270c5..2454f25 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -31,6 +31,7 @@ \* CMP0099 \* CMP0104 \* CMP0105 + \* CMP0108 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt new file mode 100644 index 0000000..7389eff --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CMP0108-self-link.cmake:[0-9]+ \(add_library\): + Target "foo" links to itself. +Call Stack \(most recent call first\): + CMP0108-NEW-self-link.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake new file mode 100644 index 0000000..4ee9621 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake @@ -0,0 +1,4 @@ + +cmake_policy (SET CMP0108 NEW) + +include (CMP0108-self-link.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake new file mode 100644 index 0000000..813104a --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake @@ -0,0 +1,4 @@ + +cmake_policy (SET CMP0108 OLD) + +include (CMP0108-self-link.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake new file mode 100644 index 0000000..07a3490 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake @@ -0,0 +1,9 @@ + +cmake_policy (SET CMP0038 NEW) +cmake_policy (SET CMP0042 NEW) + +enable_language(C) + +add_library(foo SHARED lib.c) +add_library(Bar::foo ALIAS foo) +target_link_libraries(foo PRIVATE Bar::foo) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index fb223ab..dfa71dd 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -19,6 +19,8 @@ run_cmake(CMP0079-link-WARN) run_cmake(CMP0079-link-OLD) run_cmake(CMP0079-link-NEW) run_cmake(CMP0079-link-NEW-bogus) +run_cmake(CMP0108-OLD-self-link) +run_cmake(CMP0108-NEW-self-link) run_cmake(ImportedTarget) run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index bee9e5b..82c55cc 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -83,13 +83,17 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") message(STATUS "RerunCMake: first configuration...") run_cmake(RerunCMake) - run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .) + if(NOT CMake_TEST_FILESYSTEM_1S) + run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .) + endif() execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution message(STATUS "RerunCMake: modify try_compile input...") file(WRITE "${in_tc}" "does-not-compile\n") run_cmake_command(RerunCMake-rerun${ninja} ${CMAKE_COMMAND} --build .) - run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .) + if(NOT CMake_TEST_FILESYSTEM_1S) + run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .) + endif() unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) diff --git a/Utilities/cmThirdPartyChecks.cmake b/Utilities/cmThirdPartyChecks.cmake index e3ce469..0b57940 100644 --- a/Utilities/cmThirdPartyChecks.cmake +++ b/Utilities/cmThirdPartyChecks.cmake @@ -260,18 +260,6 @@ if(WIN32) # curl and expat: stdlib.h, stdarg.h, string.h, float.h set(STDC_HEADERS 1) - # FIXME: Teach libarchive to use #if instead of configure-time checks. - set(HAVE_DECL_INT32_MAX 1) - set(HAVE_DECL_INT32_MIN 1) - set(HAVE_DECL_INT64_MAX 1) - set(HAVE_DECL_INT64_MIN 1) - set(HAVE_DECL_INTMAX_MAX 1) - set(HAVE_DECL_INTMAX_MIN 1) - set(HAVE_DECL_SIZE_MAX 1) - set(HAVE_DECL_UINT32_MAX 1) - set(HAVE_DECL_UINT64_MAX 1) - set(HAVE_DECL_UINTMAX_MAX 1) - # libarchive looks for external hash implementations. set(ARCHIVE_CRYPTO_MD5_LIBC 0) set(ARCHIVE_CRYPTO_MD5_LIBMD 0) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index c90e768..90d104f 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -975,18 +975,8 @@ check_include_file_concat("sys/utsname.h" HAVE_SYS_UTSNAME_H) check_type_size(size_t SIZEOF_SIZE_T) check_type_size(ssize_t SIZEOF_SSIZE_T) -check_type_size("long long" SIZEOF_LONG_LONG) -check_type_size("long" SIZEOF_LONG) -check_type_size("short" SIZEOF_SHORT) -check_type_size("int" SIZEOF_INT) -check_type_size("__int64" SIZEOF___INT64) check_type_size("time_t" SIZEOF_TIME_T) -if(HAVE_SIZEOF_LONG_LONG) - set(HAVE_LONGLONG 1) - set(HAVE_LL 1) -endif() - find_file(RANDOM_FILE urandom /dev) mark_as_advanced(RANDOM_FILE) diff --git a/Utilities/cmcurl/lib/curl_config.h.cmake b/Utilities/cmcurl/lib/curl_config.h.cmake index ab8f225..aa52b6a 100644 --- a/Utilities/cmcurl/lib/curl_config.h.cmake +++ b/Utilities/cmcurl/lib/curl_config.h.cmake @@ -1,5 +1,7 @@ /* lib/curl_config.h.in. Generated somehow by cmake. */ +#include <cm3p/kwiml/abi.h> + /* when building libcurl itself */ #cmakedefine BUILDING_LIBCURL 1 @@ -404,9 +406,6 @@ /* if brotli is available */ #cmakedefine HAVE_BROTLI 1 -/* if your compiler supports LL */ -#cmakedefine HAVE_LL 1 - /* Define to 1 if you have the <locale.h> header file. */ #cmakedefine HAVE_LOCALE_H 1 @@ -414,7 +413,9 @@ #cmakedefine HAVE_LOCALTIME_R 1 /* Define to 1 if the compiler supports the 'long long' data type. */ -#cmakedefine HAVE_LONGLONG 1 +#if KWIML_ABI_SIZEOF_LONG_LONG +# define HAVE_LONGLONG 1 +#endif /* Define to 1 if you have the malloc.h header file. */ #cmakedefine HAVE_MALLOC_H 1 @@ -883,19 +884,21 @@ */ /* The size of `int', as computed by sizeof. */ -${SIZEOF_INT_CODE} +#define SIZEOF_INT KWIML_ABI_SIZEOF_INT /* The size of `short', as computed by sizeof. */ -${SIZEOF_SHORT_CODE} +#define SIZEOF_SHORT KWIML_ABI_SIZEOF_SHORT /* The size of `long', as computed by sizeof. */ -${SIZEOF_LONG_CODE} +#define SIZEOF_LONG KWIML_ABI_SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ -${SIZEOF_LONG_LONG_CODE} +#define SIZEOF_LONG_LONG KWIML_ABI_SIZEOF_LONG_LONG /* The size of `__int64', as computed by sizeof. */ -${SIZEOF___INT64_CODE} +#if KWIML_ABI_SIZEOF___INT64 +# define SIZEOF___INT64 KWIML_ABI_SIZEOF___INT64 +#endif /* The size of `off_t', as computed by sizeof. */ ${SIZEOF_OFF_T_CODE} diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index d4729b5..bfcaf30 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -690,7 +690,6 @@ int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS) LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H) LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H) -LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H) LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) LA_CHECK_INCLUDE_FILE("langinfo.h" HAVE_LANGINFO_H) LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H) @@ -716,7 +715,6 @@ LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H) LA_CHECK_INCLUDE_FILE("spawn.h" HAVE_SPAWN_H) LA_CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H) -LA_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H) LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H) @@ -1488,27 +1486,9 @@ ENDIF(HAVE_STRERROR_R) # # Check defines # -SET(headers "limits.h") -IF(HAVE_STDINT_H) - LIST(APPEND headers "stdint.h") -ENDIF(HAVE_STDINT_H) -IF(HAVE_INTTYPES_H) - LIST(APPEND headers "inttypes.h") -ENDIF(HAVE_INTTYPES_H) CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE) CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ) CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER) -CHECK_SYMBOL_EXISTS(INT32_MAX "${headers}" HAVE_DECL_INT32_MAX) -CHECK_SYMBOL_EXISTS(INT32_MIN "${headers}" HAVE_DECL_INT32_MIN) -CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX) -CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN) -CHECK_SYMBOL_EXISTS(INTMAX_MAX "${headers}" HAVE_DECL_INTMAX_MAX) -CHECK_SYMBOL_EXISTS(INTMAX_MIN "${headers}" HAVE_DECL_INTMAX_MIN) -CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX) -CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX) -CHECK_SYMBOL_EXISTS(UINTMAX_MAX "${headers}" HAVE_DECL_UINTMAX_MAX) -CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX) -CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) # # Check struct members @@ -1557,33 +1537,6 @@ ENDIF() CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME) -# -# Check for integer types -# -# -CHECK_TYPE_SIZE("short" SIZE_OF_SHORT) -CHECK_TYPE_SIZE("int" SIZE_OF_INT) -CHECK_TYPE_SIZE("long" SIZE_OF_LONG) -CHECK_TYPE_SIZE("long long" SIZE_OF_LONG_LONG) - -CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT) -CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED) -CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG) -CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG) - -CHECK_TYPE_SIZE("__int64" __INT64) -CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64) - -CHECK_TYPE_SIZE(int16_t INT16_T) -CHECK_TYPE_SIZE(int32_t INT32_T) -CHECK_TYPE_SIZE(int64_t INT64_T) -CHECK_TYPE_SIZE(intmax_t INTMAX_T) -CHECK_TYPE_SIZE(uint8_t UINT8_T) -CHECK_TYPE_SIZE(uint16_t UINT16_T) -CHECK_TYPE_SIZE(uint32_t UINT32_T) -CHECK_TYPE_SIZE(uint64_t UINT64_T) -CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) - CHECK_TYPE_SIZE(dev_t DEV_T) IF(NOT HAVE_DEV_T) IF(MSVC) @@ -1659,24 +1612,6 @@ IF(NOT HAVE_PID_T) ENDIF(WIN32) ENDIF(NOT HAVE_PID_T) # -CHECK_TYPE_SIZE(intptr_t INTPTR_T) -IF(NOT HAVE_INTPTR_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(intptr_t "int64_t") - ELSE() - SET(intptr_t "int32_t") - ENDIF() -ENDIF(NOT HAVE_INTPTR_T) -# -CHECK_TYPE_SIZE(uintptr_t UINTPTR_T) -IF(NOT HAVE_UINTPTR_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(uintptr_t "uint64_t") - ELSE() - SET(uintptr_t "uint32_t") - ENDIF() -ENDIF(NOT HAVE_UINTPTR_T) -# CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T) IF(HAVE_SIZEOF_WCHAR_T) SET(HAVE_WCHAR_T 1) diff --git a/Utilities/cmlibarchive/build/cmake/config.h.in b/Utilities/cmlibarchive/build/cmake/config.h.in index bcda4c3..e889781 100644 --- a/Utilities/cmlibarchive/build/cmake/config.h.in +++ b/Utilities/cmlibarchive/build/cmake/config.h.in @@ -7,178 +7,6 @@ * Ensure we have C99-style int64_t, etc, all defined. */ -/* First, we need to know if the system has already defined them. */ -#cmakedefine HAVE_INT16_T -#cmakedefine HAVE_INT32_T -#cmakedefine HAVE_INT64_T -#cmakedefine HAVE_INTMAX_T - -#cmakedefine HAVE_UINT8_T -#cmakedefine HAVE_UINT16_T -#cmakedefine HAVE_UINT32_T -#cmakedefine HAVE_UINT64_T -#cmakedefine HAVE_UINTMAX_T - -/* We might have the types we want under other spellings. */ -#cmakedefine HAVE___INT64 -#cmakedefine HAVE_U_INT64_T -#cmakedefine HAVE_UNSIGNED___INT64 - -/* The sizes of various standard integer types. */ -@SIZE_OF_SHORT_CODE@ -@SIZE_OF_INT_CODE@ -@SIZE_OF_LONG_CODE@ -@SIZE_OF_LONG_LONG_CODE@ -@SIZE_OF_UNSIGNED_SHORT_CODE@ -@SIZE_OF_UNSIGNED_CODE@ -@SIZE_OF_UNSIGNED_LONG_CODE@ -@SIZE_OF_UNSIGNED_LONG_LONG_CODE@ - -/* - * If we lack int64_t, define it to the first of __int64, int, long, and long long - * that exists and is the right size. - */ -#if !defined(HAVE_INT64_T) && defined(HAVE___INT64) -typedef __int64 int64_t; -#define HAVE_INT64_T -#endif - -#if !defined(HAVE_INT64_T) && SIZE_OF_INT == 8 -typedef int int64_t; -#define HAVE_INT64_T -#endif - -#if !defined(HAVE_INT64_T) && SIZE_OF_LONG == 8 -typedef long int64_t; -#define HAVE_INT64_T -#endif - -#if !defined(HAVE_INT64_T) && SIZE_OF_LONG_LONG == 8 -typedef long long int64_t; -#define HAVE_INT64_T -#endif - -#if !defined(HAVE_INT64_T) -#error No 64-bit integer type was found. -#endif - -/* - * Similarly for int32_t - */ -#if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4 -typedef int int32_t; -#define HAVE_INT32_T -#endif - -#if !defined(HAVE_INT32_T) && SIZE_OF_LONG == 4 -typedef long int32_t; -#define HAVE_INT32_T -#endif - -#if !defined(HAVE_INT32_T) -#error No 32-bit integer type was found. -#endif - -/* - * Similarly for int16_t - */ -#if !defined(HAVE_INT16_T) && SIZE_OF_INT == 2 -typedef int int16_t; -#define HAVE_INT16_T -#endif - -#if !defined(HAVE_INT16_T) && SIZE_OF_SHORT == 2 -typedef short int16_t; -#define HAVE_INT16_T -#endif - -#if !defined(HAVE_INT16_T) -#error No 16-bit integer type was found. -#endif - -/* - * Similarly for uint64_t - */ -#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64) -typedef unsigned __int64 uint64_t; -#define HAVE_UINT64_T -#endif - -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED == 8 -typedef unsigned uint64_t; -#define HAVE_UINT64_T -#endif - -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG == 8 -typedef unsigned long uint64_t; -#define HAVE_UINT64_T -#endif - -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG_LONG == 8 -typedef unsigned long long uint64_t; -#define HAVE_UINT64_T -#endif - -#if !defined(HAVE_UINT64_T) -#error No 64-bit unsigned integer type was found. -#endif - - -/* - * Similarly for uint32_t - */ -#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED == 4 -typedef unsigned uint32_t; -#define HAVE_UINT32_T -#endif - -#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED_LONG == 4 -typedef unsigned long uint32_t; -#define HAVE_UINT32_T -#endif - -#if !defined(HAVE_UINT32_T) -#error No 32-bit unsigned integer type was found. -#endif - -/* - * Similarly for uint16_t - */ -#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED == 2 -typedef unsigned uint16_t; -#define HAVE_UINT16_T -#endif - -#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED_SHORT == 2 -typedef unsigned short uint16_t; -#define HAVE_UINT16_T -#endif - -#if !defined(HAVE_UINT16_T) -#error No 16-bit unsigned integer type was found. -#endif - -/* - * Similarly for uint8_t - */ -#if !defined(HAVE_UINT8_T) -typedef unsigned char uint8_t; -#define HAVE_UINT8_T -#endif - -#if !defined(HAVE_UINT16_T) -#error No 8-bit unsigned integer type was found. -#endif - -/* Define intmax_t and uintmax_t if they are not already defined. */ -#if !defined(HAVE_INTMAX_T) -typedef int64_t intmax_t; -#endif - -#if !defined(HAVE_UINTMAX_T) -typedef uint64_t uintmax_t; -#endif - /* Define ZLIB_WINAPI if zlib was built on Visual Studio. */ #cmakedefine ZLIB_WINAPI 1 @@ -426,58 +254,14 @@ typedef uint64_t uintmax_t; don't. */ #cmakedefine HAVE_DECL_ACL_USER 1 -/* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INT32_MAX 1 - -/* Define to 1 if you have the declaration of `INT32_MIN', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INT32_MIN 1 - -/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INT64_MAX 1 - -/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INT64_MIN 1 - -/* Define to 1 if you have the declaration of `INTMAX_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INTMAX_MAX 1 - -/* Define to 1 if you have the declaration of `INTMAX_MIN', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INTMAX_MIN 1 - /* Define to 1 if you have the declaration of `SETACL', and to 0 if you don't. */ #cmakedefine HAVE_DECL_SETACL 1 -/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_SIZE_MAX 1 - -/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_SSIZE_MAX 1 - /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #cmakedefine HAVE_DECL_STRERROR_R 1 -/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_UINT32_MAX 1 - -/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_UINT64_MAX 1 - -/* Define to 1 if you have the declaration of `UINTMAX_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_UINTMAX_MAX 1 - /* Define to 1 if you have the declaration of `XATTR_NOFOLLOW', and to 0 if you don't. */ #cmakedefine HAVE_DECL_XATTR_NOFOLLOW 1 @@ -647,9 +431,6 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the <iconv.h> header file. */ #cmakedefine HAVE_ICONV_H 1 -/* Define to 1 if you have the <inttypes.h> header file. */ -#cmakedefine HAVE_INTTYPES_H 1 - /* Define to 1 if you have the <io.h> header file. */ #cmakedefine HAVE_IO_H 1 @@ -955,9 +736,6 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the <stdarg.h> header file. */ #cmakedefine HAVE_STDARG_H 1 -/* Define to 1 if you have the <stdint.h> header file. */ -#cmakedefine HAVE_STDINT_H 1 - /* Define to 1 if you have the <stdlib.h> header file. */ #cmakedefine HAVE_STDLIB_H 1 @@ -1337,8 +1115,45 @@ typedef uint64_t uintmax_t; /* Define to `int' if <sys/types.h> doesn't define. */ #cmakedefine uid_t ${uid_t} -/* Define to `int' if <sys/types.h> does not define. */ -#cmakedefine intptr_t ${intptr_t} +#include <cm3p/kwiml/int.h> -/* Define to `unsigned int' if <sys/types.h> does not define. */ -#cmakedefine uintptr_t ${uintptr_t} +#ifndef KWIML_INT_HAVE_INT64_T +# define int64_t KWIML_INT_int64_t +#endif +#ifndef KWIML_INT_HAVE_INT32_T +# define int32_t KWIML_INT_int32_t +#endif +#ifndef KWIML_INT_HAVE_INT16_T +# define int16_t KWIML_INT_int16_t +#endif +#ifndef KWIML_INT_HAVE_INT8_T +# define int8_t KWIML_INT_int8_t +#endif +#ifndef KWIML_INT_HAVE_INTPTR_T +# define intptr_t KWIML_INT_intptr_t +#endif +#ifndef KWIML_INT_HAVE_UINT64_T +# define uint64_t KWIML_INT_uint64_t +#endif +#ifndef KWIML_INT_HAVE_UINT32_T +# define uint32_t KWIML_INT_uint32_t +#endif +#ifndef KWIML_INT_HAVE_UINT16_T +# define uint16_t KWIML_INT_uint16_t +#endif +#ifndef KWIML_INT_HAVE_UINT8_T +# define uint8_t KWIML_INT_uint8_t +#endif +#ifndef KWIML_INT_HAVE_UINTPTR_T +# define uintptr_t KWIML_INT_uintptr_t +#endif + +/* Define to 1 if you have the <stdint.h> header file. */ +#ifdef KWIML_INT_HAVE_STDINT_H +# define HAVE_STDINT_H 1 +#endif + +/* Define to 1 if you have the <inttypes.h> header file. */ +#ifdef KWIML_INT_HAVE_INTTYPES_H +# define HAVE_INTTYPES_H 1 +#endif diff --git a/Utilities/cmlibarchive/libarchive/archive_platform.h b/Utilities/cmlibarchive/libarchive/archive_platform.h index 90db31f..3273930 100644 --- a/Utilities/cmlibarchive/libarchive/archive_platform.h +++ b/Utilities/cmlibarchive/libarchive/archive_platform.h @@ -107,56 +107,44 @@ /* Borland warns about its own constants! */ #if defined(__BORLANDC__) -# if HAVE_DECL_UINT64_MAX -# undef UINT64_MAX -# undef HAVE_DECL_UINT64_MAX -# endif -# if HAVE_DECL_UINT64_MIN -# undef UINT64_MIN -# undef HAVE_DECL_UINT64_MIN -# endif -# if HAVE_DECL_INT64_MAX -# undef INT64_MAX -# undef HAVE_DECL_INT64_MAX -# endif -# if HAVE_DECL_INT64_MIN -# undef INT64_MIN -# undef HAVE_DECL_INT64_MIN -# endif +# undef UINT64_MAX +# undef UINT64_MIN +# undef INT64_MAX +# undef INT64_MIN #endif /* Some platforms lack the standard *_MAX definitions. */ -#if !HAVE_DECL_SIZE_MAX +#ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif -#if !HAVE_DECL_SSIZE_MAX +#ifndef SSIZE_MAX #define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1)) #endif -#if !HAVE_DECL_UINT32_MAX +#ifndef UINT32_MAX #define UINT32_MAX (~(uint32_t)0) #endif -#if !HAVE_DECL_INT32_MAX +#ifndef INT32_MAX #define INT32_MAX ((int32_t)(UINT32_MAX >> 1)) #endif -#if !HAVE_DECL_INT32_MIN +#ifndef INT32_MIN #define INT32_MIN ((int32_t)(~INT32_MAX)) #endif -#if !HAVE_DECL_UINT64_MAX +#ifndef UINT64_MAX #define UINT64_MAX (~(uint64_t)0) #endif -#if !HAVE_DECL_INT64_MAX +#ifndef INT64_MAX #define INT64_MAX ((int64_t)(UINT64_MAX >> 1)) #endif -#if !HAVE_DECL_INT64_MIN +#ifndef INT64_MIN #define INT64_MIN ((int64_t)(~INT64_MAX)) #endif -#if !HAVE_DECL_UINTMAX_MAX +#ifndef UINTMAX_MAX #define UINTMAX_MAX (~(uintmax_t)0) #endif -#if !HAVE_DECL_INTMAX_MAX +#ifndef INTMAX_MAX #define INTMAX_MAX ((intmax_t)(UINTMAX_MAX >> 1)) #endif -#if !HAVE_DECL_INTMAX_MIN +#ifndef INTMAX_MIN #define INTMAX_MIN ((intmax_t)(~INTMAX_MAX)) #endif |