From 21218f5c1277ff840e1a7b6128af3b2abe0d35d3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Jun 2020 08:28:58 -0400 Subject: Begin post-3.18 development --- Help/release/dev/0-sample-topic.rst | 7 +++++++ Help/release/index.rst | 2 ++ Source/CMakeVersion.cmake | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/0-sample-topic.rst diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 0000000..e4cc01e --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/index.rst b/Help/release/index.rst index 4578b3a..cdc3e8b 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -7,6 +7,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b52bce6..9d9de65 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,8 +1,8 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 18) -set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 0) +set(CMake_VERSION_PATCH 20200605) +#set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) # Start with the full version number used in tags. It has no dev info. -- cgit v0.12 From e4d601546044be33f6eee549373ea093aa240d43 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 1 Jun 2020 11:35:34 -0400 Subject: QtDialog: remove Qt4 support --- Help/release/dev/remove-cmake-gui-qt4.rst | 5 + Source/QtDialog/CMakeLists.txt | 168 ++++++++++++++---------------- 2 files changed, 82 insertions(+), 91 deletions(-) create mode 100644 Help/release/dev/remove-cmake-gui-qt4.rst diff --git a/Help/release/dev/remove-cmake-gui-qt4.rst b/Help/release/dev/remove-cmake-gui-qt4.rst new file mode 100644 index 0000000..2b29b75 --- /dev/null +++ b/Help/release/dev/remove-cmake-gui-qt4.rst @@ -0,0 +1,5 @@ +remove-cmake-gui-qt4 +-------------------- + +* :manual:`cmake-gui(1)` now requires Qt5. Support for compiling with Qt4 has + been removed. diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 98dd0e2..08047b4 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -3,111 +3,97 @@ project(QtDialog) CMake_OPTIONAL_COMPONENT(cmake-gui) -find_package(Qt5Widgets QUIET) -if (Qt5Widgets_FOUND) - include_directories(${Qt5Widgets_INCLUDE_DIRS}) - add_definitions(${Qt5Widgets_DEFINITONS}) - macro(qt4_wrap_ui) - qt5_wrap_ui(${ARGN}) - endmacro() - macro(qt4_wrap_cpp) - qt5_wrap_cpp(${ARGN}) - endmacro() - macro(qt4_add_resources) - qt5_add_resources(${ARGN}) - endmacro() +find_package(Qt5Widgets REQUIRED) +include_directories(${Qt5Widgets_INCLUDE_DIRS}) +add_definitions(${Qt5Widgets_DEFINITONS}) +macro(qt4_wrap_ui) + qt5_wrap_ui(${ARGN}) +endmacro() +macro(qt4_wrap_cpp) + qt5_wrap_cpp(${ARGN}) +endmacro() +macro(qt4_add_resources) + qt5_add_resources(${ARGN}) +endmacro() - set(CMake_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) - set(QT_QTMAIN_LIBRARY ${Qt5Core_QTMAIN_LIBRARIES}) +set(CMake_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +set(QT_QTMAIN_LIBRARY ${Qt5Core_QTMAIN_LIBRARIES}) - # Try to find the package WinExtras for the task bar progress - if(WIN32) - find_package(Qt5WinExtras QUIET) - if (Qt5WinExtras_FOUND) - include_directories(${Qt5WinExtras_INCLUDE_DIRS}) - add_definitions(-DQT_WINEXTRAS) - list(APPEND CMake_QT_LIBRARIES ${Qt5WinExtras_LIBRARIES}) - endif() +# Try to find the package WinExtras for the task bar progress +if(WIN32) + find_package(Qt5WinExtras QUIET) + if (Qt5WinExtras_FOUND) + include_directories(${Qt5WinExtras_INCLUDE_DIRS}) + add_definitions(-DQT_WINEXTRAS) + list(APPEND CMake_QT_LIBRARIES ${Qt5WinExtras_LIBRARIES}) endif() +endif() - # Remove this when the minimum version of Qt is 4.6. - add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) +# Remove this when the minimum version of Qt is 4.6. +add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") - if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES) - list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES}) - set_property(SOURCE CMakeSetup.cxx - PROPERTY COMPILE_DEFINITIONS USE_QXcbIntegrationPlugin) - endif() +if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES) + list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES}) + set_property(SOURCE CMakeSetup.cxx + PROPERTY COMPILE_DEFINITIONS USE_QXcbIntegrationPlugin) +endif() - if(CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES) - list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES}) - set_property(SOURCE CMakeSetup.cxx - PROPERTY COMPILE_DEFINITIONS USE_QWindowsIntegrationPlugin) - endif() +if(CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES) + list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES}) + set_property(SOURCE CMakeSetup.cxx + PROPERTY COMPILE_DEFINITIONS USE_QWindowsIntegrationPlugin) +endif() - # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. - # FIXME: This should be part of Qt5 CMake scripts, but unfortunately - # Qt5 support is missing there. - if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) - macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var) - get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION) - if(EXISTS "${_qt_plugin_path}") - get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME) - get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH) - get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) - if(APPLE) - set(_qt_plugin_dir "PlugIns") - elseif(WIN32) - set(_qt_plugin_dir "plugins") - endif() - set(_qt_plugin_dest "${_qt_plugin_dir}/${_qt_plugin_type}") - install(FILES "${_qt_plugin_path}" - DESTINATION "${_qt_plugin_dest}" - ${COMPONENT}) - set(${_qt_plugins_var} - "${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}") - else() - message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found") +# We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. +# FIXME: This should be part of Qt5 CMake scripts, but unfortunately +# Qt5 support is missing there. +if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) + macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var) + get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION) + if(EXISTS "${_qt_plugin_path}") + get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME) + get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH) + get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) + if(APPLE) + set(_qt_plugin_dir "PlugIns") + elseif(WIN32) + set(_qt_plugin_dir "plugins") endif() - endmacro() - if(APPLE) - install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - "[Paths]\nPlugins = ${_qt_plugin_dir}\n") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" - ${COMPONENT}) - elseif(WIN32 AND NOT CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES) - install_qt5_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - "[Paths]\nPlugins = ../${_qt_plugin_dir}\n") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - DESTINATION bin + set(_qt_plugin_dest "${_qt_plugin_dir}/${_qt_plugin_type}") + install(FILES "${_qt_plugin_path}" + DESTINATION "${_qt_plugin_dest}" ${COMPONENT}) + set(${_qt_plugins_var} + "${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}") + else() + message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found") endif() + endmacro() + if(APPLE) + install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + "[Paths]\nPlugins = ${_qt_plugin_dir}\n") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" + ${COMPONENT}) + elseif(WIN32 AND NOT CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES) + install_qt5_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + "[Paths]\nPlugins = ../${_qt_plugin_dir}\n") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + DESTINATION bin + ${COMPONENT}) endif() +endif() - if(TARGET Qt5::Core) - get_property(_Qt5_Core_LOCATION TARGET Qt5::Core PROPERTY LOCATION) - get_filename_component(Qt_BIN_DIR "${_Qt5_Core_LOCATION}" PATH) - if(APPLE) - get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH) - endif() - endif() -else() - set(QT_MIN_VERSION "4.4.0") - find_package(Qt4 REQUIRED) - if(NOT QT4_FOUND) - message(SEND_ERROR "Failed to find Qt 4.4 or greater.") - return() +if(TARGET Qt5::Core) + get_property(_Qt5_Core_LOCATION TARGET Qt5::Core PROPERTY LOCATION) + get_filename_component(Qt_BIN_DIR "${_Qt5_Core_LOCATION}" PATH) + if(APPLE) + get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH) endif() - - include(${QT_USE_FILE}) - - set(CMake_QT_LIBRARIES ${QT_LIBRARIES}) - endif() set(SRCS -- cgit v0.12 From a6e1b20bab6ab7566a887d43f50c35c112c62b3d Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Mon, 1 Jun 2020 04:58:42 +0800 Subject: CPack External: Introduce `CPACK_EXTERNAL_BUILT_PACKAGES` The `CPACK_EXTERNAL_PACKAGE_SCRIPT` script may set this list variable to the full paths of generated package files. CPack copy these files from the stage directory back to the top build directory and possibly produce checksum files if the `CPACK_PACKAGE_CHECKSUM` is set. --- Help/cpack_gen/external.rst | 7 +++++++ Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst | 4 ++++ Source/CPack/cmCPackExternalGenerator.cxx | 6 ++++++ Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake | 8 ++++++++ .../RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt | 10 ++++++++++ Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake | 1 + 6 files changed, 36 insertions(+) create mode 100644 Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst diff --git a/Help/cpack_gen/external.rst b/Help/cpack_gen/external.rst index 406f6be..7ef1071 100644 --- a/Help/cpack_gen/external.rst +++ b/Help/cpack_gen/external.rst @@ -281,3 +281,10 @@ Variables specific to CPack External generator It is invoked after (optional) staging took place and may run an external packaging tool. The script has access to the variables defined by the CPack config file. + +.. variable:: CPACK_EXTERNAL_BUILT_PACKAGES + + The ``CPACK_EXTERNAL_PACKAGE_SCRIPT`` script may set this list variable to the + full paths of generated package files. CPack copy these files from the stage + directory back to the top build directory and possibly produce checksum files + if the :variable:`CPACK_PACKAGE_CHECKSUM` is set. diff --git a/Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst b/Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst new file mode 100644 index 0000000..af446d2 --- /dev/null +++ b/Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst @@ -0,0 +1,4 @@ +CPACK_EXTERNAL_BUILT_PACKAGES +----------------------------- + +* :cpack_gen:`CPack External Generator` learned the :variable:`CPACK_EXTERNAL_BUILT_PACKAGES` variable. diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index 11e1aec..53be4fe 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -75,6 +75,12 @@ int cmCPackExternalGenerator::PackageFiles() if (cmSystemTools::GetErrorOccuredFlag() || !res) { return 0; } + + const char* builtPackagesStr = + this->GetOption("CPACK_EXTERNAL_BUILT_PACKAGES"); + if (builtPackagesStr) { + cmExpandList(builtPackagesStr, this->packageFileNames, false); + } } return 1; diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake index 6f7c4c2..3db8014 100644 --- a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake +++ b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake @@ -29,3 +29,11 @@ expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt) expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt) message(STATUS "This status message is expected to be visible") + +set( + CPACK_EXTERNAL_BUILT_PACKAGES + ${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt + ${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt + ${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt + ${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt + ) diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt index 37d635f..587b2e8 100644 --- a/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt +++ b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt @@ -1 +1,11 @@ -- This status message is expected to be visible +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/external-0\.1\.1-.*\.json generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/external-0\.1\.1-.*\.json\.sha1 generated\. +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f1\.txt generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f1\.txt\.sha1 generated\. +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f2\.txt generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f2\.txt\.sha1 generated\. +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f3\.txt generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f3\.txt\.sha1 generated\. +CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f4\.txt generated\. +CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f4\.txt\.sha1 generated\. diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake index bc9766b..d4781ba 100644 --- a/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake +++ b/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake @@ -17,6 +17,7 @@ elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package") set(CPACK_EXTERNAL_ENABLE_STAGING 1) set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake") + set(CPACK_PACKAGE_CHECKSUM SHA1) endif() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1) -- cgit v0.12 From 4ccc9921be03d26436a1a70dd134ee044c3734ab Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 1 Jun 2020 11:36:50 -0400 Subject: QtDialog: use qt5 functions for special Qt sources Automoc is not supported in bootstrap builds, so it cannot be used unconditionally. --- Source/QtDialog/CMakeLists.txt | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 08047b4..4a03f0b 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -6,15 +6,6 @@ CMake_OPTIONAL_COMPONENT(cmake-gui) find_package(Qt5Widgets REQUIRED) include_directories(${Qt5Widgets_INCLUDE_DIRS}) add_definitions(${Qt5Widgets_DEFINITONS}) -macro(qt4_wrap_ui) - qt5_wrap_ui(${ARGN}) -endmacro() -macro(qt4_wrap_cpp) - qt5_wrap_cpp(${ARGN}) -endmacro() -macro(qt4_add_resources) - qt5_add_resources(${ARGN}) -endmacro() set(CMake_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) set(QT_QTMAIN_LIBRARY ${Qt5Core_QTMAIN_LIBRARIES}) @@ -102,6 +93,7 @@ set(SRCS CMakeSetup.cxx CMakeSetupDialog.cxx CMakeSetupDialog.h + Compilers.h FirstConfigure.cxx FirstConfigure.h QCMake.cxx @@ -115,7 +107,7 @@ set(SRCS WarningMessagesDialog.cxx WarningMessagesDialog.h ) -QT4_WRAP_UI(UI_SRCS +qt5_wrap_ui(UI_SRCS CMakeSetupDialog.ui Compilers.ui CrossCompiler.ui @@ -123,7 +115,7 @@ QT4_WRAP_UI(UI_SRCS RegexExplorer.ui WarningMessagesDialog.ui ) -QT4_WRAP_CPP(MOC_SRCS +qt5_wrap_cpp(MOC_SRCS AddCacheEntry.h Compilers.h CMakeSetupDialog.h @@ -134,14 +126,24 @@ QT4_WRAP_CPP(MOC_SRCS RegexExplorer.h WarningMessagesDialog.h ) -QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) +qt5_add_resources(RC_SRCS CMakeSetup.qrc) + +if (FALSE) # CMake's bootstrap binary does not support automoc + set(CMAKE_AUTOMOC 1) + set(CMAKE_AUTORCC 1) + set(CMAKE_AUTOUIC 1) +else () + list(APPEND SRCS + ${UI_SRCS} + ${MOC_SRCS} + ${RC_SRCS}) +endif () -set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS}) if(WIN32) - set(SRCS ${SRCS} CMakeSetup.rc) + list(APPEND SRCS CMakeSetup.rc) endif() if(APPLE) - set(SRCS ${SRCS} CMakeSetup.icns) + list(APPEND SRCS CMakeSetup.icns) set(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns) set_source_files_properties(CMakeSetup.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) -- cgit v0.12 From 8ea50749da2c8687a31272754eeed54646de1682 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 1 Jun 2020 11:39:30 -0400 Subject: QtDialog: use Qt5's imported targets --- Source/QtDialog/CMakeLists.txt | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 4a03f0b..e1da7c6 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -4,19 +4,15 @@ project(QtDialog) CMake_OPTIONAL_COMPONENT(cmake-gui) find_package(Qt5Widgets REQUIRED) -include_directories(${Qt5Widgets_INCLUDE_DIRS}) -add_definitions(${Qt5Widgets_DEFINITONS}) -set(CMake_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) -set(QT_QTMAIN_LIBRARY ${Qt5Core_QTMAIN_LIBRARIES}) +set(CMake_QT_EXTRA_LIBRARIES) # Try to find the package WinExtras for the task bar progress if(WIN32) find_package(Qt5WinExtras QUIET) if (Qt5WinExtras_FOUND) - include_directories(${Qt5WinExtras_INCLUDE_DIRS}) add_definitions(-DQT_WINEXTRAS) - list(APPEND CMake_QT_LIBRARIES ${Qt5WinExtras_LIBRARIES}) + list(APPEND CMake_QT_EXTRA_LIBRARIES Qt5::WinExtras) endif() endif() @@ -26,13 +22,13 @@ add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES) - list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES}) + list(APPEND CMake_QT_EXTRA_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES}) set_property(SOURCE CMakeSetup.cxx PROPERTY COMPILE_DEFINITIONS USE_QXcbIntegrationPlugin) endif() if(CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES) - list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES}) + list(APPEND CMake_QT_EXTRA_LIBRARIES ${CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES}) set_property(SOURCE CMakeSetup.cxx PROPERTY COMPILE_DEFINITIONS USE_QWindowsIntegrationPlugin) endif() @@ -79,12 +75,10 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) endif() endif() -if(TARGET Qt5::Core) - get_property(_Qt5_Core_LOCATION TARGET Qt5::Core PROPERTY LOCATION) - get_filename_component(Qt_BIN_DIR "${_Qt5_Core_LOCATION}" PATH) - if(APPLE) - get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH) - endif() +get_property(_Qt5_Core_LOCATION TARGET Qt5::Core PROPERTY LOCATION) +get_filename_component(Qt_BIN_DIR "${_Qt5_Core_LOCATION}" PATH) +if(APPLE) + get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH) endif() set(SRCS @@ -160,7 +154,7 @@ endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE}) -target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES}) +target_link_libraries(cmake-gui CMakeLib Qt5::Core Qt5::Widgets ${CMake_QT_EXTRA_LIBRARIES}) if(WIN32) target_sources(cmake-gui PRIVATE $) -- cgit v0.12 From be9633bc6ee133dfa5c65543b8e175fdc0373716 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Thu, 4 Jun 2020 16:24:04 -0400 Subject: Tests: Append .exe suffix to objdump in Android test on Windows --- Tests/RunCMake/Android/common.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index d96ab86..32412aa 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -96,7 +96,7 @@ add_executable(android_c android.c) add_executable(android_cxx android.cxx) add_library(android_cxx_lib SHARED android_lib.cxx) -set(objdump "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}objdump") +set(objdump "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}objdump${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}") if(NOT EXISTS "${objdump}") message(FATAL_ERROR "Expected tool missing:\n ${objdump}") endif() -- cgit v0.12 From d3d98288e27b344560b59c46e54c3dd9e700de40 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 5 Jun 2020 14:15:52 -0400 Subject: Tests: Ensure that Android tests work for multi-config generators --- Tests/RunCMake/Android/RunCMakeTest.cmake | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 45798ce..234525a 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -18,7 +18,19 @@ function(run_Android case) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(${case}) - run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .) + set(configs ".") + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(configs Release Debug) + endif() + foreach(config IN LISTS configs) + set(build_suffix) + set(config_arg) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(build_suffix "-${config}") + set(config_arg --config "${config}") + endif() + run_cmake_command(${case}-build${build_suffix} ${CMAKE_COMMAND} --build . ${config_arg}) + endforeach() endfunction() set(RunCMake_TEST_OPTIONS @@ -166,14 +178,25 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) # Test all combinations. foreach(vers IN LISTS _versions) foreach(stl IN LISTS stl_types) - foreach(config Release Debug) + set(configs Release Debug) + set(foreach_list "${configs}") + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(foreach_list ".") + endif() + foreach(config IN LISTS foreach_list) # Test this combination for all available abis. - message(STATUS "ndk='${ndk}' vers='${vers}' stl='${stl}' config='${config}'") + set(config_status " config='${config}'") + set(build_type_arg "-DCMAKE_BUILD_TYPE=${config}") + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(config_status) + string(REPLACE ";" "\\\\;" build_type_arg "-DCMAKE_CONFIGURATION_TYPES=${configs}") + endif() + message(STATUS "ndk='${ndk}' vers='${vers}' stl='${stl}'${config_status}") set(RunCMake_TEST_OPTIONS -DCMAKE_ANDROID_NDK=${ndk} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=${vers} -DCMAKE_ANDROID_STL_TYPE=${stl} - -DCMAKE_BUILD_TYPE=${config} + "${build_type_arg}" ) foreach(abi IN LISTS abi_names) # Skip ABIs not supported by this compiler. -- cgit v0.12 From 742038e5a8478f3ba0e404191a3a87961cbeea47 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 6 Jun 2020 00:01:18 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9d9de65..0e648ae 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 18) -set(CMake_VERSION_PATCH 20200605) +set(CMake_VERSION_PATCH 20200606) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 8ea392ebd67463d6ccdb67f34fb26ed8d3ac88fd Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 7 Jun 2020 00:01:04 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0e648ae..8055a20 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 18) -set(CMake_VERSION_PATCH 20200606) +set(CMake_VERSION_PATCH 20200607) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From eec2e9b6b9b90b93344afe9300f8f75bbb71f03e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 8 Jun 2020 00:01:05 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8055a20..8cf634f 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 18) -set(CMake_VERSION_PATCH 20200607) +set(CMake_VERSION_PATCH 20200608) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From cfbd274f7c6a6da4a2840cc174cc93a4f0f98c85 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 9 Jun 2020 00:01:29 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8cf634f..3ea4922 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 18) -set(CMake_VERSION_PATCH 20200608) +set(CMake_VERSION_PATCH 20200609) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 42dcc2bd51258c4308adbe47700245caf80c96af Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 9 Jun 2020 08:36:27 +0200 Subject: CTestConfig: allow nightly build submission using https The idea is that one may set `CTEST_DROP_METHOD` in custom CTest scripting. --- CTestConfig.cmake | 4 +++- Utilities/Sphinx/CTestConfig.cmake | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 9ec9e8f..476a1c6 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -6,7 +6,9 @@ set(CTEST_PROJECT_NAME "CMake") set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") -set(CTEST_DROP_METHOD "http") +if(NOT CTEST_DROP_METHOD STREQUAL "https") + set(CTEST_DROP_METHOD "http") +endif() set(CTEST_DROP_SITE "open.cdash.org") set(CTEST_DROP_LOCATION "/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Utilities/Sphinx/CTestConfig.cmake b/Utilities/Sphinx/CTestConfig.cmake index 9607e38..e5f4260 100644 --- a/Utilities/Sphinx/CTestConfig.cmake +++ b/Utilities/Sphinx/CTestConfig.cmake @@ -6,7 +6,9 @@ set(CTEST_PROJECT_NAME "CMake") set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") -set(CTEST_DROP_METHOD "http") +if(NOT CTEST_DROP_METHOD STREQUAL "https") + set(CTEST_DROP_METHOD "http") +endif() set(CTEST_DROP_SITE "open.cdash.org") set(CTEST_DROP_LOCATION "/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) -- cgit v0.12 From ce9dbceb42b6c9170a86c6f05a914b3a72f656c8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 2 Jun 2020 14:32:29 -0400 Subject: QtDialog: remove Qt4-only code The `reset()` method was actually deprecated for 5.0 which means it can now be removed here. --- Source/QtDialog/CMakeSetup.cxx | 8 -------- Source/QtDialog/QCMake.cxx | 4 ---- Source/QtDialog/QCMakeCacheView.cxx | 33 +-------------------------------- Source/QtDialog/QCMakeCacheView.h | 1 - 4 files changed, 1 insertion(+), 45 deletions(-) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 9d928b2..7ef5a72 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -115,14 +115,6 @@ int main(int argc, char** argv) QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8"); QTextCodec::setCodecForLocale(utf8_codec); -#if QT_VERSION < 0x050000 - // clean out standard Qt paths for plugins, which we don't use anyway - // when creating Mac bundles, it potentially causes problems - foreach (QString p, QApplication::libraryPaths()) { - QApplication::removeLibraryPath(p); - } -#endif - // tell the cmake library where cmake is QDir cmExecDir(QApplication::applicationDirPath()); #if defined(Q_OS_MAC) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 776af81..a631404 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -340,11 +340,7 @@ void QCMake::interrupt() bool QCMake::interruptCallback() { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return this->InterruptFlag; -#else return this->InterruptFlag.load(); -#endif } void QCMake::progressCallback(const std::string& msg, float percent) diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 40cc89c..9b8c84b 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -155,11 +155,7 @@ QModelIndex QCMakeCacheView::moveCursor(CursorAction act, void QCMakeCacheView::setShowAdvanced(bool s) { -#if QT_VERSION >= 040300 - // new 4.3 API that needs to be called. what about an older Qt? this->SearchFilter->invalidate(); -#endif - this->AdvancedFilter->setShowAdvanced(s); } @@ -209,9 +205,7 @@ void QCMakeCacheModel::clear() void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) this->beginResetModel(); -#endif QSet newProps; QSet newProps2; @@ -321,11 +315,7 @@ 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 @@ -335,9 +325,7 @@ 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; @@ -354,11 +342,7 @@ 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, @@ -484,8 +468,7 @@ QCMakePropertyList QCMakeCacheModel::properties() const // go to the next in the tree while (!idxs.isEmpty() && ( -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && \ - QT_VERSION < QT_VERSION_CHECK(5, 1, 0) +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) (idxs.last().row() + 1) >= rowCount(idxs.last().parent()) || #endif !idxs.last().sibling(idxs.last().row() + 1, 0).isValid())) { @@ -645,20 +628,6 @@ bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, return success; } -// Issue 205903 fixed in Qt 4.5.0. -// Can remove this function and FileDialogFlag when minimum Qt version is 4.5 -bool QCMakeCacheModelDelegate::eventFilter(QObject* object, QEvent* evt) -{ - // workaround for what looks like a bug in Qt on macOS - // where it doesn't create a QWidget wrapper for the native file dialog - // so the Qt library ends up assuming the focus was lost to something else - - if (evt->type() == QEvent::FocusOut && this->FileDialogFlag) { - return false; - } - return QItemDelegate::eventFilter(object, evt); -} - void QCMakeCacheModelDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index bea1965..a252708 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -144,7 +144,6 @@ public: bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index); - bool eventFilter(QObject* object, QEvent* event); void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const; QSize sizeHint(const QStyleOptionViewItem& option, -- cgit v0.12 From 4037beb7477590569ef5290f34103a7015450fe0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 1 Jun 2020 11:40:01 -0400 Subject: QtDialog: remove Qt4 definition --- Source/QtDialog/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index e1da7c6..e6d6b17 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -16,9 +16,6 @@ if(WIN32) endif() endif() -# Remove this when the minimum version of Qt is 4.6. -add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES) -- cgit v0.12 From 644d3b86ebb4be108172765e96251162e2537344 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 22 May 2020 10:39:52 -0400 Subject: C: Compile when possible with explicit `C` language flag set Issue: #14516, #20716 --- Modules/Compiler/AppleClang-C.cmake | 2 ++ Modules/Compiler/Clang-C.cmake | 2 ++ Modules/Compiler/GNU-C.cmake | 2 ++ Modules/Compiler/Intel-C.cmake | 2 ++ Modules/Compiler/XL-C.cmake | 2 ++ Modules/Compiler/XLClang-C.cmake | 2 ++ 6 files changed, 12 insertions(+) diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index 2794f52..26a4bbd 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -1,6 +1,8 @@ include(Compiler/Clang) __compiler_clang(C) +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index 7c4a263..fb6ffa7 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -8,6 +8,8 @@ endif() if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") +elseif("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) endif() if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index ca286b3..8105a77 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -1,6 +1,8 @@ include(Compiler/GNU) __compiler_gnu(C) +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index ec3bfd8..322f63d 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -28,6 +28,8 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") else() + set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index 2077bda..78c44d5 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -6,6 +6,8 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded") +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -qsourcetype=c) + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89") diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake index 54c18a6..1668a4d 100644 --- a/Modules/Compiler/XLClang-C.cmake +++ b/Modules/Compiler/XLClang-C.cmake @@ -1,6 +1,8 @@ include(Compiler/XLClang) __compiler_xlclang(C) +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") -- cgit v0.12 From 457170a476ca3ff3b5db80360a7fd8202ac31e91 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 22 May 2020 10:40:50 -0400 Subject: CXX: Compile when possible with explicit `Cxx` language flag set Issue: #14516, #20716 --- Modules/Compiler/AppleClang-CXX.cmake | 2 ++ Modules/Compiler/Clang-CXX.cmake | 2 ++ Modules/Compiler/GNU-CXX.cmake | 2 ++ Modules/Compiler/Intel-CXX.cmake | 2 ++ Modules/Compiler/XL-CXX.cmake | 5 ++--- Modules/Compiler/XLClang-CXX.cmake | 2 ++ 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 15edc21..611c674 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -1,6 +1,8 @@ include(Compiler/Clang) __compiler_clang(CXX) +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 789e991..311d2b0 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -2,7 +2,9 @@ include(Compiler/Clang) __compiler_clang(CXX) __compiler_clang_cxx_standards(CXX) + if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index fcaaeab..59ec056 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -1,6 +1,8 @@ include(Compiler/GNU) __compiler_gnu(CXX) +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + if (WIN32) if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 1ed1b08..47d5672 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -37,6 +37,8 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") else() + set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 41e3e11..3b911f3 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -6,6 +6,8 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded") +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -+) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) if(CMAKE_SYSTEM MATCHES "Linux") set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") @@ -32,6 +34,3 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) endif () __compiler_check_default_language_standard(CXX 10.1 98) - -set(CMAKE_CXX_COMPILE_OBJECT - " -+ -o -c ") diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake index 9ea3d7c..02638c7 100644 --- a/Modules/Compiler/XLClang-CXX.cmake +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -1,6 +1,8 @@ include(Compiler/XLClang) __compiler_xlclang(CXX) +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") -- cgit v0.12 From 74b1c9fc8e8b33c8faa9aadf6ce09c15d94ea011 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 1 Jun 2020 13:45:13 -0400 Subject: Explicitly specify language flag when source LANGUAGE property is set Fixes: #14516, #20716 --- Source/cmExtraSublimeTextGenerator.cxx | 7 +++++++ Source/cmGlobalXCodeGenerator.cxx | 8 ++++++++ Source/cmMakefileTargetGenerator.cxx | 7 +++++++ Source/cmNinjaTargetGenerator.cxx | 11 ++++++++++- Tests/SetLang/CMakeLists.txt | 7 +++++++ Tests/SetLang/bar.c | 14 +++++++++++++- Tests/SetLang/zoom.zzz | 7 +++++++ 7 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 Tests/SetLang/zoom.zzz diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 613a943..3e265a0 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -349,6 +349,13 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject( if (language.empty()) { language = "C"; } + + // explicitly add the explicit language flag before any other flag + // this way backwards compatibility with user flags is maintained + if (source->GetProperty("LANGUAGE")) { + lg->AppendFeatureOptions(flags, language, "EXPLICIT_LANGUAGE"); + } + std::string const& config = lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index a5ce5d1..4d589ed 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -819,6 +819,14 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( default: break; } + + // explicitly add the explicit language flag before any other flag + // this way backwards compatibility with user flags is maintained + if (sf->GetProperty("LANGUAGE")) { + this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, + "EXPLICIT_LANGUAGE"); + } + const std::string COMPILE_FLAGS("COMPILE_FLAGS"); if (cmProp cflags = sf->GetProperty(COMPILE_FLAGS)) { lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS)); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 8396fa3..6887569 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -532,6 +532,13 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( // Build the set of compiler flags. std::string flags; + // explicitly add the explicit language flag before any other flag + // this way backwards compatibility with user flags is maintained + if (source.GetProperty("LANGUAGE")) { + this->LocalGenerator->AppendFeatureOptions(flags, lang, + "EXPLICIT_LANGUAGE"); + } + // Add language-specific flags. std::string langFlags = cmStrCat("$(", lang, "_FLAGS", filterArch, ")"); this->LocalGenerator->AppendFlags(flags, langFlags); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d406c99..0c7591a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -188,7 +188,16 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject( } } - std::string flags = this->GetFlags(language, config, filterArch); + std::string flags; + // explicitly add the explicit language flag before any other flag + // this way backwards compatibility with user flags is maintained + if (source->GetProperty("LANGUAGE")) { + this->LocalGenerator->AppendFeatureOptions(flags, language, + "EXPLICIT_LANGUAGE"); + flags += " "; + } + + flags += this->GetFlags(language, config, filterArch); // Add Fortran format flags. if (language == "Fortran") { diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt index f24e5cb..af90f11 100644 --- a/Tests/SetLang/CMakeLists.txt +++ b/Tests/SetLang/CMakeLists.txt @@ -8,3 +8,10 @@ add_executable(SetLang bar.c) set_source_files_properties(foo.c bar.c PROPERTIES LANGUAGE CXX) target_link_libraries(SetLang foo) set_target_properties(SetLang PROPERTIES LINKER_LANGUAGE CXX) + +if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)")) + add_library(zoom zoom.zzz) + set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX) + target_link_libraries(SetLang zoom) + target_compile_definitions(SetLang PRIVATE WITH_ZOOM) +endif() diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c index b934356..515e8c2 100644 --- a/Tests/SetLang/bar.c +++ b/Tests/SetLang/bar.c @@ -1,10 +1,22 @@ #include int foo(); + +#ifdef WITH_ZOOM +int zoom(); +#endif + class A { public: - A() { this->i = foo(); } + A() + { + this->i = foo(); +#ifdef WITH_ZOOM + i += zoom(); + i -= zoom(); +#endif + } int i; }; diff --git a/Tests/SetLang/zoom.zzz b/Tests/SetLang/zoom.zzz new file mode 100644 index 0000000..a0c8899 --- /dev/null +++ b/Tests/SetLang/zoom.zzz @@ -0,0 +1,7 @@ +int zoom() +{ + int r = 10; + r++; + int ret = r + 10; + return ret; +} -- cgit v0.12 From c1b6adaedd687511b751442b714ad48c687b31b2 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 10 Jun 2020 00:01:08 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3ea4922..9357946 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 18) -set(CMake_VERSION_PATCH 20200609) +set(CMake_VERSION_PATCH 20200610) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From a7d44d55aea622dccd80164ed9f616ee77d5aba7 Mon Sep 17 00:00:00 2001 From: Asit Dhal Date: Tue, 9 Jun 2020 07:28:58 +0200 Subject: cmake: remove -E compare_files error message if files differ It is not an error for the files to be different. Fixes: #20803 --- Source/cmcmd.cxx | 2 -- Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt | 1 - .../CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt | 1 - 3 files changed, 4 deletions(-) delete mode 100644 Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt delete mode 100644 Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index de76d73..cbc8e8f 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -586,8 +586,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) } if (filesDiffer) { - std::cerr << "Files \"" << args[args.size() - 2] << "\" to \"" - << args[args.size() - 1] << "\" are different.\n"; return 1; } return 0; diff --git a/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt deleted file mode 100644 index 4729ccb..0000000 --- a/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^Files ".*/compare_files/lf" to ".*/compare_files/crlf" are different.$ diff --git a/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt deleted file mode 100644 index 8a9ca81..0000000 --- a/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^Files "nonexistent_a" to "nonexistent_b" are different.$ -- cgit v0.12 From f6710373cd61412fa6a9d5cc8cf3a585da4cff75 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 11 Jun 2020 00:01:06 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9357946..d856d27 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 18) -set(CMake_VERSION_PATCH 20200610) +set(CMake_VERSION_PATCH 20200611) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 19689d34e6781247cd229b3e0034baabe79b4d0c Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Mon, 1 Jun 2020 15:39:53 +0200 Subject: ccmake: Display an error and interrupt execution if ncurses failed --- Source/CursesDialog/ccmake.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 9a26db5..85e256b 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -2,11 +2,15 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include +#include +#include #include #include #include #include +#include + #include "cmsys/Encoding.hxx" #include "cmCursesColor.h" @@ -54,7 +58,12 @@ void onsig(int /*unused*/) { if (cmCursesForm::CurrentForm) { endwin(); - initscr(); /* Initialization */ + if (initscr() == nullptr) { + static const char errmsg[] = "Error: ncurses initialization failed\n"; + auto r = write(STDERR_FILENO, errmsg, sizeof(errmsg) - 1); + static_cast(r); + exit(1); + } noecho(); /* Echo off */ cbreak(); /* nl- or cr not needed */ keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ @@ -124,7 +133,10 @@ int main(int argc, char const* const* argv) cmCursesForm::DebugStart(); } - initscr(); /* Initialization */ + if (initscr() == nullptr) { + fprintf(stderr, "Error: ncurses initialization failed\n"); + exit(1); + } noecho(); /* Echo off */ cbreak(); /* nl- or cr not needed */ keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ -- cgit v0.12 From b76b4dea1cd60e9899fd641602901ded9e0d7a7b Mon Sep 17 00:00:00 2001 From: correa Date: Wed, 10 Jun 2020 21:38:27 -0400 Subject: FindBoost: Allow Boost::zlib and Boost::bzip2 targets on all platforms When boost is built with `BZIP2_SOURCE` or `ZLIB_SOURCE` it will generate boost versions of these libraries. Since commit cb1a434ce0 (FindBoost: Add check headers for `zlib` and `bzip2`, 2016-07-01, v3.7.0-rc1~400^2) we look for them only on Windows where they are commonly provided, but they may be available on every platform. --- Modules/FindBoost.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 13981d3..82dbcb9 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1270,10 +1270,8 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp") set(_Boost_WAVE_HEADERS "boost/wave.hpp") set(_Boost_WSERIALIZATION_HEADERS "boost/archive/text_wiarchive.hpp") - if(WIN32) - set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") - set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp") - endif() + set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") + set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp") string(TOUPPER ${component} uppercomponent) set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE) -- cgit v0.12 From 931492bd6f71d6a38cbec518c759de7bdb440fdf Mon Sep 17 00:00:00 2001 From: Seth R Johnson Date: Thu, 11 Jun 2020 13:47:47 -0400 Subject: FindHDF5: use CMakeFiles for temporary files --- Modules/FindHDF5.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 60a313d..7a1c252 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -125,8 +125,6 @@ The following variables can be set to guide the search for HDF5 libraries and in Set ``true`` to skip trying to find ``hdf5-config.cmake``. #]=======================================================================] -# This module is maintained by Will Dicharry . - include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) @@ -347,6 +345,7 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var # wrapper exists, but not the compiler. E.g. Miniconda / Anaconda Python execute_process( COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} ${test_file} + WORKING_DIRECTORY ${scratch_dir} RESULT_VARIABLE return_value ) if(return_value) @@ -355,6 +354,7 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var else() execute_process( COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -show ${lib_type_args} ${test_file} + WORKING_DIRECTORY ${scratch_dir} OUTPUT_VARIABLE output ERROR_VARIABLE output RESULT_VARIABLE return_value -- cgit v0.12 From 3bf6d7894a84df1b2b2b5a11e080d422ea176a5a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 12 Jun 2020 00:01:14 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d856d27..20e6f83 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 18) -set(CMake_VERSION_PATCH 20200611) +set(CMake_VERSION_PATCH 20200612) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 6f6651f7288a8ba651a95c46bebf57fc59e6dc16 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Jun 2020 06:01:03 -0400 Subject: Add deprecation warnings for policies CMP0072 and below The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for policies introduced in CMake 3.11 and below to encourage projects to port away from setting policies to OLD. --- Help/release/dev/deprecate-policy-old.rst | 8 ++++++++ Source/cmMakefile.cxx | 2 +- Tests/RunCMake/FindOpenGL/CMP0072-OLD-stderr.txt | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/deprecate-policy-old.rst create mode 100644 Tests/RunCMake/FindOpenGL/CMP0072-OLD-stderr.txt diff --git a/Help/release/dev/deprecate-policy-old.rst b/Help/release/dev/deprecate-policy-old.rst new file mode 100644 index 0000000..f92aea7 --- /dev/null +++ b/Help/release/dev/deprecate-policy-old.rst @@ -0,0 +1,8 @@ +deprecate-policy-old +-------------------- + +* An explicit deprecation diagnostic was added for policy ``CMP0071`` + (``CMP0071`` and below were already deprecated). + The :manual:`cmake-policies(7)` manual explains that the OLD behaviors + of all policies are deprecated and that projects should port to the + NEW behaviors. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c78b751..5c3063b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4554,7 +4554,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, // Deprecate old policies, especially those that require a lot // of code to maintain the old behavior. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0071 && + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0072 && !(this->GetCMakeInstance()->GetIsInTryCompile() && ( // Policies set by cmCoreTryCompile::TryCompileCode. diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stderr.txt b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stderr.txt new file mode 100644 index 0000000..68d23d4 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0072-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0072 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ -- cgit v0.12 From 87c860ebadabb669a570119186aabbd99cad1e5e Mon Sep 17 00:00:00 2001 From: lumberyard-employee-dm Date: Thu, 11 Jun 2020 17:51:19 +0100 Subject: cmake --build: Fix exit code when building multiple targets Updated the cmGlobalGenerator::Build method to check the return `retVal` parameter supplied to the `cmSystemTools::RunSingleCommand` to validate that each invocation of the build command returned an exit code of zero. Fixes: #20790 --- Source/cmGlobalGenerator.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4dc4092..1ed5e8b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1988,8 +1988,9 @@ int cmGlobalGenerator::Build( std::string makeCommandStr; output += "\nRun Build Command(s):"; - for (auto command = makeCommand.begin(); command != makeCommand.end(); - ++command) { + retVal = 0; + for (auto command = makeCommand.begin(); + command != makeCommand.end() && retVal == 0; ++command) { makeCommandStr = command->Printable(); if (command != makeCommand.end()) { makeCommandStr += " && "; -- cgit v0.12 From b9dd072e05cf73969eb6e3306c82c3eaa94cfb9b Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 12 Jun 2020 11:32:29 -0400 Subject: Tests: Add case for cmake --build with a failing target --- .../CommandLine/BuildDir--build-multiple-targets-fail-result.txt | 1 + .../CommandLine/BuildDir--build-multiple-targets-fail-stderr.txt | 1 + Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 2 ++ 4 files changed, 5 insertions(+) create mode 100644 Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-result.txt create mode 100644 Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-stderr.txt diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-fail-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt index d2a2831..cf2c087 100644 --- a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt +++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt @@ -5,3 +5,4 @@ add_custom_command( add_custom_target(CustomTarget ALL DEPENDS output.txt) add_custom_target(CustomTarget2 ALL DEPENDS output.txt) add_custom_target(CustomTarget3 ALL DEPENDS output.txt) +add_custom_target(CustomTargetFail COMMAND DoesNotExist) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 973391d..16fdeef 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -134,6 +134,8 @@ function(run_BuildDir) ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget) run_cmake_command(BuildDir--build-multiple-targets ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build -t CustomTarget2 --target CustomTarget3) + run_cmake_command(BuildDir--build-multiple-targets-fail ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build -t CustomTargetFail --target CustomTarget3) run_cmake_command(BuildDir--build-multiple-targets-jobs ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget CustomTarget2 -j2 --target CustomTarget3) run_cmake_command(BuildDir--build-multiple-targets-with-clean-first ${CMAKE_COMMAND} -E chdir .. -- cgit v0.12 From 9710790a39e2c075eeef06ed529d568385a4f445 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 12 Jun 2020 08:55:47 -0400 Subject: Help/dev: Add maintainer guide step for initial post-release development Document steps for deprecating old policy settings and future-proofing export files generated by `install(EXPORT)`. --- Help/dev/maint.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst index a1c1a6f..9b6774b 100644 --- a/Help/dev/maint.rst +++ b/Help/dev/maint.rst @@ -299,3 +299,28 @@ announcing that post-release development is open:: before staging or merging. .. _`CMake Discourse Forum Development Category`: https://discourse.cmake.org/c/development + +Initial Post-Release Development +-------------------------------- + +Deprecate policies more than 8 release series old by updating the +policy range check in ``cmMakefile::SetPolicy``. +Commit with a message such as:: + + Add deprecation warnings for policies CMP#### and below + + The OLD behaviors of all policies are deprecated, but only by + documentation. Add an explicit deprecation diagnostic for policies + introduced in CMake $OLDVER and below to encourage projects to port + away from setting policies to OLD. + +Update the ``cmake_policy`` version range generated by ``install(EXPORT)`` +in ``cmExportFileGenerator::GeneratePolicyHeaderCode`` to end at the +previous release. We use one release back since we now know all the +policies added for that version. Commit with a message such as:: + + export: Increase maximum policy version in exported files to $prev + + The files generatd by `install(EXPORT)` and `export()` commands + are known to work with policies as of CMake $prev, so enable them + in sufficiently new CMake versions. -- cgit v0.12 From d3fd518c0316b15e4680c32808788935bf8c5c3d Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sun, 14 Jun 2020 18:21:35 +1000 Subject: find_program: Properly decode URL for bundle exe name with spaces Fixes: #20817 --- Source/cmFindProgramCommand.cxx | 13 ++++++------- Tests/RunCMake/find_program/BundleSpaceInName-stdout.txt | 1 + Tests/RunCMake/find_program/BundleSpaceInName.cmake | 8 ++++++++ Tests/RunCMake/find_program/RunCMakeTest.cmake | 4 ++++ 4 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 Tests/RunCMake/find_program/BundleSpaceInName-stdout.txt create mode 100644 Tests/RunCMake/find_program/BundleSpaceInName.cmake diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 599b1d2..d4b0ee1 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -266,14 +266,13 @@ std::string cmFindProgramCommand::GetBundleExecutable( if (executableURL != nullptr) { const int MAX_OSX_PATH_SIZE = 1024; - char buffer[MAX_OSX_PATH_SIZE]; + UInt8 buffer[MAX_OSX_PATH_SIZE]; - // Convert the CFString to a C string - CFStringGetCString(CFURLGetString(executableURL), buffer, - MAX_OSX_PATH_SIZE, kCFStringEncodingUTF8); - - // And finally to a c++ string - executable = bundlePath + "/Contents/MacOS/" + std::string(buffer); + if (CFURLGetFileSystemRepresentation(executableURL, false, buffer, + MAX_OSX_PATH_SIZE)) { + executable = bundlePath + "/Contents/MacOS/" + + std::string(reinterpret_cast(buffer)); + } // Only release CFURLRef if it's not null CFRelease(executableURL); } diff --git a/Tests/RunCMake/find_program/BundleSpaceInName-stdout.txt b/Tests/RunCMake/find_program/BundleSpaceInName-stdout.txt new file mode 100644 index 0000000..331d465 --- /dev/null +++ b/Tests/RunCMake/find_program/BundleSpaceInName-stdout.txt @@ -0,0 +1 @@ +-- FakeApp_EXECUTABLE='.*/Tests/RunCMake/find_program/BundleSpaceInName-build/Fake app.app/Contents/MacOS/Fake app' diff --git a/Tests/RunCMake/find_program/BundleSpaceInName.cmake b/Tests/RunCMake/find_program/BundleSpaceInName.cmake new file mode 100644 index 0000000..9152d5b --- /dev/null +++ b/Tests/RunCMake/find_program/BundleSpaceInName.cmake @@ -0,0 +1,8 @@ +set(fakeApp "${CMAKE_CURRENT_BINARY_DIR}/Fake app.app/Contents/MacOS/Fake app") +file(WRITE "${fakeApp}" "#!/bin/sh\n") +execute_process(COMMAND chmod a+rx "${fakeApp}") + +find_program(FakeApp_EXECUTABLE NAMES "Fake app" NO_DEFAULT_PATH + PATHS "${CMAKE_CURRENT_BINARY_DIR}" +) +message(STATUS "FakeApp_EXECUTABLE='${FakeApp_EXECUTABLE}'") diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 95ffd84..be70deb 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -14,3 +14,7 @@ endif() if(UNIX) run_cmake(ExeNoRead) endif() + +if(APPLE) + run_cmake(BundleSpaceInName) +endif() -- cgit v0.12 From 736fb342945051fb7459b5a28d37f4085b8ba876 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 15 Jun 2020 07:12:49 -0400 Subject: QCMake: use loadRelaxed if available Added in 5.14 and load() was deprecated at the same time. --- Source/QtDialog/QCMake.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index a631404..f0b967b 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -340,7 +340,11 @@ void QCMake::interrupt() bool QCMake::interruptCallback() { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) return this->InterruptFlag.load(); +#else + return this->InterruptFlag.loadRelaxed(); +#endif } void QCMake::progressCallback(const std::string& msg, float percent) -- cgit v0.12 From 0fc181883127f77401ac4b6686c7016ee7752876 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 15 Jun 2020 07:13:23 -0400 Subject: QCMakeWidgets: replace QDirModel --- Source/QtDialog/QCMakeWidgets.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index 332a770..d16ea58 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -4,9 +4,9 @@ #include -#include #include #include +#include #include #include @@ -88,20 +88,20 @@ void QCMakePathEditor::chooseFile() } } -// use same QDirModel for all completers -static QDirModel* fileDirModel() +// use same QFileSystemModel for all completers +static QFileSystemModel* fileDirModel() { - static QDirModel* m = nullptr; + static QFileSystemModel* m = nullptr; if (!m) { - m = new QDirModel(); + m = new QFileSystemModel(); } return m; } -static QDirModel* pathDirModel() +static QFileSystemModel* pathDirModel() { - static QDirModel* m = nullptr; + static QFileSystemModel* m = nullptr; if (!m) { - m = new QDirModel(); + m = new QFileSystemModel(); m->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot); } return m; @@ -110,7 +110,7 @@ static QDirModel* pathDirModel() QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs) : QCompleter(o) { - QDirModel* m = dirs ? pathDirModel() : fileDirModel(); + QFileSystemModel* m = dirs ? pathDirModel() : fileDirModel(); this->setModel(m); } -- cgit v0.12 From 915409af490c253924acbb58ea97c809ff8e631c Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Wed, 3 Jun 2020 02:10:08 +0800 Subject: CPack: Introduce pre- and post- build actions CPack learned the `CPACK_PRE_BUILD_SCRIPTS`, `CPACK_POST_BUILD_SCRIPTS`, and `CPACK_PACKAGE_FILES` variables. The first two are lists of scripts to perform - after pre-install files into a staging directory and before producing the resulting packages - after produsing the packages The post-build script(s) also get the list of actually produced packages in the `CPACK_PACKAGE_FILES`. Issue: #19077 --- .../dev/cpack-pre-and-post-build-scripts.rst | 5 +++ Modules/CPack.cmake | 15 +++++++ Source/CPack/cmCPackGenerator.cxx | 50 +++++++++++++++++++--- Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 + .../tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake | 19 ++++++++ .../PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt | 4 ++ .../PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt | 4 ++ .../CPack/tests/PRE_POST_SCRIPTS/post.cmake | 2 + .../CPack/tests/PRE_POST_SCRIPTS/pre.cmake | 1 + .../CPack/tests/PRE_POST_SCRIPTS/test.cmake | 9 ++++ 10 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/cpack-pre-and-post-build-scripts.rst create mode 100644 Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt create mode 100644 Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt create mode 100644 Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake create mode 100644 Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake create mode 100644 Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake diff --git a/Help/release/dev/cpack-pre-and-post-build-scripts.rst b/Help/release/dev/cpack-pre-and-post-build-scripts.rst new file mode 100644 index 0000000..bf7958b --- /dev/null +++ b/Help/release/dev/cpack-pre-and-post-build-scripts.rst @@ -0,0 +1,5 @@ +cpack-pre-and-post-build-scripts +-------------------------------- + +* CPack learned the :variable:`CPACK_PRE_BUILD_SCRIPTS`, :variable:`CPACK_POST_BUILD_SCRIPTS`, + and :variable:`CPACK_PACKAGE_FILES` variables. diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 6234b9d..553b966 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -386,6 +386,21 @@ The following variables are for advanced uses of CPack: select the CPack generator(s) to be used when building the ``package`` target or when running :manual:`cpack ` without the ``-G`` option. +.. variable:: CPACK_PRE_BUILD_SCRIPTS + + List of CMake scripts to execute after CPack has installed the files to + be packed into a staging directory and before producing the result + packages. + +.. variable:: CPACK_POST_BUILD_SCRIPTS + + List of CMake scripts to execute after CPack has produced the result + packages and before copying them back to a build directory. + +.. variable:: CPACK_PACKAGE_FILES + + List of resulting package files passed to the ``CPACK_POST_BUILD_SCRIPTS``. + #]=======================================================================] # Define this var in order to avoid (or warn) concerning multiple inclusion diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 288dc58..7990504 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -264,6 +264,23 @@ int cmCPackGenerator::InstallProject() return 0; } + // Run pre-build actions + const char* preBuildScripts = this->GetOption("CPACK_PRE_BUILD_SCRIPTS"); + if (preBuildScripts) { + const auto scripts = cmExpandedList(preBuildScripts, false); + for (const auto& script : scripts) { + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "Executing pre-build script: " << script << std::endl); + + if (!this->MakefileMap->ReadListFile(script)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "The pre-build script not found: " << script + << std::endl); + return 0; + } + } + } + if (setDestDir) { cmSystemTools::PutEnv("DESTDIR="); } @@ -333,7 +350,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( if (installDirectoriesVector.size() % 2 != 0) { cmCPackLogger( cmCPackLog::LOG_ERROR, - "CPACK_INSTALLED_DIRECTORIES should contain pairs of and " + "CPACK_INSTALLED_DIRECTORIES should contain pairs of " + "and " ". The can be '.' to be installed in " "the toplevel directory of installation." << std::endl); @@ -475,10 +493,10 @@ int cmCPackGenerator::InstallProjectViaInstallScript( "- Install script: " << installScript << std::endl); if (setDestDir) { - // For DESTDIR based packaging, use the *project* CMAKE_INSTALL_PREFIX - // underneath the tempInstallDirectory. The value of the project's - // CMAKE_INSTALL_PREFIX is sent in here as the value of the - // CPACK_INSTALL_PREFIX variable. + // For DESTDIR based packaging, use the *project* + // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The + // value of the project's CMAKE_INSTALL_PREFIX is sent in here as the + // value of the CPACK_INSTALL_PREFIX variable. std::string dir; if (this->GetOption("CPACK_INSTALL_PREFIX")) { @@ -1076,6 +1094,25 @@ int cmCPackGenerator::DoPackage() return 0; } } + // Run post-build actions + const char* postBuildScripts = this->GetOption("CPACK_POST_BUILD_SCRIPTS"); + if (postBuildScripts) { + this->MakefileMap->AddDefinition("CPACK_PACKAGE_FILES", + cmJoin(this->packageFileNames, ";")); + + const auto scripts = cmExpandedList(postBuildScripts, false); + for (const auto& script : scripts) { + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "Executing post-build script: " << script << std::endl); + + if (!this->MakefileMap->ReadListFile(script)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "The post-build script not found: " << script + << std::endl); + return 0; + } + } + } /* Prepare checksum algorithm*/ const char* algo = this->GetOption("CPACK_PACKAGE_CHECKSUM"); @@ -1378,7 +1415,8 @@ int cmCPackGenerator::PrepareGroupingKind() << std::endl); } - // if user specified packaging method, override the default packaging method + // if user specified packaging method, override the default packaging + // method if (method != UNKNOWN_COMPONENT_PACKAGE_METHOD) { componentPackageMethod = method; } diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 064b4dc..831f430 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -46,3 +46,4 @@ run_cpack_test_subtests( "MONOLITHIC;COMPONENT" ) run_cpack_test(PROJECT_META "RPM.PROJECT_META;DEB.PROJECT_META" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(PRE_POST_SCRIPTS "ZIP" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake new file mode 100644 index 0000000..63a36a3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake @@ -0,0 +1,19 @@ +set(SATU "/satu;/satu/CMakeLists.txt") +set(DUA "/dua;/dua/CMakeLists.txt") + +if(GENERATOR_TYPE STREQUAL ZIP) + set(_ext "zip") +elseif(GENERATOR_TYPE STREQUAL TGZ) + set(_ext "tar.gz") +endif() + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(EXPECTED_FILES_COUNT "2") + set(EXPECTED_FILE_1 "*-satu.${_ext}") + set(EXPECTED_FILE_CONTENT_1_LIST ${SATU}) + set(EXPECTED_FILE_2 "*-dua.${_ext}") + set(EXPECTED_FILE_CONTENT_2_LIST ${DUA}) +else() + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST ${SATU} ${DUA}) +endif() diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt new file mode 100644 index 0000000..319d0da --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt @@ -0,0 +1,4 @@ +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre\.cmake and generator ZIP +.* +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post\.cmake and generator ZIP +-- Built packages: .*/_CPack_Packages/.*/pre_post_scripts-.*-dua.zip;.*/_CPack_Packages/.*/pre_post_scripts-.*-satu.zip diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt new file mode 100644 index 0000000..632c4d1 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt @@ -0,0 +1,4 @@ +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre\.cmake and generator ZIP +.* +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post\.cmake and generator ZIP +-- Built packages: .*/_CPack_Packages/.*/pre_post_scripts-0\.1\.1-.*\.zip diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake new file mode 100644 index 0000000..cf0b149 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake @@ -0,0 +1,2 @@ +message(STATUS "The message from ${CMAKE_CURRENT_LIST_FILE} and generator ${CPACK_GENERATOR}") +message(STATUS "Built packages: ${CPACK_PACKAGE_FILES}") diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake new file mode 100644 index 0000000..b04aa6b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake @@ -0,0 +1 @@ +message(STATUS "The message from ${CMAKE_CURRENT_LIST_FILE} and generator ${CPACK_GENERATOR}") diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake new file mode 100644 index 0000000..f1b6d5f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake @@ -0,0 +1,9 @@ +install(FILES CMakeLists.txt DESTINATION satu COMPONENT satu) +install(FILES CMakeLists.txt DESTINATION dua COMPONENT dua) + +set(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/pre.cmake") +set(CPACK_POST_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/post.cmake") + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL satu dua) +endif() -- cgit v0.12 From 927373b678f8f84a4b41a1f6d4cc4c05322f75f4 Mon Sep 17 00:00:00 2001 From: Gusts Kaksis Date: Fri, 12 Jun 2020 14:56:07 +0300 Subject: Xcode: Refactor generator variable names and types * Instead of `classes` use name `commonSourceFiles`. * No need for reference when you have pointer. --- Source/cmGlobalXCodeGenerator.cxx | 26 +++++++++++++------------- Source/cmGlobalXCodeGenerator.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4d589ed..aac0be5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1152,23 +1152,24 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( } // organize the sources - std::vector classes; - if (!gtgt->GetConfigCommonSourceFiles(classes)) { + std::vector commonSourceFiles; + if (!gtgt->GetConfigCommonSourceFiles(commonSourceFiles)) { return false; } // Add CMakeLists.txt file for user convenience. - this->AddXCodeProjBuildRule(gtgt, classes); + this->AddXCodeProjBuildRule(gtgt, commonSourceFiles); // Add the Info.plist we are about to generate for an App Bundle. if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { std::string plist = this->ComputeInfoPListLocation(gtgt); cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource( plist, true, cmSourceFileLocationKind::Known); - classes.push_back(sf); + commonSourceFiles.push_back(sf); } - std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); + std::sort(commonSourceFiles.begin(), commonSourceFiles.end(), + cmSourceFilePathCompare()); gtgt->ComputeObjectMapping(); @@ -1176,7 +1177,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( std::vector headerFiles; std::vector resourceFiles; std::vector sourceFiles; - for (auto sourceFile : classes) { + for (auto sourceFile : commonSourceFiles) { cmXCodeObject* xsf = this->CreateXCodeSourceFile( this->CurrentLocalGenerator, sourceFile, gtgt); cmXCodeObject* fr = xsf->GetObject("fileRef"); @@ -1275,7 +1276,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( using mapOfVectorOfSourceFiles = std::map>; mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : classes) { + for (auto sourceFile : commonSourceFiles) { cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sourceFile); if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { @@ -1323,7 +1324,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( using mapOfVectorOfSourceFiles = std::map>; mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : classes) { + for (auto sourceFile : commonSourceFiles) { cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sourceFile); if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { @@ -2795,21 +2796,20 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) } // Compute the link library and directory information. - cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); - if (!pcli) { + cmComputeLinkInformation* cli = gt->GetLinkInformation(configName); + if (!cli) { continue; } - cmComputeLinkInformation& cli = *pcli; // Add dependencies directly on library files. - for (auto const& libDep : cli.GetDepends()) { + for (auto const& libDep : cli->GetDepends()) { target->AddDependLibrary(configName, libDep); } // add the library search paths { std::string linkDirs; - for (auto const& libDir : cli.GetDirectories()) { + for (auto const& libDir : cli->GetDirectories()) { if (!libDir.empty() && libDir != "/usr/lib") { // Now add the same one but append // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it: diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index e380f1c..f6fd9c5 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -28,7 +28,7 @@ struct cmDocumentationEntry; /** \class cmGlobalXCodeGenerator * \brief Write a Unix makefiles. * - * cmGlobalXCodeGenerator manages UNIX build process for a tree + * cmGlobalXCodeGenerator manages Xcode build process for a tree */ class cmGlobalXCodeGenerator : public cmGlobalGenerator { -- cgit v0.12 From 0892c798f795c6072ce882552384187db86797f0 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 11 Jun 2020 12:27:46 -0700 Subject: cmMakefile: Change CompileFeatureKnown to take target name instead of target The implementation needs only the target name. --- Source/cmGeneratorExpressionNode.cxx | 2 +- Source/cmMakefile.cxx | 6 +++--- Source/cmMakefile.h | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index e4fb67e..6254c5b 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1708,7 +1708,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode std::string error; std::string lang; if (!context->LG->GetMakefile()->CompileFeatureKnown( - context->HeadTarget->Target, p, lang, &error)) { + context->HeadTarget->Target->GetName(), p, lang, &error)) { reportError(context, content->GetOriginalExpression(), error); return std::string(); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5c3063b..cf84b94 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4673,7 +4673,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, } std::string lang; - if (!this->CompileFeatureKnown(target, feature, lang, error)) { + if (!this->CompileFeatureKnown(target->GetName(), feature, lang, error)) { return false; } @@ -4710,7 +4710,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, return this->AddRequiredTargetCxxFeature(target, feature, lang, error); } -bool cmMakefile::CompileFeatureKnown(cmTarget const* target, +bool cmMakefile::CompileFeatureKnown(const std::string& targetName, const std::string& feature, std::string& lang, std::string* error) const @@ -4747,7 +4747,7 @@ bool cmMakefile::CompileFeatureKnown(cmTarget const* target, e << " unknown feature \"" << feature << "\" for " "target \"" - << target->GetName() << "\"."; + << targetName << "\"."; if (error) { *error = e.str(); } else { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 45d7109..368676f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -928,8 +928,9 @@ public: bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature, std::string* error = nullptr) const; - bool CompileFeatureKnown(cmTarget const* target, const std::string& feature, - std::string& lang, std::string* error) const; + bool CompileFeatureKnown(const std::string& targetName, + const std::string& feature, std::string& lang, + std::string* error) const; const char* CompileFeaturesAvailable(const std::string& lang, std::string* error) const; -- cgit v0.12 From 9d45a8be085490a6c3ce4db27968247297a8bdd2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 10 Jun 2020 10:23:00 -0400 Subject: find_program: Find programs that are executable but not readable This fix was first made by commit 86e6349ef7 (find_program: Find programs that are executable but not readable, 2020-04-04, v3.18.0-rc1~372^2) but was reverted for compatibility. Re-introduce it with a policy for compatibility. Fixes: #10468 --- Help/manual/cmake-policies.7.rst | 8 ++++ Help/policy/CMP0109.rst | 22 ++++++++++ Help/release/dev/find_program-exe-no-read.rst | 5 +++ Source/cmFindProgramCommand.cxx | 48 +++++++++++++++++++++- Source/cmPolicies.h | 5 ++- Tests/RunCMake/find_program/CMP0109-Common.cmake | 7 ++++ Tests/RunCMake/find_program/CMP0109-NEW-stdout.txt | 2 + Tests/RunCMake/find_program/CMP0109-NEW.cmake | 2 + Tests/RunCMake/find_program/CMP0109-OLD-stdout.txt | 2 + Tests/RunCMake/find_program/CMP0109-OLD.cmake | 2 + .../RunCMake/find_program/CMP0109-WARN-stderr.txt | 29 +++++++++++++ .../RunCMake/find_program/CMP0109-WARN-stdout.txt | 2 + Tests/RunCMake/find_program/CMP0109-WARN.cmake | 1 + Tests/RunCMake/find_program/ExeNoRead-stdout.txt | 1 - Tests/RunCMake/find_program/ExeNoRead.cmake | 4 -- Tests/RunCMake/find_program/RunCMakeTest.cmake | 4 +- 16 files changed, 136 insertions(+), 8 deletions(-) create mode 100644 Help/policy/CMP0109.rst create mode 100644 Help/release/dev/find_program-exe-no-read.rst create mode 100644 Tests/RunCMake/find_program/CMP0109-Common.cmake create mode 100644 Tests/RunCMake/find_program/CMP0109-NEW-stdout.txt create mode 100644 Tests/RunCMake/find_program/CMP0109-NEW.cmake create mode 100644 Tests/RunCMake/find_program/CMP0109-OLD-stdout.txt create mode 100644 Tests/RunCMake/find_program/CMP0109-OLD.cmake create mode 100644 Tests/RunCMake/find_program/CMP0109-WARN-stderr.txt create mode 100644 Tests/RunCMake/find_program/CMP0109-WARN-stdout.txt create mode 100644 Tests/RunCMake/find_program/CMP0109-WARN.cmake delete mode 100644 Tests/RunCMake/find_program/ExeNoRead-stdout.txt delete mode 100644 Tests/RunCMake/find_program/ExeNoRead.cmake diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index e98038a..3ceb1df 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,14 @@ Policies Introduced by CMake 3.18 .. toctree:: :maxdepth: 1 + CMP0109: find_program() requires permission to execute but not to read. + +Policies Introduced by CMake 3.18 +================================= + +.. toctree:: + :maxdepth: 1 + CMP0108: A target cannot link to itself through an alias. CMP0107: An ALIAS target cannot overwrite another target. CMP0106: The Documentation module is removed. diff --git a/Help/policy/CMP0109.rst b/Help/policy/CMP0109.rst new file mode 100644 index 0000000..7542c8f --- /dev/null +++ b/Help/policy/CMP0109.rst @@ -0,0 +1,22 @@ +CMP0109 +------- + +:command:`find_program` requires permission to execute but not to read. + +In CMake 3.18 and below, the :command:`find_program` command on UNIX +would find files that are readable without requiring execute permission, +and would not find files that are executable without read permission. +In CMake 3.19 and above, ``find_program`` now prefers to require execute +permission but not read permission. This policy provides compatibility +with projects that have not been updated to expect the new behavior. + +The ``OLD`` behavior for this policy is for ``find_program`` to require +read permission but not execute permission. +The ``NEW`` behavior for this policy is for ``find_program`` to require +execute permission but not read permission. + +This policy was introduced in CMake version 3.19. CMake version |release| +warns when the policy is not set and uses ``OLD`` behavior. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/find_program-exe-no-read.rst b/Help/release/dev/find_program-exe-no-read.rst new file mode 100644 index 0000000..161b5db --- /dev/null +++ b/Help/release/dev/find_program-exe-no-read.rst @@ -0,0 +1,5 @@ +find_program-exe-no-read +------------------------ + +* The :command:`find_program` command now requires permission to execute + but not to read the file found. See policy :policy:`CMP0109`. diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 4f3fcdd..77728ec 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -4,6 +4,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -19,6 +20,7 @@ struct cmFindProgramHelper cmFindProgramHelper(cmMakefile* makefile, cmFindBase const* base) : DebugSearches("find_program", base) , Makefile(makefile) + , PolicyCMP0109(makefile->GetPolicyStatus(cmPolicies::CMP0109)) { #if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) // Consider platform-specific extensions. @@ -48,6 +50,8 @@ struct cmFindProgramHelper cmFindBaseDebugState DebugSearches; cmMakefile* Makefile; + cmPolicies::PolicyStatus PolicyCMP0109; + void AddName(std::string const& name) { this->Names.push_back(name); } void SetName(std::string const& name) { @@ -85,7 +89,7 @@ struct cmFindProgramHelper this->TestNameExt = cmStrCat(name, ext); this->TestPath = cmSystemTools::CollapseFullPath(this->TestNameExt, path); - bool exists = cmSystemTools::FileExists(this->TestPath, true); + bool exists = this->FileIsExecutable(this->TestPath); exists ? this->DebugSearches.FoundAt(this->TestPath) : this->DebugSearches.FailedAt(this->TestPath); if (exists) { @@ -95,6 +99,48 @@ struct cmFindProgramHelper } return false; } + bool FileIsExecutable(std::string const& file) const + { + switch (this->PolicyCMP0109) { + case cmPolicies::OLD: + return cmSystemTools::FileExists(file, true); + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + return cmSystemTools::FileIsExecutable(file); + default: + break; + } + bool const isExeOld = cmSystemTools::FileExists(file, true); + bool const isExeNew = cmSystemTools::FileIsExecutable(file); + if (isExeNew == isExeOld) { + return isExeNew; + } + if (isExeNew) { + this->Makefile->IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0109), + "\n" + "The file\n" + " ", + file, + "\n" + "is executable but not readable. " + "CMake is ignoring it for compatibility.")); + } else { + this->Makefile->IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0109), + "\n" + "The file\n" + " ", + file, + "\n" + "is readable but not executable. " + "CMake is using it for compatibility.")); + } + return isExeOld; + } }; cmFindProgramCommand::cmFindProgramCommand(cmExecutionStatus& status) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a82f421..49dadc7 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -320,7 +320,10 @@ class cmMakefile; 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) + 3, 18, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0109, \ + "find_program() requires permission to execute but not to read.", 3, \ + 19, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Tests/RunCMake/find_program/CMP0109-Common.cmake b/Tests/RunCMake/find_program/CMP0109-Common.cmake new file mode 100644 index 0000000..525413a --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-Common.cmake @@ -0,0 +1,7 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ExeNoRead" "#!/bin/sh\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ReadNoExe" "#ReadNoExe") +execute_process(COMMAND chmod -r+x "${CMAKE_CURRENT_BINARY_DIR}/ExeNoRead") +find_program(ExeNoRead_EXECUTABLE NAMES ExeNoRead NO_DEFAULT_PATH PATHS "${CMAKE_CURRENT_BINARY_DIR}") +message(STATUS "ExeNoRead_EXECUTABLE='${ExeNoRead_EXECUTABLE}'") +find_program(ReadNoExe_EXECUTABLE NAMES ReadNoExe NO_DEFAULT_PATH PATHS "${CMAKE_CURRENT_BINARY_DIR}") +message(STATUS "ReadNoExe_EXECUTABLE='${ReadNoExe_EXECUTABLE}'") diff --git a/Tests/RunCMake/find_program/CMP0109-NEW-stdout.txt b/Tests/RunCMake/find_program/CMP0109-NEW-stdout.txt new file mode 100644 index 0000000..2744463 --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-NEW-stdout.txt @@ -0,0 +1,2 @@ +-- ExeNoRead_EXECUTABLE='.*/Tests/RunCMake/find_program/CMP0109-NEW-build/ExeNoRead' +-- ReadNoExe_EXECUTABLE='ReadNoExe_EXECUTABLE-NOTFOUND' diff --git a/Tests/RunCMake/find_program/CMP0109-NEW.cmake b/Tests/RunCMake/find_program/CMP0109-NEW.cmake new file mode 100644 index 0000000..b4a4033 --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0109 NEW) +include(CMP0109-Common.cmake) diff --git a/Tests/RunCMake/find_program/CMP0109-OLD-stdout.txt b/Tests/RunCMake/find_program/CMP0109-OLD-stdout.txt new file mode 100644 index 0000000..1a0e2a8 --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-OLD-stdout.txt @@ -0,0 +1,2 @@ +-- ExeNoRead_EXECUTABLE='ExeNoRead_EXECUTABLE-NOTFOUND' +-- ReadNoExe_EXECUTABLE='.*/Tests/RunCMake/find_program/CMP0109-OLD-build/ReadNoExe' diff --git a/Tests/RunCMake/find_program/CMP0109-OLD.cmake b/Tests/RunCMake/find_program/CMP0109-OLD.cmake new file mode 100644 index 0000000..8260161 --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0109 OLD) +include(CMP0109-Common.cmake) diff --git a/Tests/RunCMake/find_program/CMP0109-WARN-stderr.txt b/Tests/RunCMake/find_program/CMP0109-WARN-stderr.txt new file mode 100644 index 0000000..202fc6d --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-WARN-stderr.txt @@ -0,0 +1,29 @@ +^CMake Warning \(dev\) at CMP0109-Common.cmake:4 \(find_program\): + Policy CMP0109 is not set: find_program\(\) requires permission to execute + but not to read. Run "cmake --help-policy CMP0109" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + The file + + .*/Tests/RunCMake/find_program/CMP0109-WARN-build/ExeNoRead + + is executable but not readable. CMake is ignoring it for compatibility. +Call Stack \(most recent call first\): + CMP0109-WARN.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0109-Common.cmake:6 \(find_program\): + Policy CMP0109 is not set: find_program\(\) requires permission to execute + but not to read. Run "cmake --help-policy CMP0109" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + The file + + .*/Tests/RunCMake/find_program/CMP0109-WARN-build/ReadNoExe + + is readable but not executable. CMake is using it for compatibility. +Call Stack \(most recent call first\): + CMP0109-WARN.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/find_program/CMP0109-WARN-stdout.txt b/Tests/RunCMake/find_program/CMP0109-WARN-stdout.txt new file mode 100644 index 0000000..baf560f --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-WARN-stdout.txt @@ -0,0 +1,2 @@ +-- ExeNoRead_EXECUTABLE='ExeNoRead_EXECUTABLE-NOTFOUND' +-- ReadNoExe_EXECUTABLE='.*/Tests/RunCMake/find_program/CMP0109-WARN-build/ReadNoExe' diff --git a/Tests/RunCMake/find_program/CMP0109-WARN.cmake b/Tests/RunCMake/find_program/CMP0109-WARN.cmake new file mode 100644 index 0000000..a3d59af --- /dev/null +++ b/Tests/RunCMake/find_program/CMP0109-WARN.cmake @@ -0,0 +1 @@ +include(CMP0109-Common.cmake) diff --git a/Tests/RunCMake/find_program/ExeNoRead-stdout.txt b/Tests/RunCMake/find_program/ExeNoRead-stdout.txt deleted file mode 100644 index f231178..0000000 --- a/Tests/RunCMake/find_program/ExeNoRead-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- ExeNoRead_EXECUTABLE='ExeNoRead_EXECUTABLE-NOTFOUND' diff --git a/Tests/RunCMake/find_program/ExeNoRead.cmake b/Tests/RunCMake/find_program/ExeNoRead.cmake deleted file mode 100644 index 7e22dc5..0000000 --- a/Tests/RunCMake/find_program/ExeNoRead.cmake +++ /dev/null @@ -1,4 +0,0 @@ -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ExeNoRead" "#!/bin/sh\n") -execute_process(COMMAND chmod -r+x "${CMAKE_CURRENT_BINARY_DIR}/ExeNoRead") -find_program(ExeNoRead_EXECUTABLE NAMES ExeNoRead NO_DEFAULT_PATH PATHS "${CMAKE_CURRENT_BINARY_DIR}") -message(STATUS "ExeNoRead_EXECUTABLE='${ExeNoRead_EXECUTABLE}'") diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 0a732ee..3e23920 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -17,7 +17,9 @@ else() OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT "${uid}" STREQUAL "0") - run_cmake(ExeNoRead) + run_cmake(CMP0109-WARN) + run_cmake(CMP0109-OLD) + run_cmake(CMP0109-NEW) endif() endif() -- cgit v0.12 From b5b60755228e3b1489d5cd43622c08d0d8d77bc9 Mon Sep 17 00:00:00 2001 From: Asit Dhal Date: Fri, 12 Jun 2020 04:59:32 +0200 Subject: cmake: add dedicated error for -E compare_files invalid arguments Return 2 when user provides invalid arguments Fixes: #20815 --- Help/manual/cmake.1.rst | 3 ++- Source/cmcmd.cxx | 2 +- .../RunCMake/CommandLine/E_compare_files-invalid-arguments-result.txt | 1 + .../RunCMake/CommandLine/E_compare_files-invalid-arguments-stderr.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-stderr.txt diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 9becfc6..e4c662e 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -566,7 +566,8 @@ Available commands are: ``compare_files [--ignore-eol] `` Check if ```` is same as ````. If files are the same, - then returns ``0``, if not it returns ``1``. The ``--ignore-eol`` option + then returns ``0``, if not it returns ``1``. In case of invalid + arguments, it retruns 2. The ``--ignore-eol`` option implies line-wise comparison and ignores LF/CRLF differences. ``copy ... `` diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index cbc8e8f..6882fdd 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -582,7 +582,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) filesDiffer = cmsys::SystemTools::TextFilesDiffer(args[3], args[4]); } else { ::CMakeCommandUsage(args[0].c_str()); - return 1; + return 2; } if (filesDiffer) { diff --git a/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-result.txt b/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-result.txt new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-result.txt @@ -0,0 +1 @@ +2 diff --git a/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-invalid-arguments-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 16fdeef..f291f15 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -22,6 +22,7 @@ run_cmake_command(E_compare_files-different-eol ${CMAKE_COMMAND} -E compare_file run_cmake_command(E_compare_files-ignore-eol-same ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf) run_cmake_command(E_compare_files-ignore-eol-empty ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/empty1 ${RunCMake_SOURCE_DIR}/compare_files/empty2) run_cmake_command(E_compare_files-ignore-eol-nonexistent ${CMAKE_COMMAND} -E compare_files --ignore-eol nonexistent_a nonexistent_b) +run_cmake_command(E_compare_files-invalid-arguments ${CMAKE_COMMAND} -E compare_files file1.txt file2.txt file3.txt) run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) run_cmake_command(E_server-arg ${CMAKE_COMMAND} -E server --extra-arg) -- cgit v0.12 From 3211e07dc6f2b52570f7b9e1034a2e0394c83862 Mon Sep 17 00:00:00 2001 From: Paymon MARANDI Date: Sun, 14 Jun 2020 14:37:54 -0400 Subject: FindCurses: Detect and satisfy dependency on tinfo for nodelay Extend the change from commit 1f646c6ce0 (FindCurses: Detect and satisfy ncurses dependency on tinfo, 2014-01-17, v3.0.0-rc5~6^2) to handle `nodelay` too. --- Modules/FindCurses.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index ba56078..cde3a4d 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -156,7 +156,9 @@ if(CURSES_USE_NCURSES) CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" cbreak "" CURSES_NCURSES_HAS_CBREAK) - if(NOT CURSES_NCURSES_HAS_CBREAK) + CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" + nodelay "" CURSES_NCURSES_HAS_NODELAY) + if(NOT CURSES_NCURSES_HAS_CBREAK OR NOT CURSES_NCURSES_HAS_NODELAY) find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}") find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" ) -- cgit v0.12 From 7787c6f7c0b7f5f2cd8f63f8a521b3005a43923b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 16 Jun 2020 06:08:44 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 20e6f83..b835f81 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 18) -set(CMake_VERSION_PATCH 20200612) +set(CMake_VERSION_PATCH 20200616) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From d880d2805f9e25b3b391be1056d45694c71ef17f Mon Sep 17 00:00:00 2001 From: evatux Date: Tue, 16 Jun 2020 09:50:20 -0700 Subject: FindBLAS: Extend search directories for MKL Even though Intel MKL typically puts the libraries under `$MKLROOT/lib/$arch_$os` some installations may still use `$MKLROOT/lib/$arch/` path. Ideally, `$arch` should be a symlink to `$arch_$os`, but sometimes the opposite happens (for instance, see Intel MKL distribution in Arch Linux [1]), and sometimes only `$arch` directory alone is present. This patch extends the search list with `$MKLROOT/lib/$arch` with lower priority than `$MKLROOT/lib/$arch_$os`, as the latter is the official path to Intel MKL libraries. It is also worth mentioning that Intel MKL Link Line Adviser [2] recommends using `$MKLROOT/lib/$arch` directory in a link line: ``` -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl ``` [1] https://www.archlinux.org/packages/community/x86_64/intel-mkl/files/ [2] https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-link-line-advisor.html --- Modules/FindBLAS.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 4c569b3..c5d791e 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -483,7 +483,9 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") endif() set(BLAS_mkl_LIB_PATH_SUFFIXES "compiler/lib" "compiler/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}" + "compiler/lib/${BLAS_mkl_ARCH_NAME}" "mkl/lib" "mkl/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}" + "mkl/lib/${BLAS_mkl_ARCH_NAME}" "lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}") foreach(IT ${BLAS_SEARCH_LIBS}) -- cgit v0.12 From 8d5a07ce761a80aec54bfd84aaf5d3317f53bcd1 Mon Sep 17 00:00:00 2001 From: evatux Date: Tue, 16 Jun 2020 10:23:45 -0700 Subject: FindLAPACK: Extend search directories for MKL Even though Intel MKL typically puts the libraries under `$MKLROOT/lib/$arch_$os` some installations may still use `$MKLROOT/lib/$arch/` path. Ideally, `$arch` should be a symlink to `$arch_$os`, but sometimes the opposite happens (for instance, see Intel MKL distribution in Arch Linux [1]), and sometimes only `$arch` directory alone is present. This patch extends the search list with `$MKLROOT/lib/$arch` with lower priority than `$MKLROOT/lib/$arch_$os`, as the latter is the official path to Intel MKL libraries. It is also worth mentioning that Intel MKL Link Line Adviser [2] recommends using `$MKLROOT/lib/$arch` directory in a link line: ``` -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl ``` [1] https://www.archlinux.org/packages/community/x86_64/intel-mkl/files/ [2] https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-link-line-advisor.html --- Modules/FindLAPACK.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index e275946..a18cec4 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -289,7 +289,9 @@ if(BLAS_FOUND) endif() set(LAPACK_mkl_LIB_PATH_SUFFIXES "compiler/lib" "compiler/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}" + "compiler/lib/${LAPACK_mkl_ARCH_NAME}" "mkl/lib" "mkl/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}" + "mkl/lib/${LAPACK_mkl_ARCH_NAME}" "lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}") # First try empty lapack libs -- cgit v0.12 From 0fdfd6bf37146e1b09e410ff5f729f9ea8d3ac1a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 16 Jun 2020 15:38:57 -0400 Subject: Tutorial: Install correctly when built statically When built statically we failed to install the SqrtLibrary --- Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt | 6 +++++- Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt | 6 +++++- Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt | 6 +++++- Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt | 6 +++++- Help/guide/tutorial/index.rst | 6 +++--- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt index c911625..a47d5e0 100644 --- a/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt @@ -57,7 +57,11 @@ set_property(TARGET MathFunctions PROPERTY VERSION "1.0.0") set_property(TARGET MathFunctions PROPERTY SOVERSION "1") # install rules -install(TARGETS MathFunctions tutorial_compiler_flags +set(installable_libs MathFunctions tutorial_compiler_flags) +if(TARGET SqrtLibrary) + list(APPEND installable_libs SqrtLibrary) +endif() +install(TARGETS ${installable_libs} DESTINATION lib EXPORT MathFunctionsTargets) install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt index e0c0621..0bfe20c 100644 --- a/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt @@ -47,5 +47,9 @@ endif() target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") # install rules -install(TARGETS MathFunctions DESTINATION lib) +set(installable_libs MathFunctions) +if(TARGET SqrtLibrary) + list(APPEND installable_libs SqrtLibrary) +endif() +install(TARGETS ${installable_libs} DESTINATION lib) install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt index 32f5e08..0d287ca 100644 --- a/Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step11/MathFunctions/CMakeLists.txt @@ -51,5 +51,9 @@ target_link_libraries(MathFunctions PUBLIC tutorial_compiler_flags) target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") # install rules -install(TARGETS MathFunctions DESTINATION lib) +set(installable_libs MathFunctions tutorial_compiler_flags) +if(TARGET SqrtLibrary) + list(APPEND installable_libs SqrtLibrary) +endif() +install(TARGETS ${installable_libs} DESTINATION lib) install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt index 720ee64..ea3861c 100644 --- a/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt @@ -53,7 +53,11 @@ target_link_libraries(MathFunctions PUBLIC tutorial_compiler_flags) target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") # install rules -install(TARGETS MathFunctions tutorial_compiler_flags +set(installable_libs MathFunctions tutorial_compiler_flags) +if(TARGET SqrtLibrary) + list(APPEND installable_libs SqrtLibrary) +endif() +install(TARGETS ${installable_libs} DESTINATION lib EXPORT MathFunctionsTargets) install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst index 6e26de9..36dfbce 100644 --- a/Help/guide/tutorial/index.rst +++ b/Help/guide/tutorial/index.rst @@ -675,9 +675,9 @@ The first step is to update the starting section of the top-level Now that we have made MathFunctions always be used, we will need to update the logic of that library. So, in ``MathFunctions/CMakeLists.txt`` we need to -create a SqrtLibrary that will conditionally be built when ``USE_MYMATH`` is -enabled. Now, since this is a tutorial, we are going to explicitly require -that SqrtLibrary is built statically. +create a SqrtLibrary that will conditionally be built and installed when +``USE_MYMATH`` is enabled. Now, since this is a tutorial, we are going to +explicitly require that SqrtLibrary is built statically. The end result is that ``MathFunctions/CMakeLists.txt`` should look like: -- cgit v0.12 From 7c3204fc7d6c2445d7eee3241b24d741a96e271d Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 16 Jun 2020 15:43:32 -0400 Subject: Tutorial: Correct Step9 wording on some platforms -fPIC is implicit so you won't get an error --- Help/guide/tutorial/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst index 6e26de9..eb81ee5 100644 --- a/Help/guide/tutorial/index.rst +++ b/Help/guide/tutorial/index.rst @@ -703,7 +703,7 @@ Finally, update ``MathFunctions/MathFunctions.h`` to use dll export defines: .. literalinclude:: Step10/MathFunctions/MathFunctions.h :language: c++ -At this point, if you build everything, you will notice that linking fails +At this point, if you build everything, you may notice that linking fails as we are combining a static library without position independent code with a library that has position independent code. The solution to this is to explicitly set the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property of -- cgit v0.12 From 742ff97f809410055b22405a6b5728e72c458683 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 11 Jun 2020 13:06:02 -0700 Subject: Refactor language standard computation Instead of mutating the configure-time cmTarget's properties at generate time, compute and store it in a cmGeneratorTarget field. --- Source/cmGeneratorExpressionNode.cxx | 4 +- Source/cmGeneratorTarget.cxx | 97 ++++++++++++++++- Source/cmGeneratorTarget.h | 17 +++ Source/cmGlobalGenerator.cxx | 10 +- Source/cmLocalGenerator.cxx | 52 ++-------- Source/cmLocalGenerator.h | 3 +- Source/cmMakefile.cxx | 195 +++++++++++++++++++++++++++-------- Source/cmMakefile.h | 54 ++++++++-- 8 files changed, 330 insertions(+), 102 deletions(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 6254c5b..3e0c21c 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1742,9 +1742,9 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode continue; } if (!context->LG->GetMakefile()->HaveStandardAvailable( - target->Target, lit.first, it)) { + target, lit.first, context->Config, it)) { if (evalLL) { - cmProp l = target->GetProperty(lit.first + "_STANDARD"); + cmProp l = target->GetLanguageStandard(lit.first, context->Config); if (!l) { l = standardDefault; } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f2011ee..1f66a9f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -947,6 +947,45 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const return it != this->ExplicitObjectName.end(); } +cmProp cmGeneratorTarget::GetLanguageStandard(std::string const& lang, + std::string const& config) const +{ + std::string key = cmStrCat(cmSystemTools::UpperCase(config), '-', lang); + auto langStandardIter = this->LanguageStandardMap.find(key); + if (langStandardIter != this->LanguageStandardMap.end()) { + return &langStandardIter->second; + } + + return this->Target->GetProperty(cmStrCat(lang, "_STANDARD")); +} + +cmProp cmGeneratorTarget::GetLanguageStandardProperty(std::string const& lang, + const char* suffix) const +{ + cmProp propertyValue = this->Target->GetProperty(cmStrCat(lang, suffix)); + if (propertyValue == nullptr) { + // Check if we should use the value set by another language. + if (lang == "OBJC") { + propertyValue = this->GetLanguageStandardProperty("C", suffix); + } else if (lang == "OBJCXX" || lang == "CUDA") { + propertyValue = this->GetLanguageStandardProperty("CXX", suffix); + } + } + return propertyValue; +} + +cmProp cmGeneratorTarget::GetLanguageExtensions(std::string const& lang) const +{ + return this->GetLanguageStandardProperty(lang, "_EXTENSIONS"); +} + +bool cmGeneratorTarget::GetLanguageStandardRequired( + std::string const& lang) const +{ + cmProp p = this->GetLanguageStandardProperty(lang, "_STANDARD_REQUIRED"); + return p && cmIsOn(*p); +} + void cmGeneratorTarget::GetModuleDefinitionSources( std::vector& data, const std::string& config) const { @@ -4408,12 +4447,68 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config) const { + // Compute the language standard based on the compile features. std::vector> features = this->GetCompileFeatures(config); for (BT const& f : features) { - if (!this->Makefile->AddRequiredTargetFeature(this->Target, f.Value)) { + std::string lang; + if (!this->Makefile->CompileFeatureKnown(this->Target->GetName(), f.Value, + lang, nullptr)) { return false; } + + std::string key = cmStrCat(cmSystemTools::UpperCase(config), '-', lang); + cmProp currentLanguageStandard = this->GetLanguageStandard(lang, config); + + std::string newRequiredStandard; + if (!this->Makefile->GetNewRequiredStandard( + this->Target->GetName(), f.Value, currentLanguageStandard, + newRequiredStandard)) { + return false; + } + + if (!newRequiredStandard.empty()) { + this->LanguageStandardMap[key] = newRequiredStandard; + } } + + return true; +} + +bool cmGeneratorTarget::ComputeCompileFeatures( + std::string const& config, std::set const& languagePairs) const +{ + for (const auto& language : languagePairs) { + cmProp generatorTargetLanguageStandard = + this->GetLanguageStandard(language.first, config); + if (!generatorTargetLanguageStandard) { + // If the standard isn't explicitly set we copy it over from the + // specified paired language. + std::string key = + cmStrCat(cmSystemTools::UpperCase(config), '-', language.first); + cmProp standardToCopy = + this->GetLanguageStandard(language.second, config); + if (standardToCopy != nullptr) { + this->LanguageStandardMap[key] = *standardToCopy; + generatorTargetLanguageStandard = &this->LanguageStandardMap[key]; + } else { + cmProp defaultStandard = this->Makefile->GetDef( + cmStrCat("CMAKE_", language.second, "_STANDARD_DEFAULT")); + if (defaultStandard != nullptr) { + this->LanguageStandardMap[key] = *defaultStandard; + generatorTargetLanguageStandard = &this->LanguageStandardMap[key]; + } + } + + // Custom updates for the CUDA standard. + if (generatorTargetLanguageStandard != nullptr && + language.first == "CUDA") { + if (*generatorTargetLanguageStandard == "98") { + this->LanguageStandardMap[key] = "03"; + } + } + } + } + return true; } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 3aedbf5..a71e64c 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -148,6 +148,13 @@ public: bool HasExplicitObjectName(cmSourceFile const* file) const; void AddExplicitObjectName(cmSourceFile const* sf); + cmProp GetLanguageStandard(std::string const& lang, + std::string const& config) const; + + cmProp GetLanguageExtensions(std::string const& lang) const; + + bool GetLanguageStandardRequired(std::string const& lang) const; + void GetModuleDefinitionSources(std::vector&, const std::string& config) const; void GetExternalObjects(std::vector&, @@ -515,6 +522,11 @@ public: bool ComputeCompileFeatures(std::string const& config) const; + using LanguagePair = std::pair; + bool ComputeCompileFeatures( + std::string const& config, + std::set const& languagePairs) const; + /** * Trace through the source files in this target and add al source files * that they depend on, used by all generators @@ -1038,6 +1050,11 @@ private: bool GetRPATH(const std::string& config, const std::string& prop, std::string& rpath) const; + mutable std::map LanguageStandardMap; + + cmProp GetLanguageStandardProperty(std::string const& lang, + const char* suffix) const; + public: const std::vector& GetLinkImplementationClosure( const std::string& config) const; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1ed5e8b..4b4ffda 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1442,12 +1442,10 @@ bool cmGlobalGenerator::Compute() localGen->AddHelperCommands(); } - // Finalize the set of compile features for each target. - // FIXME: This turns into calls to cmMakefile::AddRequiredTargetFeature - // which actually modifies the _STANDARD target property - // on the original cmTarget instance. It accumulates features - // across all configurations. Some refactoring is needed to - // compute a per-config resulta purely during generation. + // Perform up-front computation in order to handle errors (such as unknown + // features) at this point. While processing the compile features we also + // calculate and cache the language standard required by the compile + // features. for (const auto& localGen : this->LocalGenerators) { if (!localGen->ComputeTargetCompileFeatures()) { return false; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f748822..5c09208 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -803,39 +803,8 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures() // Now that C/C++ _STANDARD values have been computed // set the values to ObjC/ObjCXX _STANDARD variables if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { - auto copyStandardToObjLang = [&](LanguagePair const& lang) -> bool { - if (!target->GetProperty(cmStrCat(lang.first, "_STANDARD"))) { - cmProp standard = - target->GetProperty(cmStrCat(lang.second, "_STANDARD")); - if (!standard) { - standard = this->Makefile->GetDef( - cmStrCat("CMAKE_", lang.second, "_STANDARD_DEFAULT")); - } - target->Target->SetProperty(cmStrCat(lang.first, "_STANDARD"), - standard ? standard->c_str() : nullptr); - return true; - } - return false; - }; - auto copyPropertyToObjLang = [&](LanguagePair const& lang, - const char* property) { - if (!target->GetProperty(cmStrCat(lang.first, property)) && - target->GetProperty(cmStrCat(lang.second, property))) { - cmProp p = target->GetProperty(cmStrCat(lang.second, property)); - target->Target->SetProperty(cmStrCat(lang.first, property), - p ? p->c_str() : nullptr); - } - }; - for (auto const& lang : pairedLanguages) { - if (copyStandardToObjLang(lang)) { - copyPropertyToObjLang(lang, "_STANDARD_REQUIRED"); - copyPropertyToObjLang(lang, "_EXTENSIONS"); - } - } - if (cmProp standard = target->GetProperty("CUDA_STANDARD")) { - if (*standard == "98") { - target->Target->SetProperty("CUDA_STANDARD", "03"); - } + for (std::string const& c : configNames) { + target->ComputeCompileFeatures(c, inferredEnabledLanguages); } } } @@ -1026,7 +995,7 @@ void cmLocalGenerator::AddCompileOptions(std::vector>& flags, } for (auto const& it : target->GetMaxLanguageStandards()) { - cmProp standard = target->GetProperty(it.first + "_STANDARD"); + cmProp standard = target->GetLanguageStandard(it.first, config); if (!standard) { continue; } @@ -1050,7 +1019,7 @@ void cmLocalGenerator::AddCompileOptions(std::vector>& flags, } std::string compReqFlag; - this->AddCompilerRequirementFlag(compReqFlag, target, lang); + this->AddCompilerRequirementFlag(compReqFlag, target, lang, config); if (!compReqFlag.empty()) { flags.emplace_back(std::move(compReqFlag)); } @@ -2045,7 +2014,7 @@ void cmLocalGenerator::AddLanguageFlagsForLinking( // when linking in order to use the matching standard library. // FIXME: If CMake gains an abstraction for standard library // selection, this will have to be reconciled with it. - this->AddCompilerRequirementFlag(flags, target, lang); + this->AddCompilerRequirementFlag(flags, target, lang, config); } this->AddLanguageFlags(flags, target, lang, config); @@ -2188,7 +2157,8 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, } void cmLocalGenerator::AddCompilerRequirementFlag( - std::string& flags, cmGeneratorTarget const* target, const std::string& lang) + std::string& flags, cmGeneratorTarget const* target, const std::string& lang, + const std::string& config) { if (lang.empty()) { return; @@ -2199,15 +2169,13 @@ void cmLocalGenerator::AddCompilerRequirementFlag( // This compiler has no notion of language standard levels. return; } - std::string extProp = lang + "_EXTENSIONS"; bool ext = true; - if (cmProp extPropValue = target->GetProperty(extProp)) { + if (cmProp extPropValue = target->GetLanguageExtensions(lang)) { if (cmIsOff(*extPropValue)) { ext = false; } } - std::string stdProp = lang + "_STANDARD"; - cmProp standardProp = target->GetProperty(stdProp); + cmProp standardProp = target->GetLanguageStandard(lang, config); if (!standardProp) { if (ext) { // No language standard is specified and extensions are not disabled. @@ -2227,7 +2195,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag( std::string const type = ext ? "EXTENSION" : "STANDARD"; - if (target->GetPropertyAsBool(lang + "_STANDARD_REQUIRED")) { + if (target->GetLanguageStandardRequired(lang)) { std::string option_flag = "CMAKE_" + lang + *standardProp + "_" + type + "_COMPILE_OPTION"; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index f2d9145..f4781d6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -123,7 +123,8 @@ public: const std::string& config); void AddCompilerRequirementFlag(std::string& flags, cmGeneratorTarget const* target, - const std::string& lang); + const std::string& lang, + const std::string& config); //! Append flags to a string. virtual void AppendFlags(std::string& flags, const std::string& newFlags) const; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cf84b94..f3da7a0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -39,6 +39,7 @@ #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionEvaluationFile.h" +#include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmInstallGenerator.h" // IWYU pragma: keep #include "cmInstallSubdirectoryGenerator.h" @@ -4673,7 +4674,33 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, } std::string lang; - if (!this->CompileFeatureKnown(target->GetName(), feature, lang, error)) { + if (!this->CheckCompileFeaturesAvailable(target->GetName(), feature, lang, + error)) { + return false; + } + + target->AppendProperty("COMPILE_FEATURES", feature); + + // FIXME: Add a policy to avoid updating the _STANDARD target + // property due to COMPILE_FEATURES. The language standard selection + // should be done purely at generate time based on whatever the project + // code put in these properties explicitly. That is mostly true now, + // but for compatibility we need to continue updating the property here. + if (lang == "C" || lang == "OBJC") { + return this->AddRequiredTargetCFeature(target, feature, lang, error); + } + if (lang == "CUDA") { + return this->AddRequiredTargetCudaFeature(target, feature, lang, error); + } + return this->AddRequiredTargetCxxFeature(target, feature, lang, error); +} + +bool cmMakefile::CheckCompileFeaturesAvailable(const std::string& targetName, + const std::string& feature, + std::string& lang, + std::string* error) const +{ + if (!this->CompileFeatureKnown(targetName, feature, lang, error)) { return false; } @@ -4699,15 +4726,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, return false; } - target->AppendProperty("COMPILE_FEATURES", feature); - - if (lang == "C" || lang == "OBJC") { - return this->AddRequiredTargetCFeature(target, feature, lang, error); - } - if (lang == "CUDA") { - return this->AddRequiredTargetCudaFeature(target, feature, lang, error); - } - return this->AddRequiredTargetCxxFeature(target, feature, lang, error); + return true; } bool cmMakefile::CompileFeatureKnown(const std::string& targetName, @@ -4802,22 +4821,50 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang, return featuresKnown; } -bool cmMakefile::HaveStandardAvailable(cmTarget const* target, +bool cmMakefile::GetNewRequiredStandard(const std::string& targetName, + const std::string& feature, + cmProp currentLangStandardValue, + std::string& newRequiredStandard, + std::string* error) const +{ + std::string lang; + if (!this->CheckCompileFeaturesAvailable(targetName, feature, lang, error)) { + return false; + } + + if (lang == "C" || lang == "OBJC") { + return this->GetNewRequiredCStandard(targetName, feature, lang, + currentLangStandardValue, + newRequiredStandard, error); + } + if (lang == "CUDA") { + return this->GetNewRequiredCudaStandard(targetName, feature, lang, + currentLangStandardValue, + newRequiredStandard, error); + } + return this->GetNewRequiredCxxStandard(targetName, feature, lang, + currentLangStandardValue, + newRequiredStandard, error); +} + +bool cmMakefile::HaveStandardAvailable(cmGeneratorTarget const* target, std::string const& lang, + std::string const& config, const std::string& feature) const { if (lang == "C" || lang == "OBJC") { - return this->HaveCStandardAvailable(target, feature, lang); + return this->HaveCStandardAvailable(target, lang, config, feature); } if (lang == "CUDA") { - return this->HaveCudaStandardAvailable(target, feature, lang); + return this->HaveCudaStandardAvailable(target, lang, config, feature); } - return this->HaveCxxStandardAvailable(target, feature, lang); + return this->HaveCxxStandardAvailable(target, lang, config, feature); } -bool cmMakefile::HaveCStandardAvailable(cmTarget const* target, - const std::string& feature, - std::string const& lang) const +bool cmMakefile::HaveCStandardAvailable(cmGeneratorTarget const* target, + std::string const& lang, + std::string const& config, + const std::string& feature) const { cmProp defaultCStandard = this->GetDef(cmStrCat("CMAKE_", lang, "_STANDARD_DEFAULT")); @@ -4846,7 +4893,7 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target, this->CheckNeededCLanguage(feature, lang, needC90, needC99, needC11); - cmProp existingCStandard = target->GetProperty(cmStrCat(lang, "_STANDARD")); + cmProp existingCStandard = target->GetLanguageStandard(lang, config); if (!existingCStandard) { existingCStandard = defaultCStandard; } @@ -4909,9 +4956,10 @@ bool cmMakefile::IsLaterStandard(std::string const& lang, cm::cend(CXX_STANDARDS); } -bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, - const std::string& feature, - std::string const& lang) const +bool cmMakefile::HaveCxxStandardAvailable(cmGeneratorTarget const* target, + std::string const& lang, + std::string const& config, + const std::string& feature) const { cmProp defaultCxxStandard = this->GetDef(cmStrCat("CMAKE_", lang, "_STANDARD_DEFAULT")); @@ -4941,8 +4989,7 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, this->CheckNeededCxxLanguage(feature, lang, needCxx98, needCxx11, needCxx14, needCxx17, needCxx20); - cmProp existingCxxStandard = - target->GetProperty(cmStrCat(lang, "_STANDARD")); + cmProp existingCxxStandard = target->GetLanguageStandard(lang, config); if (!existingCxxStandard) { existingCxxStandard = defaultCxxStandard; } @@ -5009,6 +5056,29 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, std::string const& lang, std::string* error) const { + std::string newRequiredStandard; + if (this->GetNewRequiredCxxStandard( + target->GetName(), feature, lang, + target->GetProperty(cmStrCat(lang, "_STANDARD")), newRequiredStandard, + error)) { + if (!newRequiredStandard.empty()) { + target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard); + } + return true; + } + + return false; +} + +bool cmMakefile::GetNewRequiredCxxStandard(const std::string& targetName, + const std::string& feature, + std::string const& lang, + cmProp currentLangStandardValue, + std::string& newRequiredStandard, + std::string* error) const +{ + newRequiredStandard.clear(); + bool needCxx98 = false; bool needCxx11 = false; bool needCxx14 = false; @@ -5018,8 +5088,7 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, this->CheckNeededCxxLanguage(feature, lang, needCxx98, needCxx11, needCxx14, needCxx17, needCxx20); - cmProp existingCxxStandard = - target->GetProperty(cmStrCat(lang, "_STANDARD")); + cmProp existingCxxStandard = currentLangStandardValue; if (existingCxxStandard == nullptr) { cmProp defaultCxxStandard = this->GetDef(cmStrCat("CMAKE_", lang, "_STANDARD_DEFAULT")); @@ -5034,7 +5103,7 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, cmStrCmp(*existingCxxStandard)); if (existingCxxLevel == cm::cend(CXX_STANDARDS)) { const std::string e = cmStrCat( - "The ", lang, "_STANDARD property on target \"", target->GetName(), + "The ", lang, "_STANDARD property on target \"", targetName, "\" contained an invalid value: \"", *existingCxxStandard, "\"."); if (error) { *error = e; @@ -5060,16 +5129,17 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, // Ensure the C++ language level is high enough to support // the needed C++ features. if (!existingCxxLevel || existingCxxLevel < needCxxLevel) { - target->SetProperty(cmStrCat(lang, "_STANDARD"), *needCxxLevel); + newRequiredStandard = *needCxxLevel; } } return true; } -bool cmMakefile::HaveCudaStandardAvailable(cmTarget const* target, - const std::string& feature, - std::string const& lang) const +bool cmMakefile::HaveCudaStandardAvailable(cmGeneratorTarget const* target, + std::string const& lang, + std::string const& config, + const std::string& feature) const { cmProp defaultCudaStandard = this->GetDef(cmStrCat("CMAKE_", lang, "_STANDARD_DEFAULT")); @@ -5100,8 +5170,7 @@ bool cmMakefile::HaveCudaStandardAvailable(cmTarget const* target, this->CheckNeededCudaLanguage(feature, lang, needCuda03, needCuda11, needCuda14, needCuda17, needCuda20); - cmProp existingCudaStandard = - target->GetProperty(cmStrCat(lang, "_STANDARD")); + cmProp existingCudaStandard = target->GetLanguageStandard(lang, config); if (!existingCudaStandard) { existingCudaStandard = defaultCudaStandard; } @@ -5168,6 +5237,28 @@ bool cmMakefile::AddRequiredTargetCudaFeature(cmTarget* target, std::string const& lang, std::string* error) const { + std::string newRequiredStandard; + if (this->GetNewRequiredCudaStandard( + target->GetName(), feature, lang, + target->GetProperty(cmStrCat(lang, "_STANDARD")), newRequiredStandard, + error)) { + if (!newRequiredStandard.empty()) { + target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard); + } + return true; + } + return false; +} + +bool cmMakefile::GetNewRequiredCudaStandard(const std::string& targetName, + const std::string& feature, + std::string const& lang, + cmProp currentLangStandardValue, + std::string& newRequiredStandard, + std::string* error) const +{ + newRequiredStandard.clear(); + bool needCuda03 = false; bool needCuda11 = false; bool needCuda14 = false; @@ -5177,8 +5268,7 @@ bool cmMakefile::AddRequiredTargetCudaFeature(cmTarget* target, this->CheckNeededCudaLanguage(feature, lang, needCuda03, needCuda11, needCuda14, needCuda17, needCuda20); - cmProp existingCudaStandard = - target->GetProperty(cmStrCat(lang, "_STANDARD")); + cmProp existingCudaStandard = currentLangStandardValue; if (existingCudaStandard == nullptr) { cmProp defaultCudaStandard = this->GetDef(cmStrCat("CMAKE_", lang, "_STANDARD_DEFAULT")); @@ -5193,7 +5283,7 @@ bool cmMakefile::AddRequiredTargetCudaFeature(cmTarget* target, cmStrCmp(*existingCudaStandard)); if (existingCudaLevel == cm::cend(CUDA_STANDARDS)) { const std::string e = cmStrCat( - "The ", lang, "_STANDARD property on target \"", target->GetName(), + "The ", lang, "_STANDARD property on target \"", targetName, "\" contained an invalid value: \"", *existingCudaStandard, "\"."); if (error) { *error = e; @@ -5219,7 +5309,7 @@ bool cmMakefile::AddRequiredTargetCudaFeature(cmTarget* target, // Ensure the CUDA language level is high enough to support // the needed CUDA features. if (!existingCudaLevel || existingCudaLevel < needCudaLevel) { - target->SetProperty("CUDA_STANDARD", *needCudaLevel); + newRequiredStandard = *needCudaLevel; } } @@ -5252,13 +5342,36 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, std::string const& lang, std::string* error) const { + std::string newRequiredStandard; + if (this->GetNewRequiredCStandard( + target->GetName(), feature, lang, + target->GetProperty(cmStrCat(lang, "_STANDARD")), newRequiredStandard, + error)) { + if (!newRequiredStandard.empty()) { + target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard); + } + return true; + } + + return false; +} + +bool cmMakefile::GetNewRequiredCStandard(const std::string& targetName, + const std::string& feature, + std::string const& lang, + cmProp currentLangStandardValue, + std::string& newRequiredStandard, + std::string* error) const +{ + newRequiredStandard.clear(); + bool needC90 = false; bool needC99 = false; bool needC11 = false; this->CheckNeededCLanguage(feature, lang, needC90, needC99, needC11); - cmProp existingCStandard = target->GetProperty(cmStrCat(lang, "_STANDARD")); + cmProp existingCStandard = currentLangStandardValue; if (existingCStandard == nullptr) { cmProp defaultCStandard = this->GetDef(cmStrCat("CMAKE_", lang, "_STANDARD_DEFAULT")); @@ -5270,7 +5383,7 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, if (std::find_if(cm::cbegin(C_STANDARDS), cm::cend(C_STANDARDS), cmStrCmp(*existingCStandard)) == cm::cend(C_STANDARDS)) { const std::string e = cmStrCat( - "The ", lang, "_STANDARD property on target \"", target->GetName(), + "The ", lang, "_STANDARD property on target \"", targetName, "\" contained an invalid value: \"", *existingCStandard, "\"."); if (error) { *error = e; @@ -5307,11 +5420,11 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, } if (setC11) { - target->SetProperty(cmStrCat(lang, "_STANDARD"), "11"); + newRequiredStandard = "11"; } else if (setC99) { - target->SetProperty(cmStrCat(lang, "_STANDARD"), "99"); + newRequiredStandard = "99"; } else if (setC90) { - target->SetProperty(cmStrCat(lang, "_STANDARD"), "90"); + newRequiredStandard = "90"; } return true; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 368676f..332554e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -47,6 +47,7 @@ class cmExpandedCommandArgument; class cmExportBuildFileGenerator; class cmFunctionBlocker; class cmGeneratorExpressionEvaluationFile; +class cmGeneratorTarget; class cmGlobalGenerator; class cmImplicitDependsList; class cmInstallGenerator; @@ -935,7 +936,15 @@ public: const char* CompileFeaturesAvailable(const std::string& lang, std::string* error) const; - bool HaveStandardAvailable(cmTarget const* target, std::string const& lang, + bool GetNewRequiredStandard(const std::string& targetName, + const std::string& feature, + cmProp currentLangStandardValue, + std::string& newRequiredStandard, + std::string* error = nullptr) const; + + bool HaveStandardAvailable(cmGeneratorTarget const* target, + std::string const& lang, + std::string const& config, const std::string& feature) const; bool IsLaterStandard(std::string const& lang, std::string const& lhs, @@ -1175,6 +1184,11 @@ private: std::string const& lang, std::string* error = nullptr) const; + bool CheckCompileFeaturesAvailable(const std::string& targetName, + const std::string& feature, + std::string& lang, + std::string* error) const; + void CheckNeededCLanguage(const std::string& feature, std::string const& lang, bool& needC90, bool& needC99, bool& needC11) const; @@ -1187,15 +1201,37 @@ private: bool& needCuda11, bool& needCuda14, bool& needCuda17, bool& needCuda20) const; - bool HaveCStandardAvailable(cmTarget const* target, - const std::string& feature, - std::string const& lang) const; - bool HaveCxxStandardAvailable(cmTarget const* target, - const std::string& feature, - std::string const& lang) const; - bool HaveCudaStandardAvailable(cmTarget const* target, + bool GetNewRequiredCStandard(const std::string& targetName, + const std::string& feature, + std::string const& lang, + cmProp currentLangStandardValue, + std::string& newRequiredStandard, + std::string* error = nullptr) const; + bool GetNewRequiredCxxStandard(const std::string& targetName, const std::string& feature, - std::string const& lang) const; + std::string const& lang, + cmProp currentLangStandardValue, + std::string& newRequiredStandard, + std::string* error = nullptr) const; + bool GetNewRequiredCudaStandard(const std::string& targetName, + const std::string& feature, + std::string const& lang, + cmProp currentLangStandardValue, + std::string& newRequiredStandard, + std::string* error = nullptr) const; + + bool HaveCStandardAvailable(cmGeneratorTarget const* target, + std::string const& lang, + std::string const& config, + const std::string& feature) const; + bool HaveCxxStandardAvailable(cmGeneratorTarget const* target, + std::string const& lang, + std::string const& config, + const std::string& feature) const; + bool HaveCudaStandardAvailable(cmGeneratorTarget const* target, + std::string const& lang, + std::string const& config, + const std::string& feature) const; void CheckForUnusedVariables() const; -- cgit v0.12 From 032506acc6db710d2b402f0d17ae678a0d6e8406 Mon Sep 17 00:00:00 2001 From: Asit Dhal Date: Sun, 14 Jun 2020 00:39:33 +0200 Subject: cmake: implement error handling in configure_file Implement error handling in case it fails Fixes: #20696 --- Source/cmMakefile.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5c3063b..fa91059 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4027,6 +4027,8 @@ int cmMakefile::ConfigureFile(const std::string& infile, if (copyonly) { if (!cmSystemTools::CopyFileIfDifferent(sinfile, soutfile)) { + this->IssueMessage(MessageType::FATAL_ERROR, + cmSystemTools::GetLastSystemError()); return 0; } } else { @@ -4077,9 +4079,15 @@ int cmMakefile::ConfigureFile(const std::string& infile, fin.close(); fout.close(); if (!cmSystemTools::CopyFileIfDifferent(tempOutputFile, soutfile)) { + this->IssueMessage(MessageType::FATAL_ERROR, + cmSystemTools::GetLastSystemError()); res = 0; } else { - cmSystemTools::SetPermissions(soutfile, perm); + if (!cmSystemTools::SetPermissions(soutfile, perm)) { + this->IssueMessage(MessageType::FATAL_ERROR, + cmSystemTools::GetLastSystemError()); + res = 0; + } } cmSystemTools::RemoveFile(tempOutputFile); } -- cgit v0.12 From e96b5e44499a82caa1a0f3b3bd3d92d6d6fcaca9 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 17 Jun 2020 00:03:25 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b835f81..40bf305 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 18) -set(CMake_VERSION_PATCH 20200616) +set(CMake_VERSION_PATCH 20200617) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 574f71efba3bc9af4bd46ae154a421d1f5f86c97 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 15 Jun 2020 12:44:26 -0400 Subject: try_compile: Refactor language standard level parsing cmCoreTryCompile had significant code duplication around handling languages that offer standard levels. This refactoring reduces the complexity and makes it easier to add new languages in the future. --- Source/cmCoreTryCompile.cxx | 482 ++++++++++++++++++-------------------------- Source/cmCoreTryCompile.h | 4 - 2 files changed, 194 insertions(+), 292 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index a7acadc..0aa5da0 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -25,6 +25,148 @@ #include "cmVersion.h" #include "cmake.h" +namespace { +class LanguageStandardState +{ +public: + LanguageStandardState(std::string&& lang) + : IsEnabled(false) + , DidStandard(false) + , DidStandardRequired(false) + , DidExtensions(false) + , StandardFlag(lang + "_STANDARD") + , RequiredFlag(lang + "_STANDARD_REQUIRED") + , ExtensionFlag(lang + "_EXTENSIONS") + { + } + + void Enabled(bool isEnabled) { this->IsEnabled = isEnabled; } + + bool UpdateIfMatches(std::vector const& argv, size_t& index) + { + bool updated = false; + if (argv[index] == this->StandardFlag) { + this->DidStandard = true; + this->StandardValue = argv[++index]; + updated = true; + } else if (argv[index] == this->RequiredFlag) { + this->DidStandardRequired = true; + this->RequiredValue = argv[++index]; + updated = true; + } else if (argv[index] == this->ExtensionFlag) { + this->DidExtensions = true; + this->ExtensionValue = argv[++index]; + updated = true; + } + return updated; + } + + bool Validate(cmMakefile* const makefile) const + { + if (this->DidStandard) { + makefile->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat(this->StandardFlag, + " allowed only in source file signature.")); + return false; + } + if (this->DidStandardRequired) { + makefile->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat(this->RequiredFlag, + " allowed only in source file signature.")); + return false; + } + if (this->DidExtensions) { + makefile->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat(this->ExtensionFlag, + " allowed only in source file signature.")); + return false; + } + + return true; + } + + bool DidNone() const + { + return !this->DidStandard && !this->DidStandardRequired && + !this->DidExtensions; + } + + void LoadUnsetPropertyValues(cmMakefile* const makefile, bool honorStandard, + bool warnCMP0067, + std::vector& warnCMP0067Variables) + { + if (!this->IsEnabled) { + return; + } + + auto lookupStdVar = [&](std::string const& var) -> std::string { + std::string value = makefile->GetSafeDefinition(var); + if (warnCMP0067 && !value.empty()) { + value.clear(); + warnCMP0067Variables.push_back(var); + } + return value; + }; + + if (honorStandard || warnCMP0067) { + if (!this->DidStandard) { + this->StandardValue = + lookupStdVar(cmStrCat("CMAKE_", this->StandardFlag)); + } + if (!this->DidStandardRequired) { + this->RequiredValue = + lookupStdVar(cmStrCat("CMAKE_", this->RequiredFlag)); + } + if (!this->DidExtensions) { + this->ExtensionValue = + lookupStdVar(cmStrCat("CMAKE_", this->ExtensionFlag)); + } + } + } + + void WriteProperties(FILE* fout, std::string const& targetName) const + { + if (!this->IsEnabled) { + return; + } + + auto writeProp = [&](std::string const& prop, std::string const& value) { + fprintf(fout, "set_property(TARGET %s PROPERTY %s %s)\n", + targetName.c_str(), + cmOutputConverter::EscapeForCMake(prop).c_str(), + cmOutputConverter::EscapeForCMake(value).c_str()); + }; + + if (!this->StandardValue.empty()) { + writeProp(this->StandardFlag, this->StandardValue); + } + if (!this->RequiredValue.empty()) { + writeProp(this->RequiredFlag, this->RequiredValue); + } + if (!this->ExtensionValue.empty()) { + writeProp(this->ExtensionFlag, this->ExtensionValue); + } + } + +private: + bool IsEnabled; + bool DidStandard; + bool DidStandardRequired; + bool DidExtensions; + + std::string StandardFlag; + std::string RequiredFlag; + std::string ExtensionFlag; + + std::string StandardValue; + std::string RequiredValue; + std::string ExtensionValue; +}; +} + static std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN = "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN"; static std::string const kCMAKE_C_COMPILER_TARGET = "CMAKE_C_COMPILER_TARGET"; @@ -79,25 +221,6 @@ static std::set ghs_platform_vars{ "GHS_OS_DIR_OPTION" }; -static void writeProperty(FILE* fout, std::string const& targetName, - std::string const& prop, std::string const& value) -{ - fprintf(fout, "set_property(TARGET %s PROPERTY %s %s)\n", targetName.c_str(), - cmOutputConverter::EscapeForCMake(prop).c_str(), - cmOutputConverter::EscapeForCMake(value).c_str()); -} - -std::string cmCoreTryCompile::LookupStdVar(std::string const& var, - bool warnCMP0067) -{ - std::string value = this->Makefile->GetSafeDefinition(var); - if (warnCMP0067 && !value.empty()) { - value.clear(); - this->WarnCMP0067.push_back(var); - } - return value; -} - int cmCoreTryCompile::TryCompileCode(std::vector const& argv, bool isTryRun) { @@ -137,21 +260,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, std::string outputVariable; std::string copyFile; std::string copyFileError; - std::string cStandard; - std::string objcStandard; - std::string cxxStandard; - std::string objcxxStandard; - std::string cudaStandard; - std::string cStandardRequired; - std::string cxxStandardRequired; - std::string objcStandardRequired; - std::string objcxxStandardRequired; - std::string cudaStandardRequired; - std::string cExtensions; - std::string cxxExtensions; - std::string objcExtensions; - std::string objcxxExtensions; - std::string cudaExtensions; + LanguageStandardState cState("C"); + LanguageStandardState cudaState("CUDA"); + LanguageStandardState cxxState("CXX"); + LanguageStandardState objcState("OBJC"); + LanguageStandardState objcxxState("OBJCXX"); std::vector targets; std::vector linkOptions; std::string libsToLink = " "; @@ -160,21 +273,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, bool didOutputVariable = false; bool didCopyFile = false; bool didCopyFileError = false; - bool didCStandard = false; - bool didCxxStandard = false; - bool didObjCStandard = false; - bool didObjCxxStandard = false; - bool didCudaStandard = false; - bool didCStandardRequired = false; - bool didCxxStandardRequired = false; - bool didObjCStandardRequired = false; - bool didObjCxxStandardRequired = false; - bool didCudaStandardRequired = false; - bool didCExtensions = false; - bool didCxxExtensions = false; - bool didObjCExtensions = false; - bool didObjCxxExtensions = false; - bool didCudaExtensions = false; bool useSources = argv[2] == "SOURCES"; std::vector sources; @@ -188,21 +286,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, DoingOutputVariable, DoingCopyFile, DoingCopyFileError, - DoingCStandard, - DoingCxxStandard, - DoingObjCStandard, - DoingObjCxxStandard, - DoingCudaStandard, - DoingCStandardRequired, - DoingCxxStandardRequired, - DoingObjCStandardRequired, - DoingObjCxxStandardRequired, - DoingCudaStandardRequired, - DoingCExtensions, - DoingCxxExtensions, - DoingObjCExtensions, - DoingObjCxxExtensions, - DoingCudaExtensions, DoingSources, DoingCMakeInternal }; @@ -226,51 +309,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, } else if (argv[i] == "COPY_FILE_ERROR") { doing = DoingCopyFileError; didCopyFileError = true; - } else if (argv[i] == "C_STANDARD") { - doing = DoingCStandard; - didCStandard = true; - } else if (argv[i] == "CXX_STANDARD") { - doing = DoingCxxStandard; - didCxxStandard = true; - } else if (argv[i] == "OBJC_STANDARD") { - doing = DoingObjCStandard; - didObjCStandard = true; - } else if (argv[i] == "OBJCXX_STANDARD") { - doing = DoingObjCxxStandard; - didObjCxxStandard = true; - } else if (argv[i] == "CUDA_STANDARD") { - doing = DoingCudaStandard; - didCudaStandard = true; - } else if (argv[i] == "C_STANDARD_REQUIRED") { - doing = DoingCStandardRequired; - didCStandardRequired = true; - } else if (argv[i] == "CXX_STANDARD_REQUIRED") { - doing = DoingCxxStandardRequired; - didCxxStandardRequired = true; - } else if (argv[i] == "OBJC_STANDARD_REQUIRED") { - doing = DoingObjCStandardRequired; - didObjCStandardRequired = true; - } else if (argv[i] == "OBJCXX_STANDARD_REQUIRED") { - doing = DoingObjCxxStandardRequired; - didObjCxxStandardRequired = true; - } else if (argv[i] == "CUDA_STANDARD_REQUIRED") { - doing = DoingCudaStandardRequired; - didCudaStandardRequired = true; - } else if (argv[i] == "C_EXTENSIONS") { - doing = DoingCExtensions; - didCExtensions = true; - } else if (argv[i] == "CXX_EXTENSIONS") { - doing = DoingCxxExtensions; - didCxxExtensions = true; - } else if (argv[i] == "OBJC_EXTENSIONS") { - doing = DoingObjCExtensions; - didObjCExtensions = true; - } else if (argv[i] == "OBJCXX_EXTENSIONS") { - doing = DoingObjCxxExtensions; - didObjCxxExtensions = true; - } else if (argv[i] == "CUDA_EXTENSIONS") { - doing = DoingCudaExtensions; - didCudaExtensions = true; + } else if (cState.UpdateIfMatches(argv, i) || + cxxState.UpdateIfMatches(argv, i) || + cudaState.UpdateIfMatches(argv, i) || + objcState.UpdateIfMatches(argv, i) || + objcxxState.UpdateIfMatches(argv, i)) { + continue; } else if (argv[i] == "__CMAKE_INTERNAL") { doing = DoingCMakeInternal; } else if (doing == DoingCMakeFlags) { @@ -315,51 +359,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, } else if (doing == DoingCopyFileError) { copyFileError = argv[i]; doing = DoingNone; - } else if (doing == DoingCStandard) { - cStandard = argv[i]; - doing = DoingNone; - } else if (doing == DoingCxxStandard) { - cxxStandard = argv[i]; - doing = DoingNone; - } else if (doing == DoingObjCStandard) { - objcStandard = argv[i]; - doing = DoingNone; - } else if (doing == DoingObjCxxStandard) { - objcxxStandard = argv[i]; - doing = DoingNone; - } else if (doing == DoingCudaStandard) { - cudaStandard = argv[i]; - doing = DoingNone; - } else if (doing == DoingCStandardRequired) { - cStandardRequired = argv[i]; - doing = DoingNone; - } else if (doing == DoingCxxStandardRequired) { - cxxStandardRequired = argv[i]; - doing = DoingNone; - } else if (doing == DoingObjCStandardRequired) { - objcStandardRequired = argv[i]; - doing = DoingNone; - } else if (doing == DoingObjCxxStandardRequired) { - objcxxStandardRequired = argv[i]; - doing = DoingNone; - } else if (doing == DoingCudaStandardRequired) { - cudaStandardRequired = argv[i]; - doing = DoingNone; - } else if (doing == DoingCExtensions) { - cExtensions = argv[i]; - doing = DoingNone; - } else if (doing == DoingCxxExtensions) { - cxxExtensions = argv[i]; - doing = DoingNone; - } else if (doing == DoingObjCExtensions) { - objcExtensions = argv[i]; - doing = DoingNone; - } else if (doing == DoingObjCxxExtensions) { - objcxxExtensions = argv[i]; - doing = DoingNone; - } else if (doing == DoingCudaExtensions) { - cudaExtensions = argv[i]; - doing = DoingNone; } else if (doing == DoingSources) { sources.push_back(argv[i]); } else if (doing == DoingCMakeInternal) { @@ -411,59 +410,22 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, return -1; } - if (didCStandard && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "C_STANDARD allowed only in source file signature."); - return -1; - } - if (didCxxStandard && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "CXX_STANDARD allowed only in source file signature."); - return -1; - } - if (didCudaStandard && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "CUDA_STANDARD allowed only in source file signature."); - return -1; - } - if (didCStandardRequired && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "C_STANDARD_REQUIRED allowed only in source file signature."); - return -1; - } - if (didCxxStandardRequired && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "CXX_STANDARD_REQUIRED allowed only in source file signature."); - return -1; - } - if (didCudaStandardRequired && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "CUDA_STANDARD_REQUIRED allowed only in source file signature."); - return -1; - } - if (didCExtensions && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "C_EXTENSIONS allowed only in source file signature."); - return -1; - } - if (didCxxExtensions && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "CXX_EXTENSIONS allowed only in source file signature."); - return -1; - } - if (didCudaExtensions && !this->SrcFileSignature) { - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "CUDA_EXTENSIONS allowed only in source file signature."); - return -1; + if (!this->SrcFileSignature) { + if (!cState.Validate(this->Makefile)) { + return -1; + } + if (!cudaState.Validate(this->Makefile)) { + return -1; + } + if (!cxxState.Validate(this->Makefile)) { + return -1; + } + if (!objcState.Validate(this->Makefile)) { + return -1; + } + if (!objcxxState.Validate(this->Makefile)) { + return -1; + } } // compute the binary dir when TRY_COMPILE is called with a src file @@ -819,21 +781,17 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, } fprintf(fout, ")\n"); - bool const testC = testLangs.find("C") != testLangs.end(); - bool const testObjC = testLangs.find("OBJC") != testLangs.end(); - bool const testCxx = testLangs.find("CXX") != testLangs.end(); - bool const testObjCxx = testLangs.find("OBJCXX") != testLangs.end(); - bool const testCuda = testLangs.find("CUDA") != testLangs.end(); + cState.Enabled(testLangs.find("C") != testLangs.end()); + cxxState.Enabled(testLangs.find("CXX") != testLangs.end()); + cudaState.Enabled(testLangs.find("CUDA") != testLangs.end()); + objcState.Enabled(testLangs.find("OBJC") != testLangs.end()); + objcxxState.Enabled(testLangs.find("OBJCXX") != testLangs.end()); bool warnCMP0067 = false; bool honorStandard = true; - if (!didCStandard && !didCxxStandard && !didObjCStandard && - !didObjCxxStandard && !didCudaStandard && !didCStandardRequired && - !didCxxStandardRequired && !didObjCStandardRequired && - !didObjCxxStandardRequired && !didCudaStandardRequired && - !didCExtensions && !didCxxExtensions && !didObjCExtensions && - !didObjCxxExtensions && !didCudaExtensions) { + if (cState.DidNone() && cxxState.DidNone() && objcState.DidNone() && + objcxxState.DidNone() && cudaState.DidNone()) { switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0067)) { case cmPolicies::WARN: warnCMP0067 = this->Makefile->PolicyOptionalWarningEnabled( @@ -855,46 +813,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, } } - if (honorStandard || warnCMP0067) { + std::vector warnCMP0067Variables; - auto testLanguage = - [&](bool testLang, bool didLangStandard, bool didLangStandardRequired, - bool didLangExtensions, std::string& langStandard, - std::string& langStandardRequired, std::string& langExtensions, - const std::string& lang) { - if (testLang) { - if (!didLangStandard) { - langStandard = this->LookupStdVar( - cmStrCat("CMAKE_", lang, "_STANDARD"), warnCMP0067); - } - if (!didLangStandardRequired) { - langStandardRequired = this->LookupStdVar( - cmStrCat("CMAKE_", lang, "_STANDARD_REQUIRED"), warnCMP0067); - } - if (!didLangExtensions) { - langExtensions = this->LookupStdVar( - cmStrCat("CMAKE_", lang, "_EXTENSIONS"), warnCMP0067); - } - } - }; - - testLanguage(testC, didCStandard, didCStandardRequired, didCExtensions, - cStandard, cStandardRequired, cExtensions, "C"); - testLanguage(testObjC, didObjCStandard, didObjCStandardRequired, - didObjCExtensions, objcStandard, objcStandardRequired, - objcExtensions, "OBJC"); - testLanguage(testCxx, didCxxStandard, didCxxStandardRequired, - didCxxExtensions, cxxStandard, cxxStandardRequired, - cxxExtensions, "CXX"); - testLanguage(testObjCxx, didObjCxxStandard, didObjCxxStandardRequired, - didObjCxxExtensions, objcxxStandard, objcxxStandardRequired, - objcxxExtensions, "OBJCXX"); - testLanguage(testCuda, didCudaStandard, didCudaStandardRequired, - didCudaExtensions, cudaStandard, cudaStandardRequired, - cudaExtensions, "CUDA"); - } + cState.LoadUnsetPropertyValues(this->Makefile, honorStandard, warnCMP0067, + warnCMP0067Variables); + cxxState.LoadUnsetPropertyValues(this->Makefile, honorStandard, + warnCMP0067, warnCMP0067Variables); + cudaState.LoadUnsetPropertyValues(this->Makefile, honorStandard, + warnCMP0067, warnCMP0067Variables); + objcState.LoadUnsetPropertyValues(this->Makefile, honorStandard, + warnCMP0067, warnCMP0067Variables); + objcxxState.LoadUnsetPropertyValues(this->Makefile, honorStandard, + warnCMP0067, warnCMP0067Variables); - if (!this->WarnCMP0067.empty()) { + if (!warnCMP0067Variables.empty()) { std::ostringstream w; /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0067) << "\n" @@ -902,43 +834,17 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, "is not honoring language standard variables in the test project:\n" ; /* clang-format on */ - for (std::string const& vi : this->WarnCMP0067) { + for (std::string const& vi : warnCMP0067Variables) { w << " " << vi << "\n"; } this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } - auto writeLanguageProperties = [&](bool testLang, - const std::string& langStandard, - const std::string& langStandardRequired, - const std::string& langExtensions, - const std::string& lang) { - if (testLang) { - if (!langStandard.empty()) { - writeProperty(fout, targetName, cmStrCat(lang, "_STANDARD"), - langStandard); - } - if (!langStandardRequired.empty()) { - writeProperty(fout, targetName, cmStrCat(lang, "_STANDARD_REQUIRED"), - langStandardRequired); - } - if (!langExtensions.empty()) { - writeProperty(fout, targetName, cmStrCat(lang, "_EXTENSIONS"), - langExtensions); - } - } - }; - - writeLanguageProperties(testC, cStandard, cStandardRequired, cExtensions, - "C"); - writeLanguageProperties(testObjC, objcStandard, objcStandardRequired, - objcExtensions, "OBJC"); - writeLanguageProperties(testCxx, cxxStandard, cxxStandardRequired, - cxxExtensions, "CXX"); - writeLanguageProperties(testObjCxx, objcxxStandard, objcxxStandardRequired, - objcxxExtensions, "OBJCXX"); - writeLanguageProperties(testCuda, cudaStandard, cudaStandardRequired, - cudaExtensions, "CUDA"); + cState.WriteProperties(fout, targetName); + cxxState.WriteProperties(fout, targetName); + cudaState.WriteProperties(fout, targetName); + objcState.WriteProperties(fout, targetName); + objcxxState.WriteProperties(fout, targetName); if (!linkOptions.empty()) { std::vector options; diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index ae714a6..916572a 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -47,10 +47,6 @@ protected: std::string OutputFile; std::string FindErrorMessage; bool SrcFileSignature = false; - -private: - std::vector WarnCMP0067; - std::string LookupStdVar(std::string const& var, bool warnCMP0067); }; #endif -- cgit v0.12 From 58c05e1c732bd832e3133c4acde722fdb3eabfb8 Mon Sep 17 00:00:00 2001 From: Gusts Kaksis Date: Fri, 12 Jun 2020 14:56:43 +0300 Subject: Xcode: Use "Link Binary With Libraries" build phase when possible Try linking all target linked libraries through frameworks build phase instead of linker flags, thus letting Xcode manage build product paths correctly. Prevent adding duplicate entries to "Link Binary With Libraries" build phase. Add check for configuration-dependent linking - in case the library is not present in all configurations revert back to linker flags which are per-configuration. This does change the order of libraries linked, but that does not seem to matter for Apple linkers invoked by Xcode, even for static libraries. The linker will go back and re-consider a static library from earlier on the link line when more symbols from its objects are needed. Fixes: #14185 --- Source/cmGlobalXCodeGenerator.cxx | 189 ++++++++++++++++++++++++++++++++++---- Source/cmGlobalXCodeGenerator.h | 1 + 2 files changed, 173 insertions(+), 17 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index aac0be5..bb422eb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1354,22 +1354,20 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( } } - // create framework build phase + // always create framework build phase cmXCodeObject* frameworkBuildPhase = nullptr; - if (!externalObjFiles.empty()) { - frameworkBuildPhase = - this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase); - frameworkBuildPhase->SetComment("Frameworks"); - frameworkBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - frameworkBuildPhase->AddAttribute("files", buildFiles); - for (auto& externalObjFile : externalObjFiles) { - buildFiles->AddObject(externalObjFile); - } - frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - } + frameworkBuildPhase = + this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase); + frameworkBuildPhase->SetComment("Frameworks"); + frameworkBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + frameworkBuildPhase->AddAttribute("files", buildFiles); + for (auto& externalObjFile : externalObjFiles) { + buildFiles->AddObject(externalObjFile); + } + frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); // create list of build phases and create the Xcode target cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -2769,6 +2767,156 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) } } + // Separate libraries into ones that can be linked using "Link Binary With + // Libraries" build phase and the ones that can't. Only targets that build + // Apple bundles (.app, .framework, .bundle) can use this feature and only + // targets that represent actual libraries (static or dynamic, local or + // imported) not objects and not executables will be used. These are + // limitations imposed by CMake use-cases - otherwise a lot of things break. + // The rest will be linked using linker flags (OTHER_LDFLAGS setting in Xcode + // project). + std::map> + configItemMap; + auto addToLinkerArguments = + [&configItemMap](const std::string& configName, + cmComputeLinkInformation::Item const* libItemPtr) { + auto& linkVector = configItemMap[configName]; + if (std::find_if(linkVector.begin(), linkVector.end(), + [libItemPtr](cmComputeLinkInformation::Item const* p) { + return p == libItemPtr; + }) == linkVector.end()) { + linkVector.push_back(libItemPtr); + } + }; + std::vector linkPhaseTargetVector; + std::map> targetConfigMap; + using ConfigItemPair = + std::pair; + std::map> targetItemMap; + std::map> targetProductNameMap; + for (auto const& configName : this->CurrentConfigurationTypes) { + cmComputeLinkInformation* cli = gt->GetLinkInformation(configName); + if (!cli) { + continue; + } + for (auto const& libItem : cli->GetItems()) { + // TODO: Drop this check once we have option to add outside libraries to + // Xcode project + auto* libTarget = FindXCodeTarget(libItem.Target); + if (gt->IsBundleOnApple() && + (gt->GetType() == cmStateEnums::EXECUTABLE || + gt->GetType() == cmStateEnums::SHARED_LIBRARY || + gt->GetType() == cmStateEnums::MODULE_LIBRARY || + gt->GetType() == cmStateEnums::UNKNOWN_LIBRARY) && + (libTarget && libItem.Target && + (libItem.Target->GetType() == cmStateEnums::STATIC_LIBRARY || + libItem.Target->GetType() == cmStateEnums::SHARED_LIBRARY || + libItem.Target->GetType() == cmStateEnums::MODULE_LIBRARY))) { + // Add unique configuration name to target-config map for later + // checks + std::string libName = libItem.Target->GetName(); + auto& configVector = targetConfigMap[libName]; + if (std::find(configVector.begin(), configVector.end(), configName) == + configVector.end()) { + configVector.push_back(configName); + } + // Add a pair of config and item to target-item map + auto& itemVector = targetItemMap[libName]; + itemVector.emplace_back(ConfigItemPair(configName, &libItem)); + // Add product file-name to a lib-product map + auto productName = cmSystemTools::GetFilenameName(libItem.Value.Value); + auto& productVector = targetProductNameMap[libName]; + if (std::find(productVector.begin(), productVector.end(), + productName) == productVector.end()) { + productVector.push_back(productName); + } + } else { + // Add this library item to a regular linker flag list + addToLinkerArguments(configName, &libItem); + } + } + } + + // Go through target library map and separate libraries that are linked + // in all configurations and produce only single product, from the rest. + // Only these will be linked through "Link Binary With Libraries" build + // phase. + for (auto const& targetLibConfigs : targetConfigMap) { + // Add this library to "Link Binary With Libraries" build phase if it's + // linked in all configurations and it has only one product name + auto& itemVector = targetItemMap[targetLibConfigs.first]; + auto& productVector = targetProductNameMap[targetLibConfigs.first]; + if (targetLibConfigs.second == this->CurrentConfigurationTypes && + productVector.size() == 1) { + // Add this library to "Link Binary With Libraries" list + linkPhaseTargetVector.push_back(itemVector[0].second); + } else { + for (auto const& libItem : targetItemMap[targetLibConfigs.first]) { + // Add this library item to a regular linker flag list + addToLinkerArguments(libItem.first, libItem.second); + } + } + } + + // Add libraries to "Link Binary With Libraries" build phase and collect + // their search paths. Xcode does not support per-configuration linking + // in this build phase so we don't have to do this for each configuration + // separately. + std::vector linkSearchPaths; + for (auto const& libItem : linkPhaseTargetVector) { + // Add target output directory as a library search path + std::string linkDir = cmSystemTools::GetParentDirectory( + libItem->Target->GetLocationForBuild()); + if (std::find(linkSearchPaths.begin(), linkSearchPaths.end(), linkDir) == + linkSearchPaths.end()) { + linkSearchPaths.push_back(linkDir); + } + // Add target dependency + auto const& libName = *libItem; + if (!libName.Target->IsImported()) { + for (auto const& configName : this->CurrentConfigurationTypes) { + target->AddDependTarget(configName, libName.Target->GetName()); + } + } + // Get the library target + auto* libTarget = FindXCodeTarget(libItem->Target); + if (!libTarget) { + continue; + } + // Add the target output file as a build reference for other targets + // to link against + auto* fileRefObject = libTarget->GetObject("productReference"); + if (!fileRefObject) { + continue; + } + cmXCodeObject* buildFile; + auto it = FileRefToBuildFileMap.find(fileRefObject); + if (it == FileRefToBuildFileMap.end()) { + buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile); + buildFile->AddAttribute("fileRef", fileRefObject); + FileRefToBuildFileMap[fileRefObject] = buildFile; + } else { + buildFile = it->second; + } + // Add this reference to current target + auto* buildPhases = target->GetObject("buildPhases"); + if (!buildPhases) { + continue; + } + auto* frameworkBuildPhase = + buildPhases->GetObject(cmXCodeObject::PBXFrameworksBuildPhase); + if (!frameworkBuildPhase) { + continue; + } + auto* buildFiles = frameworkBuildPhase->GetObject("files"); + if (!buildFiles) { + continue; + } + if (!buildFiles->HasObject(buildFile)) { + buildFiles->AddObject(buildFile); + } + } + // Loop over configuration types and set per-configuration info. for (auto const& configName : this->CurrentConfigurationTypes) { { @@ -2820,15 +2968,22 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) linkDirs += this->XCodeEscapePath(libDir); } } + // Add previously collected paths where to look for libraries + // that were added to "Link Binary With Libraries" + for (auto& linkDir : linkSearchPaths) { + linkDirs += " "; + linkDirs += this->XCodeEscapePath(linkDir); + } this->AppendBuildSettingAttribute(target, "LIBRARY_SEARCH_PATHS", linkDirs.c_str(), configName); } - // now add the link libraries + // now add the left-over link libraries { std::string linkLibs; const char* sep = ""; - for (auto const& libName : cli.GetItems()) { + for (auto const& libItem : configItemMap[configName]) { + auto const& libName = *libItem; linkLibs += sep; sep = " "; if (libName.IsPath) { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index f6fd9c5..0fc6558 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -295,6 +295,7 @@ private: std::map TargetGroup; std::map FileRefs; std::map XCodeObjectMap; + std::map FileRefToBuildFileMap; std::vector Architectures; std::string ObjectDirArchDefault; std::string ObjectDirArch; -- cgit v0.12 From 882483192d64866a1da0c5f44f8ac9b8a327f31f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 17 Jun 2020 06:54:48 -0400 Subject: cmake: Simplify internal conditions for adding extra generators They are always present except in the bootstrap `cmake`. --- Source/cmake.cxx | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 162e807..62a7fcb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -64,10 +64,6 @@ # include "cmVariableWatch.h" #endif -#if !defined(CMAKE_BOOTSTRAP) -# define CMAKE_USE_ECLIPSE -#endif - #if defined(__MINGW32__) && defined(CMAKE_BOOTSTRAP) # define CMAKE_BOOT_MINGW #endif @@ -101,16 +97,13 @@ #if !defined(CMAKE_BOOTSTRAP) # include "cmGlobalNinjaGenerator.h" #endif -#include "cmExtraCodeLiteGenerator.h" -#if !defined(CMAKE_BOOT_MINGW) +#if !defined(CMAKE_BOOTSTRAP) # include "cmExtraCodeBlocksGenerator.h" -#endif -#include "cmExtraKateGenerator.h" -#include "cmExtraSublimeTextGenerator.h" - -#ifdef CMAKE_USE_ECLIPSE +# include "cmExtraCodeLiteGenerator.h" # include "cmExtraEclipseCDT4Generator.h" +# include "cmExtraKateGenerator.h" +# include "cmExtraSublimeTextGenerator.h" #endif #if defined(__linux__) || defined(_WIN32) @@ -1137,13 +1130,9 @@ void cmake::AddDefaultExtraGenerators() #if !defined(CMAKE_BOOTSTRAP) this->ExtraGenerators.push_back(cmExtraCodeBlocksGenerator::GetFactory()); this->ExtraGenerators.push_back(cmExtraCodeLiteGenerator::GetFactory()); - this->ExtraGenerators.push_back(cmExtraSublimeTextGenerator::GetFactory()); - this->ExtraGenerators.push_back(cmExtraKateGenerator::GetFactory()); - -# ifdef CMAKE_USE_ECLIPSE this->ExtraGenerators.push_back(cmExtraEclipseCDT4Generator::GetFactory()); -# endif - + this->ExtraGenerators.push_back(cmExtraKateGenerator::GetFactory()); + this->ExtraGenerators.push_back(cmExtraSublimeTextGenerator::GetFactory()); #endif } -- cgit v0.12 From 61aa9128c390935c55fbc2d14a773683389c8a65 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 18 Jun 2020 00:02:13 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 40bf305..10ac7fe 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 18) -set(CMake_VERSION_PATCH 20200617) +set(CMake_VERSION_PATCH 20200618) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From ab6e1e49c0ad2395cb1f5befb9e8908256b3910c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 17 Jun 2020 06:56:28 -0400 Subject: Tests: Simplify addition of extra generator tests Do not try to run the `cmake` binary that has not been built yet. Always add the extra generator tests in combination with the corresponding Makefile and Ninja generators. --- Tests/CMakeLists.txt | 54 +++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b771ff5..4fb905e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -698,38 +698,28 @@ if(BUILD_TESTING) # build the "Simple" test with the ExtraGenerators, if available # This doesn't test whether the generated project files work (unfortunately), # mainly it tests that cmake doesn't crash when generating these project files. - if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_GENERATOR} MATCHES "Ninja") - - # check which generators we have - execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help - OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput) - - set(extraGenerators - "CodeBlocks" - "CodeLite" - "Eclipse CDT4" - "Kate" - "Sublime Text 2") - - foreach(extraGenerator ${extraGenerators}) - if ("${cmakeOutput}" MATCHES "${extraGenerator} - ${CMAKE_GENERATOR}") - set(extraGeneratorTestName "Simple_${extraGenerator}Generator") - string(REPLACE " " "" extraGeneratorTestName ${extraGeneratorTestName}) - - add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Simple" - "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}" - --build-two-config - --build-generator "${extraGenerator} - ${CMAKE_GENERATOR}" - --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" - --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --build-project Simple - --test-command Simple) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}") - endif () - endforeach(extraGenerator) - + if(CMAKE_GENERATOR MATCHES "^(Unix Makefiles|Ninja)$" + AND NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(extraGenerator + "CodeBlocks" + "CodeLite" + "Eclipse CDT4" + "Kate" + "Sublime Text 2" + ) + string(REPLACE " " "" extraGeneratorTestName "Simple_${extraGenerator}Generator") + add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Simple" + "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}" + --build-two-config + --build-generator "${extraGenerator} - ${CMAKE_GENERATOR}" + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-project Simple + --test-command Simple) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}") + endforeach() endif() # test for correct sub-project generation -- cgit v0.12 From fcea4a3b452c5126d826610f73fb669c2e600726 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 12 Jun 2020 06:52:47 -0400 Subject: cmStateSnapshot: Invert CanPopPolicyScope return value to match name --- Source/cmMakefile.cxx | 2 +- Source/cmStateSnapshot.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1f1c06a..3c1cba2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4605,7 +4605,7 @@ void cmMakefile::PopSnapshot(bool reportError) // cmStateSnapshot manages nested policy scopes within it. // Since the scope corresponding to the snapshot is closing, // reject any still-open nested policy scopes with an error. - while (!this->StateSnapshot.CanPopPolicyScope()) { + while (this->StateSnapshot.CanPopPolicyScope()) { if (reportError) { this->IssueMessage(MessageType::FATAL_ERROR, "cmake_policy PUSH without matching POP"); diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index c223431..15a98af 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -148,7 +148,7 @@ bool cmStateSnapshot::PopPolicy() bool cmStateSnapshot::CanPopPolicyScope() { - return this->Position->Policies == this->Position->PolicyScope; + return this->Position->Policies != this->Position->PolicyScope; } void cmStateSnapshot::SetPolicy(cmPolicies::PolicyID id, -- cgit v0.12 From 9b99b4bfc8e9280c7334047cf95a84408d84e931 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Jun 2020 06:34:04 -0400 Subject: Tests/RunCMake: Update cmake_minimum_required versions Use 3.3 or 2.8.12 where possible. --- Tests/RunCMake/CMP0026/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0027/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0028/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0037/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0041/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0042/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0043/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0045/CMakeLists.txt | 2 +- Tests/RunCMake/CTest/CMakeLists.txt | 2 +- Tests/RunCMake/CheckModules/CMakeLists.txt | 2 +- Tests/RunCMake/CompatibleInterface/CMakeLists.txt | 2 +- Tests/RunCMake/CompatibleInterface/DebugProperties.cmake | 2 +- .../CompatibleInterface/InterfaceString-builtin-prop.cmake | 2 +- Tests/RunCMake/CompilerChange/CMakeLists.txt | 2 +- Tests/RunCMake/CompilerNotFound/CMakeLists.txt | 2 +- Tests/RunCMake/Configure/CMakeLists.txt | 2 +- Tests/RunCMake/DisallowedCommands/CMakeLists.txt | 2 +- Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt | 2 +- Tests/RunCMake/ExternalData/CMakeLists.txt | 2 +- Tests/RunCMake/FPHSA/CMakeLists.txt | 2 +- Tests/RunCMake/FeatureSummary/CMakeLists.txt | 2 +- Tests/RunCMake/File_Generate/CMakeLists.txt | 2 +- Tests/RunCMake/FindPkgConfig/CMakeLists.txt | 2 +- Tests/RunCMake/GeneratorExpression/CMakeLists.txt | 2 +- Tests/RunCMake/GeneratorPlatform/CMakeLists.txt | 2 +- Tests/RunCMake/GeneratorToolset/CMakeLists.txt | 2 +- Tests/RunCMake/IncompatibleQt/CMakeLists.txt | 2 +- Tests/RunCMake/Languages/CMakeLists.txt | 3 +-- Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt | 2 +- Tests/RunCMake/PositionIndependentCode/CMakeLists.txt | 2 +- Tests/RunCMake/SourceProperties/CMakeLists.txt | 2 +- Tests/RunCMake/TargetObjects/CMakeLists.txt | 2 +- Tests/RunCMake/TargetPolicies/CMakeLists.txt | 2 +- Tests/RunCMake/TargetProperties/CMakeLists.txt | 2 +- .../TargetPropertyGeneratorExpressions/CMakeLists.txt | 2 +- Tests/RunCMake/TargetSources/CMakeLists.txt | 2 +- Tests/RunCMake/VSSolution/CMakeLists.txt | 2 +- Tests/RunCMake/XcodeProject/CMakeLists.txt | 2 +- Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake | 2 +- Tests/RunCMake/add_dependencies/CMakeLists.txt | 2 +- Tests/RunCMake/alias_targets/CMakeLists.txt | 2 +- Tests/RunCMake/alias_targets/invalid-name.cmake | 2 +- Tests/RunCMake/build_command/CMakeLists.txt | 2 +- Tests/RunCMake/cmake_minimum_required/CMakeLists.txt | 2 +- Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in | 2 +- Tests/RunCMake/ctest_memcheck/test.cmake.in | 2 +- Tests/RunCMake/export/CMakeLists.txt | 2 +- Tests/RunCMake/find_dependency/CMakeLists.txt | 2 +- Tests/RunCMake/find_package/CMakeLists.txt | 2 +- .../find_package/MissingNormalWarnNoModuleOld-stderr.txt | 11 ++++++----- Tests/RunCMake/get_property/CMakeLists.txt | 2 +- Tests/RunCMake/if/CMakeLists.txt | 2 +- Tests/RunCMake/include/CMakeLists.txt | 2 +- Tests/RunCMake/include_external_msproject/CMakeLists.txt | 2 +- Tests/RunCMake/interface_library/CMakeLists.txt | 2 +- Tests/RunCMake/interface_library/invalid_name.cmake | 2 +- Tests/RunCMake/list/CMakeLists.txt | 2 +- Tests/RunCMake/math/CMakeLists.txt | 2 +- Tests/RunCMake/message/CMakeLists.txt | 2 +- Tests/RunCMake/no_install_prefix/CMakeLists.txt | 2 +- Tests/RunCMake/project/CMakeLists.txt | 2 +- Tests/RunCMake/string/CMakeLists.txt | 2 +- Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake | 2 +- Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake | 2 +- Tests/RunCMake/target_link_libraries/CMakeLists.txt | 2 +- .../target_link_libraries/StaticPrivateDepNotExported.cmake | 1 - .../target_link_libraries/StaticPrivateDepNotTarget.cmake | 1 - Tests/RunCMake/try_compile/CMP0056.cmake | 1 + Tests/RunCMake/try_compile/CMakeLists.txt | 2 +- Tests/RunCMake/try_compile/proj/CMakeLists.txt | 2 +- Tests/RunCMake/try_run/CMakeLists.txt | 2 +- Tests/RunCMake/variable_watch/CMakeLists.txt | 2 +- Tests/RunCMake/while/CMakeLists.txt | 2 +- 73 files changed, 76 insertions(+), 77 deletions(-) diff --git a/Tests/RunCMake/CMP0026/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/CMP0026/CMakeLists.txt +++ b/Tests/RunCMake/CMP0026/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0027/CMakeLists.txt b/Tests/RunCMake/CMP0027/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/CMP0027/CMakeLists.txt +++ b/Tests/RunCMake/CMP0027/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0028/CMakeLists.txt b/Tests/RunCMake/CMP0028/CMakeLists.txt index 144cdb4..4f867df 100644 --- a/Tests/RunCMake/CMP0028/CMakeLists.txt +++ b/Tests/RunCMake/CMP0028/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) # policy used at end of dir diff --git a/Tests/RunCMake/CMP0037/CMakeLists.txt b/Tests/RunCMake/CMP0037/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/CMP0037/CMakeLists.txt +++ b/Tests/RunCMake/CMP0037/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0041/CMakeLists.txt b/Tests/RunCMake/CMP0041/CMakeLists.txt index f452db1..a06591c 100644 --- a/Tests/RunCMake/CMP0041/CMakeLists.txt +++ b/Tests/RunCMake/CMP0041/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0042/CMakeLists.txt b/Tests/RunCMake/CMP0042/CMakeLists.txt index f452db1..a06591c 100644 --- a/Tests/RunCMake/CMP0042/CMakeLists.txt +++ b/Tests/RunCMake/CMP0042/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0043/CMakeLists.txt b/Tests/RunCMake/CMP0043/CMakeLists.txt index d027f3e..cc8a6f8 100644 --- a/Tests/RunCMake/CMP0043/CMakeLists.txt +++ b/Tests/RunCMake/CMP0043/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) # policy used at end of dir diff --git a/Tests/RunCMake/CMP0045/CMakeLists.txt b/Tests/RunCMake/CMP0045/CMakeLists.txt index f452db1..a06591c 100644 --- a/Tests/RunCMake/CMP0045/CMakeLists.txt +++ b/Tests/RunCMake/CMP0045/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CTest/CMakeLists.txt b/Tests/RunCMake/CTest/CMakeLists.txt index 73e6a78..f1a83e8 100644 --- a/Tests/RunCMake/CTest/CMakeLists.txt +++ b/Tests/RunCMake/CTest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) if(NOT NoProject) project(${RunCMake_TEST} NONE) endif() diff --git a/Tests/RunCMake/CheckModules/CMakeLists.txt b/Tests/RunCMake/CheckModules/CMakeLists.txt index 9872df2..842c5cf 100644 --- a/Tests/RunCMake/CheckModules/CMakeLists.txt +++ b/Tests/RunCMake/CheckModules/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 2.8.12) cmake_policy(SET CMP0054 NEW) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompatibleInterface/CMakeLists.txt b/Tests/RunCMake/CompatibleInterface/CMakeLists.txt index f452db1..ebab7a3 100644 --- a/Tests/RunCMake/CompatibleInterface/CMakeLists.txt +++ b/Tests/RunCMake/CompatibleInterface/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake index 0196611..64b52d9 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.3) project(CompatibleInterface) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake index 5772856..f072eb0 100644 --- a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake @@ -5,5 +5,5 @@ add_library(bar UNKNOWN IMPORTED) set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING INCLUDE_DIRECTORIES) add_executable(user main.cpp) -set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES bar_inc) +set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/bar_inc) target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompilerChange/CMakeLists.txt b/Tests/RunCMake/CompilerChange/CMakeLists.txt index b4b3016..14c47ad 100644 --- a/Tests/RunCMake/CompilerChange/CMakeLists.txt +++ b/Tests/RunCMake/CompilerChange/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) if(NOT RunCMake_TEST) set(RunCMake_TEST "$ENV{RunCMake_TEST}") # needed when cache is deleted endif() diff --git a/Tests/RunCMake/CompilerNotFound/CMakeLists.txt b/Tests/RunCMake/CompilerNotFound/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/CompilerNotFound/CMakeLists.txt +++ b/Tests/RunCMake/CompilerNotFound/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Configure/CMakeLists.txt b/Tests/RunCMake/Configure/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/Configure/CMakeLists.txt +++ b/Tests/RunCMake/Configure/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt +++ b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt b/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt +++ b/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalData/CMakeLists.txt b/Tests/RunCMake/ExternalData/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/ExternalData/CMakeLists.txt +++ b/Tests/RunCMake/ExternalData/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FPHSA/CMakeLists.txt b/Tests/RunCMake/FPHSA/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/FPHSA/CMakeLists.txt +++ b/Tests/RunCMake/FPHSA/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FeatureSummary/CMakeLists.txt b/Tests/RunCMake/FeatureSummary/CMakeLists.txt index 72abfc8..74b3ff8 100644 --- a/Tests/RunCMake/FeatureSummary/CMakeLists.txt +++ b/Tests/RunCMake/FeatureSummary/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/File_Generate/CMakeLists.txt b/Tests/RunCMake/File_Generate/CMakeLists.txt index bc0cf5d..3178de5 100644 --- a/Tests/RunCMake/File_Generate/CMakeLists.txt +++ b/Tests/RunCMake/File_Generate/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) if(NOT TEST_FILE) set(TEST_FILE ${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindPkgConfig/CMakeLists.txt b/Tests/RunCMake/FindPkgConfig/CMakeLists.txt index 72abfc8..74b3ff8 100644 --- a/Tests/RunCMake/FindPkgConfig/CMakeLists.txt +++ b/Tests/RunCMake/FindPkgConfig/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt +++ b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt b/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt +++ b/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorToolset/CMakeLists.txt b/Tests/RunCMake/GeneratorToolset/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/GeneratorToolset/CMakeLists.txt +++ b/Tests/RunCMake/GeneratorToolset/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/IncompatibleQt/CMakeLists.txt b/Tests/RunCMake/IncompatibleQt/CMakeLists.txt index f452db1..ebab7a3 100644 --- a/Tests/RunCMake/IncompatibleQt/CMakeLists.txt +++ b/Tests/RunCMake/IncompatibleQt/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Languages/CMakeLists.txt b/Tests/RunCMake/Languages/CMakeLists.txt index 8996fef..74b3ff8 100644 --- a/Tests/RunCMake/Languages/CMakeLists.txt +++ b/Tests/RunCMake/Languages/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) -cmake_policy(SET CMP0042 NEW) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt b/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt index 65ac8e8..44b5d30 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt +++ b/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST}) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt b/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt index 90afc12..c3922d6 100644 --- a/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt +++ b/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} CXX) # MSVC creates extra targets which pollute the stderr unless we set this. diff --git a/Tests/RunCMake/SourceProperties/CMakeLists.txt b/Tests/RunCMake/SourceProperties/CMakeLists.txt index a17c8cd..e93f0b6 100644 --- a/Tests/RunCMake/SourceProperties/CMakeLists.txt +++ b/Tests/RunCMake/SourceProperties/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetObjects/CMakeLists.txt b/Tests/RunCMake/TargetObjects/CMakeLists.txt index be9d403..44b5d30 100644 --- a/Tests/RunCMake/TargetObjects/CMakeLists.txt +++ b/Tests/RunCMake/TargetObjects/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST}) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetPolicies/CMakeLists.txt b/Tests/RunCMake/TargetPolicies/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/TargetPolicies/CMakeLists.txt +++ b/Tests/RunCMake/TargetPolicies/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetProperties/CMakeLists.txt b/Tests/RunCMake/TargetProperties/CMakeLists.txt index be9d403..44b5d30 100644 --- a/Tests/RunCMake/TargetProperties/CMakeLists.txt +++ b/Tests/RunCMake/TargetProperties/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST}) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt index 90afc12..c3922d6 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} CXX) # MSVC creates extra targets which pollute the stderr unless we set this. diff --git a/Tests/RunCMake/TargetSources/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMakeLists.txt index f452db1..a06591c 100644 --- a/Tests/RunCMake/TargetSources/CMakeLists.txt +++ b/Tests/RunCMake/TargetSources/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/VSSolution/CMakeLists.txt b/Tests/RunCMake/VSSolution/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/VSSolution/CMakeLists.txt +++ b/Tests/RunCMake/VSSolution/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcodeProject/CMakeLists.txt b/Tests/RunCMake/XcodeProject/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/XcodeProject/CMakeLists.txt +++ b/Tests/RunCMake/XcodeProject/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake index ab31387..75da7b1 100644 --- a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.5) +cmake_minimum_required(VERSION 3.3) project(XcodeInstallIOS) diff --git a/Tests/RunCMake/add_dependencies/CMakeLists.txt b/Tests/RunCMake/add_dependencies/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/add_dependencies/CMakeLists.txt +++ b/Tests/RunCMake/add_dependencies/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/alias_targets/CMakeLists.txt b/Tests/RunCMake/alias_targets/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/alias_targets/CMakeLists.txt +++ b/Tests/RunCMake/alias_targets/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/alias_targets/invalid-name.cmake b/Tests/RunCMake/alias_targets/invalid-name.cmake index bbd39e3..01983e5 100644 --- a/Tests/RunCMake/alias_targets/invalid-name.cmake +++ b/Tests/RunCMake/alias_targets/invalid-name.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 2.8.12) enable_language(CXX) add_library(foo empty.cpp) diff --git a/Tests/RunCMake/build_command/CMakeLists.txt b/Tests/RunCMake/build_command/CMakeLists.txt index 73e6a78..f1a83e8 100644 --- a/Tests/RunCMake/build_command/CMakeLists.txt +++ b/Tests/RunCMake/build_command/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) if(NOT NoProject) project(${RunCMake_TEST} NONE) endif() diff --git a/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt index e8db6b0..4b3de84 100644 --- a/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt +++ b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in b/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in index 3b8edf4..68a0fcb 100644 --- a/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 3.3) project(CTestTestMemcheck@CASE_NAME@ NONE) include(CTest) diff --git a/Tests/RunCMake/ctest_memcheck/test.cmake.in b/Tests/RunCMake/ctest_memcheck/test.cmake.in index 50b4b6a..eedf080 100644 --- a/Tests/RunCMake/ctest_memcheck/test.cmake.in +++ b/Tests/RunCMake/ctest_memcheck/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 3.3) # Settings: set(CTEST_SITE "@SITE@") diff --git a/Tests/RunCMake/export/CMakeLists.txt b/Tests/RunCMake/export/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/export/CMakeLists.txt +++ b/Tests/RunCMake/export/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_dependency/CMakeLists.txt b/Tests/RunCMake/find_dependency/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/find_dependency/CMakeLists.txt +++ b/Tests/RunCMake/find_dependency/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_package/CMakeLists.txt b/Tests/RunCMake/find_package/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/find_package/CMakeLists.txt +++ b/Tests/RunCMake/find_package/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt index b336b56..ebfd7d0 100644 --- a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt +++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt @@ -1,9 +1,10 @@ CMake Warning \(dev\) at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\): - find_package called without NO_MODULE option and no FindNotHere.cmake - module is in CMAKE_MODULE_PATH. Add NO_MODULE to exclusively request - Config mode and search for a package configuration file provided by NotHere - \(NotHereConfig.cmake or nothere-config.cmake\). Otherwise make - FindNotHere.cmake available in CMAKE_MODULE_PATH. + find_package called without either MODULE or CONFIG option and no + FindNotHere.cmake module is in CMAKE_MODULE_PATH. Add MODULE to + exclusively request Module mode and fail if FindNotHere.cmake is missing. + Add CONFIG to exclusively request Config mode and search for a package + configuration file provided by NotHere \(NotHereConfig.cmake or + nothere-config.cmake\). \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\) Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/get_property/CMakeLists.txt b/Tests/RunCMake/get_property/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/get_property/CMakeLists.txt +++ b/Tests/RunCMake/get_property/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/if/CMakeLists.txt b/Tests/RunCMake/if/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/if/CMakeLists.txt +++ b/Tests/RunCMake/if/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include/CMakeLists.txt b/Tests/RunCMake/include/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/include/CMakeLists.txt +++ b/Tests/RunCMake/include/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/CMakeLists.txt b/Tests/RunCMake/include_external_msproject/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/include_external_msproject/CMakeLists.txt +++ b/Tests/RunCMake/include_external_msproject/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/interface_library/CMakeLists.txt b/Tests/RunCMake/interface_library/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/interface_library/CMakeLists.txt +++ b/Tests/RunCMake/interface_library/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/interface_library/invalid_name.cmake b/Tests/RunCMake/interface_library/invalid_name.cmake index 9a965aa..575fcc6 100644 --- a/Tests/RunCMake/interface_library/invalid_name.cmake +++ b/Tests/RunCMake/interface_library/invalid_name.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 2.8.12) add_library(if$ace INTERFACE) add_library(iface::target INTERFACE) diff --git a/Tests/RunCMake/list/CMakeLists.txt b/Tests/RunCMake/list/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/list/CMakeLists.txt +++ b/Tests/RunCMake/list/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/math/CMakeLists.txt b/Tests/RunCMake/math/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/math/CMakeLists.txt +++ b/Tests/RunCMake/math/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/message/CMakeLists.txt b/Tests/RunCMake/message/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/message/CMakeLists.txt +++ b/Tests/RunCMake/message/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/no_install_prefix/CMakeLists.txt b/Tests/RunCMake/no_install_prefix/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/no_install_prefix/CMakeLists.txt +++ b/Tests/RunCMake/no_install_prefix/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/project/CMakeLists.txt b/Tests/RunCMake/project/CMakeLists.txt index 12cd3c7..4b3de84 100644 --- a/Tests/RunCMake/project/CMakeLists.txt +++ b/Tests/RunCMake/project/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/string/CMakeLists.txt b/Tests/RunCMake/string/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/string/CMakeLists.txt +++ b/Tests/RunCMake/string/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake index 2e9cba8..6c72546 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 2.8.11) project(CMP0022-WARN) add_library(foo SHARED empty_vs6_1.cpp) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake index fcc8da0..dfdf70b 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 2.8.11) project(CMP0022-WARN) add_library(foo SHARED empty_vs6_1.cpp) diff --git a/Tests/RunCMake/target_link_libraries/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMakeLists.txt index 8f85fbf..667561e 100644 --- a/Tests/RunCMake/target_link_libraries/CMakeLists.txt +++ b/Tests/RunCMake/target_link_libraries/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake index 9b97918..9f86b18 100644 --- a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0022 NEW) enable_language(C) add_library(foo STATIC empty.c) add_library(not_exported STATIC empty.c) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake index 7122ae9..20ec438 100644 --- a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0022 NEW) enable_language(C) add_library(foo STATIC empty.c) target_link_libraries(foo PRIVATE not_a_target) diff --git a/Tests/RunCMake/try_compile/CMP0056.cmake b/Tests/RunCMake/try_compile/CMP0056.cmake index e8d3d4a..2ab79d5 100644 --- a/Tests/RunCMake/try_compile/CMP0056.cmake +++ b/Tests/RunCMake/try_compile/CMP0056.cmake @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.1) enable_language(C) set(obj "${CMAKE_C_OUTPUT_EXTENSION}") if(BORLAND) diff --git a/Tests/RunCMake/try_compile/CMakeLists.txt b/Tests/RunCMake/try_compile/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/try_compile/CMakeLists.txt +++ b/Tests/RunCMake/try_compile/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/try_compile/proj/CMakeLists.txt b/Tests/RunCMake/try_compile/proj/CMakeLists.txt index 78a87c0..652f5b6 100644 --- a/Tests/RunCMake/try_compile/proj/CMakeLists.txt +++ b/Tests/RunCMake/try_compile/proj/CMakeLists.txt @@ -1,2 +1,2 @@ -cmake_minimum_required(VERSION 2.8.10) +cmake_minimum_required(VERSION 3.3) project(TestProject NONE) diff --git a/Tests/RunCMake/try_run/CMakeLists.txt b/Tests/RunCMake/try_run/CMakeLists.txt index e034780..e93f0b6 100644 --- a/Tests/RunCMake/try_run/CMakeLists.txt +++ b/Tests/RunCMake/try_run/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.0) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/variable_watch/CMakeLists.txt b/Tests/RunCMake/variable_watch/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/variable_watch/CMakeLists.txt +++ b/Tests/RunCMake/variable_watch/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/while/CMakeLists.txt b/Tests/RunCMake/while/CMakeLists.txt index 12cd3c7..74b3ff8 100644 --- a/Tests/RunCMake/while/CMakeLists.txt +++ b/Tests/RunCMake/while/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.3) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) -- cgit v0.12 From 7b07ccdd2b8d621211ee1642e8b62b005b0cd60f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 15 Jun 2020 12:05:42 -0400 Subject: Tests/*Only: Update cmake_minimum_required versions Use 3.3 or 2.8.12 where possible. --- Tests/COnly/CMakeLists.txt | 2 +- Tests/CSharpOnly/CMakeLists.txt | 1 + Tests/CxxOnly/CMakeLists.txt | 1 + Tests/FortranOnly/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt index 20615fe..1c24017 100644 --- a/Tests/COnly/CMakeLists.txt +++ b/Tests/COnly/CMakeLists.txt @@ -1,5 +1,5 @@ # a simple C only test case -cmake_minimum_required (VERSION 2.6) +cmake_minimum_required(VERSION 2.8.12) project (COnly C) set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") diff --git a/Tests/CSharpOnly/CMakeLists.txt b/Tests/CSharpOnly/CMakeLists.txt index 42cbe2e..195af05 100644 --- a/Tests/CSharpOnly/CMakeLists.txt +++ b/Tests/CSharpOnly/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.3) # a simple CSharp only test case project (CSharpOnly CSharp) diff --git a/Tests/CxxOnly/CMakeLists.txt b/Tests/CxxOnly/CMakeLists.txt index 8207dd1..09689cb 100644 --- a/Tests/CxxOnly/CMakeLists.txt +++ b/Tests/CxxOnly/CMakeLists.txt @@ -1,4 +1,5 @@ # a simple CXX only test case +cmake_minimum_required(VERSION 2.8.12) project (CxxOnly CXX) set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index d24df2d..637f581 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12) project(FortranOnly Fortran) message("CTEST_FULL_OUTPUT ") -- cgit v0.12 From 5845c218d771b517aa4294f0a90267e6f3f64891 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 12 Jun 2020 08:41:32 -0400 Subject: Deprecate compatibility with CMake versions older than 2.8.12 Issue a deprecation warning on calls to `cmake_minimum_required` or `cmake_policy` that set policies based on versions older than 2.8.12. Note that the effective policy version includes `...` treatment. This is important in combination with commit ca24b70d31 (Export: Specify a policy range in exported files, 2020-05-16, v3.18.0-rc1~133^2). --- Help/release/dev/deprecate-policy-old.rst | 5 ++++ Source/cmMakefile.cxx | 6 +++-- Source/cmPolicies.cxx | 30 +++++++++++++++++++--- Source/cmPolicies.h | 12 +++++++-- Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt | 6 +++++ Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt | 9 ++++++- Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt | 7 +++++ .../RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt | 6 +++++ .../CMP0022/CMP0022-NOWARN-shared-stderr.txt | 6 +++++ .../CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt | 6 +++++ ...CMP0022-NOWARN-static-link_libraries-stderr.txt | 6 +++++ .../CMP0022/CMP0022-NOWARN-static-stderr.txt | 6 +++++ .../CMP0022/CMP0022-WARN-empty-old-stderr.txt | 7 +++++ Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt | 9 ++++++- .../RunCMake/CMP0022/CMP0022-export-exe-stderr.txt | 6 +++++ .../cmake_minimum_required/Before2812-stderr.txt | 26 +++++++++++++++++++ .../cmake_minimum_required/Before2812.cmake | 6 +++++ .../RunCMake/cmake_minimum_required/CMakeLists.txt | 2 +- .../CompatBefore24-stderr.txt | 9 +++++++ .../cmake_minimum_required/RunCMakeTest.cmake | 1 + Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt | 11 +++++++- 21 files changed, 171 insertions(+), 11 deletions(-) create mode 100644 Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt create mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt create mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt create mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt create mode 100644 Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt create mode 100644 Tests/RunCMake/cmake_minimum_required/Before2812-stderr.txt create mode 100644 Tests/RunCMake/cmake_minimum_required/Before2812.cmake diff --git a/Help/release/dev/deprecate-policy-old.rst b/Help/release/dev/deprecate-policy-old.rst index f92aea7..1dc01cc 100644 --- a/Help/release/dev/deprecate-policy-old.rst +++ b/Help/release/dev/deprecate-policy-old.rst @@ -6,3 +6,8 @@ deprecate-policy-old The :manual:`cmake-policies(7)` manual explains that the OLD behaviors of all policies are deprecated and that projects should port to the NEW behaviors. + +* Compatibility with versions of CMake older than 2.8.12 is now deprecated + and will be removed from a future version. Calls to + :command:`cmake_minimum_required` or :command:`cmake_policy` that set + the policy version to an older value now issue a deprecation diagnostic. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3c1cba2..891e290 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1659,7 +1659,8 @@ void cmMakefile::Configure() this->SetCheckCMP0000(true); // Implicitly set the version for the user. - this->SetPolicyVersion("2.4", std::string()); + cmPolicies::ApplyPolicyVersion(this, 2, 4, 0, + cmPolicies::WarnCompat::Off); } } bool hasProject = false; @@ -4621,7 +4622,8 @@ void cmMakefile::PopSnapshot(bool reportError) bool cmMakefile::SetPolicyVersion(std::string const& version_min, std::string const& version_max) { - return cmPolicies::ApplyPolicyVersion(this, version_min, version_max); + return cmPolicies::ApplyPolicyVersion(this, version_min, version_max, + cmPolicies::WarnCompat::On); } bool cmMakefile::HasCMP0054AlreadyBeenReported( diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index dea3f8a..01e8c04 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -7,9 +7,11 @@ #include #include +#include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmState.h" +#include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -157,7 +159,8 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, std::string const& version_min, - std::string const& version_max) + std::string const& version_max, + WarnCompat warnCompat) { // Parse components of the minimum version. unsigned int minMajor = 2; @@ -244,13 +247,34 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, polPatch = maxPatch; } - return cmPolicies::ApplyPolicyVersion(mf, polMajor, polMinor, polPatch); + return cmPolicies::ApplyPolicyVersion(mf, polMajor, polMinor, polPatch, + warnCompat); } bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer, unsigned int minorVer, - unsigned int patchVer) + unsigned int patchVer, + WarnCompat warnCompat) { + // Warn about policy versions for which support will be removed. + if (warnCompat == WarnCompat::On && + (majorVer < 2 || (majorVer == 2 && minorVer < 8) || + (majorVer == 2 && minorVer == 8 && patchVer < 12)) && + // Avoid warning on calls generated by install(EXPORT) + // in CMake versions prior to 3.18. + !(majorVer == 2 && minorVer == 6 && patchVer == 0 && + mf->GetStateSnapshot().CanPopPolicyScope() && + cmSystemTools::Strucmp(mf->GetBacktrace().Top().Name.c_str(), + "cmake_policy") == 0)) { + mf->IssueMessage( + MessageType::DEPRECATION_WARNING, + "Compatibility with CMake < 2.8.12 will be removed from " + "a future version of CMake.\n" + "Update the VERSION argument value or use a ... suffix " + "to tell CMake that the project does not need compatibility with " + "older versions."); + } + // now loop over all the policies and set them as appropriate std::vector ancientPolicies; for (PolicyID pid = cmPolicies::CMP0000; pid != cmPolicies::CMPCOUNT; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 49dadc7..bba8b03 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -399,12 +399,20 @@ public: //! Get the default status for a policy static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); + enum class WarnCompat + { + Off, + On + }; + //! Set a policy level for this listfile static bool ApplyPolicyVersion(cmMakefile* mf, std::string const& version_min, - std::string const& version_max); + std::string const& version_max, + WarnCompat warnCompat); static bool ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer, - unsigned int minorVer, unsigned int patchVer); + unsigned int minorVer, unsigned int patchVer, + WarnCompat warnCompat); //! return a warning string for a given policy static std::string GetPolicyWarning(cmPolicies::PolicyID id); diff --git a/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt index 048762d..a446211 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt @@ -1,4 +1,11 @@ -^CMake Deprecation Warning at CMP0019-OLD.cmake:[0-9]+ \(cmake_policy\): +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. ++ +CMake Deprecation Warning at CMP0019-OLD.cmake:[0-9]+ \(cmake_policy\): The OLD behavior for policy CMP0019 will be removed from a future version of CMake. diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt index 1e4b47d..f7b9c0e 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt @@ -1,3 +1,10 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. ++ CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0019 is not set: Do not re-expand variables in include and link information. Run "cmake --help-policy CMP0019" for policy details. Use diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt index 6a6a0c7..87404d3 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt @@ -1,3 +1,10 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. ++ CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link interface. Run "cmake --help-policy CMP0022" for policy details. Use the diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt index 2f7dfbf..5d75720 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt @@ -1,4 +1,11 @@ -^CMake Warning \(dev\) in CMakeLists.txt: +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. ++ +CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link interface. Run "cmake --help-policy CMP0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt new file mode 100644 index 0000000..66a58fb --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt @@ -0,0 +1,6 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/cmake_minimum_required/Before2812-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Before2812-stderr.txt new file mode 100644 index 0000000..7d40dcb --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Before2812-stderr.txt @@ -0,0 +1,26 @@ +^CMake Deprecation Warning at Before2812.cmake:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at Before2812.cmake:2 \(cmake_policy\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at Before2812.cmake:6 \(cmake_policy\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_minimum_required/Before2812.cmake b/Tests/RunCMake/cmake_minimum_required/Before2812.cmake new file mode 100644 index 0000000..220e359 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Before2812.cmake @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8.11) +cmake_policy(VERSION 2.6) +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) # simulate pre-3.18 install(EXPORT)-generated call +cmake_policy(POP) +cmake_policy(VERSION 2.8.11) diff --git a/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt index 4b3de84..667561e 100644 --- a/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt +++ b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt index a874466..81d26d2 100644 --- a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt +++ b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt @@ -1,3 +1,12 @@ +^CMake Deprecation Warning at CompatBefore24.cmake:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Error in CMakeLists.txt: You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less than 2.4. This version of CMake only supports backwards compatibility with diff --git a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake index 1030211..3a959bb 100644 --- a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake @@ -4,6 +4,7 @@ run_cmake(Before24) run_cmake(CompatBefore24) run_cmake(Future) run_cmake(PolicyBefore24) +run_cmake(Before2812) run_cmake(Range) run_cmake(RangeBad) run_cmake(Unknown) diff --git a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt index a0f8837..9103bd2 100644 --- a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt +++ b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt @@ -1,4 +1,13 @@ -^CMake Warning \(dev\) at GET-CMP0007-WARN.cmake:4 \(list\): +^CMake Deprecation Warning at GET-CMP0007-WARN.cmake:1 \(cmake_policy\): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Warning \(dev\) at GET-CMP0007-WARN.cmake:4 \(list\): Policy CMP0007 is not set: list command no longer ignores empty elements. Run "cmake --help-policy CMP0007" for policy details. Use the cmake_policy command to set the policy and suppress this warning. List has value = -- cgit v0.12 From 470b3a76b363951c343d5523bb9de77c9ba4bf16 Mon Sep 17 00:00:00 2001 From: Asit Dhal Date: Thu, 18 Jun 2020 08:26:32 +0200 Subject: get_filename_component: make errors fatal Make all errors in `get_filename_component` fatal. Fixes: #20015 --- Source/cmGetFilenameComponentCommand.cxx | 2 ++ Tests/RunCMake/get_filename_component/IncorrectArguments-result.txt | 1 + Tests/RunCMake/get_filename_component/IncorrectArguments-stderr.txt | 4 ++++ Tests/RunCMake/get_filename_component/IncorrectArguments.cmake | 2 ++ Tests/RunCMake/get_filename_component/RunCMakeTest.cmake | 1 + Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt | 4 ++-- Tests/RunCMake/get_filename_component/UnknownComponent.cmake | 1 + 7 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 Tests/RunCMake/get_filename_component/IncorrectArguments-result.txt create mode 100644 Tests/RunCMake/get_filename_component/IncorrectArguments-stderr.txt create mode 100644 Tests/RunCMake/get_filename_component/IncorrectArguments.cmake diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 811421a..38bffbf 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -14,6 +14,7 @@ bool cmGetFilenameComponentCommand(std::vector const& args, { if (args.size() < 3) { status.SetError("called with incorrect number of arguments"); + cmSystemTools::SetFatalErrorOccured(); return false; } @@ -114,6 +115,7 @@ bool cmGetFilenameComponentCommand(std::vector const& args, } else { std::string err = "unknown component " + args[2]; status.SetError(err); + cmSystemTools::SetFatalErrorOccured(); return false; } diff --git a/Tests/RunCMake/get_filename_component/IncorrectArguments-result.txt b/Tests/RunCMake/get_filename_component/IncorrectArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_filename_component/IncorrectArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_filename_component/IncorrectArguments-stderr.txt b/Tests/RunCMake/get_filename_component/IncorrectArguments-stderr.txt new file mode 100644 index 0000000..af08afa --- /dev/null +++ b/Tests/RunCMake/get_filename_component/IncorrectArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at IncorrectArguments.cmake:1 \(get_filename_component\): + get_filename_component called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_filename_component/IncorrectArguments.cmake b/Tests/RunCMake/get_filename_component/IncorrectArguments.cmake new file mode 100644 index 0000000..e329e29 --- /dev/null +++ b/Tests/RunCMake/get_filename_component/IncorrectArguments.cmake @@ -0,0 +1,2 @@ +get_filename_component(var) +message("The error is fatal, so this should not print") diff --git a/Tests/RunCMake/get_filename_component/RunCMakeTest.cmake b/Tests/RunCMake/get_filename_component/RunCMakeTest.cmake index 156fc8f..a7820a0 100644 --- a/Tests/RunCMake/get_filename_component/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_filename_component/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +run_cmake(IncorrectArguments) run_cmake(KnownComponents) run_cmake(UnknownComponent) diff --git a/Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt b/Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt index b146e5b..f86a688 100644 --- a/Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt +++ b/Tests/RunCMake/get_filename_component/UnknownComponent-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at UnknownComponent.cmake:1 \(get_filename_component\): +^CMake Error at UnknownComponent.cmake:1 \(get_filename_component\): get_filename_component unknown component BOGUS Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_filename_component/UnknownComponent.cmake b/Tests/RunCMake/get_filename_component/UnknownComponent.cmake index 06abc51..19521ba 100644 --- a/Tests/RunCMake/get_filename_component/UnknownComponent.cmake +++ b/Tests/RunCMake/get_filename_component/UnknownComponent.cmake @@ -1 +1,2 @@ get_filename_component(var "/path/to/filename.ext.in" BOGUS) +message("The error is fatal, so this should not print") -- cgit v0.12 From 0e16da823397d61fe8944f7b043cd99bc6f10ad0 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 18 Jun 2020 14:44:02 -0400 Subject: cmCoreTryCompile use anonymous namespace instead of static --- Source/cmCoreTryCompile.cxx | 66 ++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 0aa5da0..87f2bb5 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -165,61 +165,53 @@ private: std::string RequiredValue; std::string ExtensionValue; }; -} -static std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN = +std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN = "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN"; -static std::string const kCMAKE_C_COMPILER_TARGET = "CMAKE_C_COMPILER_TARGET"; -static std::string const kCMAKE_C_LINK_NO_PIE_SUPPORTED = +std::string const kCMAKE_C_COMPILER_TARGET = "CMAKE_C_COMPILER_TARGET"; +std::string const kCMAKE_C_LINK_NO_PIE_SUPPORTED = "CMAKE_C_LINK_NO_PIE_SUPPORTED"; -static std::string const kCMAKE_C_LINK_PIE_SUPPORTED = - "CMAKE_C_LINK_PIE_SUPPORTED"; -static std::string const kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN = +std::string const kCMAKE_C_LINK_PIE_SUPPORTED = "CMAKE_C_LINK_PIE_SUPPORTED"; +std::string const kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN = "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN"; -static std::string const kCMAKE_CXX_COMPILER_TARGET = - "CMAKE_CXX_COMPILER_TARGET"; -static std::string const kCMAKE_CXX_LINK_NO_PIE_SUPPORTED = +std::string const kCMAKE_CXX_COMPILER_TARGET = "CMAKE_CXX_COMPILER_TARGET"; +std::string const kCMAKE_CXX_LINK_NO_PIE_SUPPORTED = "CMAKE_CXX_LINK_NO_PIE_SUPPORTED"; -static std::string const kCMAKE_CXX_LINK_PIE_SUPPORTED = +std::string const kCMAKE_CXX_LINK_PIE_SUPPORTED = "CMAKE_CXX_LINK_PIE_SUPPORTED"; -static std::string const kCMAKE_CUDA_ARCHITECTURES = - "CMAKE_CUDA_ARCHITECTURES"; -static std::string const kCMAKE_CUDA_COMPILER_TARGET = - "CMAKE_CUDA_COMPILER_TARGET"; -static std::string const kCMAKE_CUDA_RUNTIME_LIBRARY = - "CMAKE_CUDA_RUNTIME_LIBRARY"; -static std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS"; -static std::string const kCMAKE_LINK_SEARCH_END_STATIC = +std::string const kCMAKE_CUDA_ARCHITECTURES = "CMAKE_CUDA_ARCHITECTURES"; +std::string const kCMAKE_CUDA_COMPILER_TARGET = "CMAKE_CUDA_COMPILER_TARGET"; +std::string const kCMAKE_CUDA_RUNTIME_LIBRARY = "CMAKE_CUDA_RUNTIME_LIBRARY"; +std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS"; +std::string const kCMAKE_LINK_SEARCH_END_STATIC = "CMAKE_LINK_SEARCH_END_STATIC"; -static std::string const kCMAKE_LINK_SEARCH_START_STATIC = +std::string const kCMAKE_LINK_SEARCH_START_STATIC = "CMAKE_LINK_SEARCH_START_STATIC"; -static std::string const kCMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT = +std::string const kCMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT = "CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT"; -static std::string const kCMAKE_OSX_ARCHITECTURES = "CMAKE_OSX_ARCHITECTURES"; -static std::string const kCMAKE_OSX_DEPLOYMENT_TARGET = - "CMAKE_OSX_DEPLOYMENT_TARGET"; -static std::string const kCMAKE_OSX_SYSROOT = "CMAKE_OSX_SYSROOT"; -static std::string const kCMAKE_APPLE_ARCH_SYSROOTS = - "CMAKE_APPLE_ARCH_SYSROOTS"; -static std::string const kCMAKE_POSITION_INDEPENDENT_CODE = +std::string const kCMAKE_OSX_ARCHITECTURES = "CMAKE_OSX_ARCHITECTURES"; +std::string const kCMAKE_OSX_DEPLOYMENT_TARGET = "CMAKE_OSX_DEPLOYMENT_TARGET"; +std::string const kCMAKE_OSX_SYSROOT = "CMAKE_OSX_SYSROOT"; +std::string const kCMAKE_APPLE_ARCH_SYSROOTS = "CMAKE_APPLE_ARCH_SYSROOTS"; +std::string const kCMAKE_POSITION_INDEPENDENT_CODE = "CMAKE_POSITION_INDEPENDENT_CODE"; -static std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT"; -static std::string const kCMAKE_SYSROOT_COMPILE = "CMAKE_SYSROOT_COMPILE"; -static std::string const kCMAKE_SYSROOT_LINK = "CMAKE_SYSROOT_LINK"; -static std::string const kCMAKE_Swift_COMPILER_TARGET = - "CMAKE_Swift_COMPILER_TARGET"; -static std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES = +std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT"; +std::string const kCMAKE_SYSROOT_COMPILE = "CMAKE_SYSROOT_COMPILE"; +std::string const kCMAKE_SYSROOT_LINK = "CMAKE_SYSROOT_LINK"; +std::string const kCMAKE_Swift_COMPILER_TARGET = "CMAKE_Swift_COMPILER_TARGET"; +std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES = "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES"; -static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES = +std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES = "CMAKE_TRY_COMPILE_PLATFORM_VARIABLES"; -static std::string const kCMAKE_WARN_DEPRECATED = "CMAKE_WARN_DEPRECATED"; +std::string const kCMAKE_WARN_DEPRECATED = "CMAKE_WARN_DEPRECATED"; /* GHS Multi platform variables */ -static std::set ghs_platform_vars{ +std::set const ghs_platform_vars{ "GHS_TARGET_PLATFORM", "GHS_PRIMARY_TARGET", "GHS_TOOLSET_ROOT", "GHS_OS_ROOT", "GHS_OS_DIR", "GHS_BSP_NAME", "GHS_OS_DIR_OPTION" }; +} int cmCoreTryCompile::TryCompileCode(std::vector const& argv, bool isTryRun) -- cgit v0.12 From d5b5c192780dbbf80ff7e049997c0eaeeebdeb95 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 15 Jun 2020 16:50:58 -0400 Subject: cmGlobalGenerator: FindMakeProgram() before CMakeDetermineSystem Prior to 147d36c, the build tool was found before the toolset was selected, but was changed to be found after in order to support a 64-bit MSBuild (introduced in da402a0.) However, a bug was found in 64-bit MSBuild, which resulted in da402a0 being reverted in f3cedf3 (but 147d36c was not reverted.) Move FindMakeProgram() even earlier than it was before 147d36c, before CMakeDetermineSystem is called, so that the Visual Studio Android support can report its sysroot, giving Android-Determine the information it needs to inspect the NDK. When the bug in 64-bit MSBuild is fixed, we will have a chicken-and- egg problem, but we don't need to worry about it for now. --- Source/cmGlobalGenerator.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4b4ffda..6001999 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -596,6 +596,16 @@ void cmGlobalGenerator::EnableLanguage( mf->ReadListFile(fpath); } } + + if (readCMakeSystem) { + // Find the native build tool for this generator. + // This has to be done early so that MSBuild can be used to examine the + // cross-compilation environment. + if (!this->FindMakeProgram(mf)) { + return; + } + } + // Load the CMakeDetermineSystem.cmake file and find out // what platform we are running on if (!mf->GetDefinition("CMAKE_SYSTEM")) { @@ -667,11 +677,6 @@ void cmGlobalGenerator::EnableLanguage( cmSystemTools::SetFatalErrorOccured(); return; } - - // Find the native build tool for this generator. - if (!this->FindMakeProgram(mf)) { - return; - } } // Check that the languages are supported by the generator and its -- cgit v0.12 From 14456923bd79b5353cf8be49855ac01826d89b70 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 15 Jun 2020 17:02:02 -0400 Subject: cmGlobalVisualStudio10Generator: Move variable initialization to header --- Source/cmGlobalVisualStudio10Generator.cxx | 3 --- Source/cmGlobalVisualStudio10Generator.h | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 5dac072..cef9062 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -138,9 +138,6 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); this->CudaEnabled = false; - this->SystemIsWindowsCE = false; - this->SystemIsWindowsPhone = false; - this->SystemIsWindowsStore = false; this->MSBuildCommandInitialized = false; { std::string envPlatformToolset; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index b8c18b4..bd5c4be 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -185,9 +185,9 @@ protected: std::string DefaultNasmFlagTableName; std::string DefaultRCFlagTableName; bool SupportsUnityBuilds = false; - bool SystemIsWindowsCE; - bool SystemIsWindowsPhone; - bool SystemIsWindowsStore; + bool SystemIsWindowsCE = false; + bool SystemIsWindowsPhone = false; + bool SystemIsWindowsStore = false; private: class Factory; -- cgit v0.12 From bbcaf9689ea76d8deba13870dfc63f0654348b5a Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Wed, 17 Jun 2020 14:48:49 -0400 Subject: Refactor: Add IsAndroidGuiExecutable() method to cmTarget --- Source/cmTarget.cxx | 10 ++++++++-- Source/cmTarget.h | 3 +++ Source/cmVisualStudio10TargetGenerator.cxx | 5 ++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 36e1ad5..4091b06 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -636,6 +636,12 @@ bool cmTarget::IsAppBundleOnApple() const this->GetPropertyAsBool("MACOSX_BUNDLE")); } +bool cmTarget::IsAndroidGuiExecutable() const +{ + return (this->GetType() == cmStateEnums::EXECUTABLE && impl->IsAndroid && + this->GetPropertyAsBool("ANDROID_GUI")); +} + std::vector const& cmTarget::GetPreBuildCommands() const { return impl->PreBuildCommands; @@ -1865,7 +1871,7 @@ const char* cmTarget::GetSuffixVariableInternal( case cmStateEnums::RuntimeBinaryArtifact: // Android GUI application packages store the native // binary as a shared library. - return (impl->IsAndroid && this->GetPropertyAsBool("ANDROID_GUI") + return (this->IsAndroidGuiExecutable() ? "CMAKE_SHARED_LIBRARY_SUFFIX" : "CMAKE_EXECUTABLE_SUFFIX"); case cmStateEnums::ImportLibraryArtifact: @@ -1906,7 +1912,7 @@ const char* cmTarget::GetPrefixVariableInternal( case cmStateEnums::RuntimeBinaryArtifact: // Android GUI application packages store the native // binary as a shared library. - return (impl->IsAndroid && this->GetPropertyAsBool("ANDROID_GUI") + return (this->IsAndroidGuiExecutable() ? "CMAKE_SHARED_LIBRARY_PREFIX" : ""); case cmStateEnums::ImportLibraryArtifact: diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f0ddb68..e7498bd 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -209,6 +209,9 @@ public: //! Return whether this target is an executable Bundle on Apple. bool IsAppBundleOnApple() const; + //! Return whether this target is a GUI executable on Android. + bool IsAndroidGuiExecutable() const; + //! Get a backtrace from the creation of the target. cmListFileBacktrace const& GetBacktrace() const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a3ccd2b..31bb7be 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1134,7 +1134,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) break; case cmStateEnums::EXECUTABLE: if (this->NsightTegra && - !this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) { + !this->GeneratorTarget->Target->IsAndroidGuiExecutable()) { // Android executables are .so too. configType = "DynamicLibrary"; } else { @@ -4015,8 +4015,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0) // output manifest flags this->WriteManifestOptions(e1, c); if (this->NsightTegra && - this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE && - this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) { + this->GeneratorTarget->Target->IsAndroidGuiExecutable()) { this->WriteAntBuildOptions(e1, c); } } -- cgit v0.12 From 9ffd2c70bff9eddc3cd056889212a3d12cdd9ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Tue, 16 Jun 2020 12:31:26 +0200 Subject: FindSDL: Add SDL_INCLUDE_DIRS, SDL_LIBRARIES, and SDL::SDL Also provide `SDL_VERSION[_{MAJOR,MINOR,PATCH}]`. Fixes: #12911 --- Help/release/dev/FindSDL-update.rst | 11 +++++ Modules/FindSDL.cmake | 85 +++++++++++++++++++++++++++---------- Tests/CMakeLists.txt | 1 + Tests/FindSDL/CMakeLists.txt | 10 +++++ Tests/FindSDL/Test/CMakeLists.txt | 19 +++++++++ Tests/FindSDL/Test/main.c | 18 ++++++++ 6 files changed, 121 insertions(+), 23 deletions(-) create mode 100644 Help/release/dev/FindSDL-update.rst create mode 100644 Tests/FindSDL/CMakeLists.txt create mode 100644 Tests/FindSDL/Test/CMakeLists.txt create mode 100644 Tests/FindSDL/Test/main.c diff --git a/Help/release/dev/FindSDL-update.rst b/Help/release/dev/FindSDL-update.rst new file mode 100644 index 0000000..a85d2b9 --- /dev/null +++ b/Help/release/dev/FindSDL-update.rst @@ -0,0 +1,11 @@ +FindSDL-update +-------------- + +* The :module:`FindSDL` module now provides: + + * imported target ``SDL::SDL``, + + * result variables ``SDL_LIBRARIES`` and ``SDL_INCLUDE_DIRS``, + + * version variables ``SDL_VERSION``, ``SDL_VERSION_MAJOR`` + ``SDL_VERSION_MINOR``, and ``SDL_VERSION_PATCH``. diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 8d793a9..59eddbb 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -5,24 +5,54 @@ FindSDL ------- -Locate SDL library +Locate the SDL library -This module defines -:: +Imported targets +^^^^^^^^^^^^^^^^ - SDL_LIBRARY, the name of the library to link against - SDL_FOUND, if false, do not try to link to SDL - SDL_INCLUDE_DIR, where to find SDL.h - SDL_VERSION_STRING, human-readable string containing the version of SDL +This module defines the following :prop_tgt:`IMPORTED` target: +``SDL::SDL`` + The SDL library, if found +Result variables +^^^^^^^^^^^^^^^^ -This module responds to the flag: +This module will set the following variables in your project: + +``SDL_INCLUDE_DIRS`` + where to find SDL.h +``SDL_LIBRARIES`` + the name of the library to link against +``SDL_FOUND`` + if false, do not try to link to SDL +``SDL_VERSION`` + the human-readable string containing the version of SDL if found +``SDL_VERSION_MAJOR`` + SDL major version +``SDL_VERSION_MINOR`` + SDL minor version +``SDL_VERSION_PATCH`` + SDL patch version + +Cache variables +^^^^^^^^^^^^^^^ + +These variables may optionally be set to help this module find the correct files: -:: +``SDL_INCLUDE_DIR`` + where to find SDL.h +``SDL_LIBRARY`` + the name of the library to link against + + +Variables for locating SDL +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This module responds to the flag: - SDL_BUILDING_LIBRARY +``SDL_BUILDING_LIBRARY`` If this is defined, then no SDL_main will be linked in because only applications need main(). Otherwise, it is assumed you are building an application and this @@ -30,6 +60,15 @@ This module responds to the flag: as part of the returned SDL_LIBRARY variable. +Obsolete variables +^^^^^^^^^^^^^^^^^^ + +These variables are obsolete and provided for backwards compatibility: + +``SDL_VERSION_STRING`` + the human-readable string containing the version of SDL if found. + Identical to SDL_VERSION + Don't forget to include SDLmain.h and SDLmain.m your project for the OS X framework based version. (Other versions link to -lSDLmain which @@ -52,15 +91,6 @@ does not get created. $SDLDIR is an environment variable that would correspond to the ./configure --prefix=$SDLDIR used in building SDL. l.e.galup 9-20-02 -Modified by Eric Wing. Added code to assist with automated building -by using environmental variables and providing a more -controlled/consistent search behavior. Added new modifications to -recognize OS X frameworks and additional Unix paths (FreeBSD, etc). -Also corrected the header search path to follow "proper" SDL -guidelines. Added a search for SDLmain which is needed by some -platforms. Added a search for threads which is needed by some -platforms. Added needed compile switches for MinGW. - On OSX, this will prefer the Framework version (if found) over others. People will have to manually change the cache values of SDL_LIBRARY to override this selection or set the CMake environment @@ -174,13 +204,11 @@ if(SDL_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h") string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MAJOR "${SDL_VERSION_MAJOR_LINE}") string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MINOR "${SDL_VERSION_MINOR_LINE}") string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_VERSION_PATCH "${SDL_VERSION_PATCH_LINE}") - set(SDL_VERSION_STRING ${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_PATCH}) unset(SDL_VERSION_MAJOR_LINE) unset(SDL_VERSION_MINOR_LINE) unset(SDL_VERSION_PATCH_LINE) - unset(SDL_VERSION_MAJOR) - unset(SDL_VERSION_MINOR) - unset(SDL_VERSION_PATCH) + set(SDL_VERSION ${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_PATCH}) + set(SDL_VERSION_STRING ${SDL_VERSION}) endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) @@ -188,3 +216,14 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR VERSION_VAR SDL_VERSION_STRING) + +if(SDL_FOUND) + set(SDL_LIBRARIES ${SDL_LIBRARY}) + set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR}) + if(NOT TARGET SDL::SDL) + add_library(SDL::SDL INTERFACE IMPORTED) + set_target_properties(SDL::SDL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${SDL_LIBRARY}") + endif() +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b771ff5..b053b1b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1452,6 +1452,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH Patch PostgreSQL Protobuf + SDL SQLite3 TIFF Vulkan diff --git a/Tests/FindSDL/CMakeLists.txt b/Tests/FindSDL/CMakeLists.txt new file mode 100644 index 0000000..e786204 --- /dev/null +++ b/Tests/FindSDL/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindSDL.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindSDL/Test" + "${CMake_BINARY_DIR}/Tests/FindSDL/Test" + ${build_generator_args} + --build-project TestFindSDL + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindSDL/Test/CMakeLists.txt b/Tests/FindSDL/Test/CMakeLists.txt new file mode 100644 index 0000000..61d4f4b --- /dev/null +++ b/Tests/FindSDL/Test/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindSDL C) +include(CTest) + +find_package(SDL) + +add_definitions( + -DCMAKE_EXPECTED_SDL_VERSION_MAJOR=${SDL_VERSION_MAJOR} + -DCMAKE_EXPECTED_SDL_VERSION_MINOR=${SDL_VERSION_MINOR} + -DCMAKE_EXPECTED_SDL_VERSION_PATCH=${SDL_VERSION_PATCH}) + +add_executable(test_sdl_tgt main.c) +target_link_libraries(test_sdl_tgt SDL::SDL) +add_test(NAME test_sdl_tgt COMMAND test_sdl_tgt) + +add_executable(test_sdl_var main.c) +target_include_directories(test_sdl_var PRIVATE ${SDL_INCLUDE_DIRS}) +target_link_libraries(test_sdl_var PRIVATE ${SDL_LIBRARIES}) +add_test(NAME test_sdl_var COMMAND test_sdl_var) diff --git a/Tests/FindSDL/Test/main.c b/Tests/FindSDL/Test/main.c new file mode 100644 index 0000000..057289c --- /dev/null +++ b/Tests/FindSDL/Test/main.c @@ -0,0 +1,18 @@ +#include + +int main() +{ + // Test 1 requires headers only. + SDL_version compiled; + SDL_VERSION(&compiled); + if (compiled.major != CMAKE_EXPECTED_SDL_VERSION_MAJOR || + compiled.minor != CMAKE_EXPECTED_SDL_VERSION_MINOR || + compiled.patch != CMAKE_EXPECTED_SDL_VERSION_PATCH) + return 1; + + // Test 2 requires to link to the library. + if (SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0) + return 2; + + return 0; +} -- cgit v0.12 From c0a9fc1dd6c40625e612222cfe89d4426df73db9 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 19 Jun 2020 00:02:46 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 10ac7fe..1d3dcce 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 18) -set(CMake_VERSION_PATCH 20200618) +set(CMake_VERSION_PATCH 20200619) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From eae0c0afbb77f5823bdbdc157fc244ac0e32ef6b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 20 Jun 2020 00:02:46 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1d3dcce..bf05dff 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 18) -set(CMake_VERSION_PATCH 20200619) +set(CMake_VERSION_PATCH 20200620) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 71f6c7badfdce6279442e124ff0f9b956c926c4a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 21 Jun 2020 00:02:53 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bf05dff..ffe7337 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 18) -set(CMake_VERSION_PATCH 20200620) +set(CMake_VERSION_PATCH 20200621) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From ee5eb2eab4976c413b5bb59106c6920a5f49520f Mon Sep 17 00:00:00 2001 From: Corentin Plouet Date: Sun, 21 Jun 2020 23:54:59 +1000 Subject: Graphviz: add missing support for circular dependencies This support was actually added by removing a superfluous check that was too eager in cmLinkItemGraphVisitor.cxx. Extended the existing Graphviz tests to include this particular case, and re-generated the expected output files. Fixes: #20720 --- Source/cmLinkItemGraphVisitor.cxx | 4 -- Tests/RunCMake/Graphviz/GraphvizTestProject.cmake | 8 ++++ .../dependency_graph_custom_targets.dot | 43 ++++++++++++---------- .../dependency_graph_default_options.dot | 39 +++++++++++--------- .../dependency_graph_no_dependers_files.dot | 39 +++++++++++--------- .../dependency_graph_no_executables.dot | 31 +++++++++------- .../dependency_graph_no_external_libs.dot | 31 +++++++++------- .../dependency_graph_no_graphic_libs.dot | 9 +++-- .../dependency_graph_no_interface_libs.dot | 33 +++++++++-------- .../dependency_graph_no_module_libs.dot | 27 ++++++++------ .../dependency_graph_no_object_libs.dot | 35 ++++++++++-------- .../dependency_graph_no_per_target_files.dot | 39 +++++++++++--------- .../dependency_graph_no_shared_libs.dot | 27 ++++++++------ .../dependency_graph_no_unknown_libs.dot | 35 ++++++++++-------- .../dependency_graph_set_graph_header.dot | 39 +++++++++++--------- .../dependency_graph_set_graph_name.dot | 39 +++++++++++--------- .../dependency_graph_set_node_prefix.dot | 39 +++++++++++--------- .../Graphviz/test_project/system_library.c | 3 ++ 18 files changed, 286 insertions(+), 234 deletions(-) create mode 100644 Tests/RunCMake/Graphviz/test_project/system_library.c diff --git a/Source/cmLinkItemGraphVisitor.cxx b/Source/cmLinkItemGraphVisitor.cxx index acc23c8..b13def8 100644 --- a/Source/cmLinkItemGraphVisitor.cxx +++ b/Source/cmLinkItemGraphVisitor.cxx @@ -24,10 +24,6 @@ void cmLinkItemGraphVisitor::VisitItem(cmLinkItem const& item) void cmLinkItemGraphVisitor::VisitLinks(cmLinkItem const& item, cmLinkItem const& rootItem) { - if (this->LinkVisited(item, rootItem)) { - return; - } - if (item.Target == nullptr) { return; } diff --git a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake index 10cd2bc..4ce6b5c 100644 --- a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake +++ b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake @@ -9,6 +9,7 @@ # - All library depend on a common INTERFACE library holding compiler flags # - We have a custom target to generate a man page # - Someone has added an UNKNOWN, IMPORTED crypto mining library! +# - We have a circular dependency between two libraries add_subdirectory(test_project/third_party_project) @@ -23,6 +24,13 @@ target_link_libraries(CoreLibrary PUBLIC CompilerFlags) target_link_libraries(CoreLibrary PRIVATE SeriousLoggingLibrary) +add_library(SystemLibrary STATIC test_project/system_library.c) + +# Create a circular dependency. +# See https://gitlab.kitware.com/cmake/cmake/issues/20720 +target_link_libraries(CoreLibrary PRIVATE SystemLibrary) +target_link_libraries(SystemLibrary PRIVATE CoreLibrary) + add_library(GraphicLibraryObjects OBJECT test_project/graphic_library.c) add_library(GraphicLibrary SHARED) diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot index 8b0365a..31d88df 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot @@ -28,25 +28,28 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GenerateManPage", shape = box ]; - "node1" -> "node5" // ConsoleApplication -> GenerateManPage - "node6" [ label = "GraphicApplication", shape = egg ]; - "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node8" [ label = "\"-lm\"", shape = septagon ]; - "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" - "node7" -> "node0" // GraphicLibrary -> CompilerFlags - "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GenerateManPage", shape = box ]; + "node1" -> "node6" // ConsoleApplication -> GenerateManPage + "node7" [ label = "GraphicApplication", shape = egg ]; + "node7" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node8" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node9" [ label = "\"-lm\"", shape = septagon ]; + "node8" -> "node9" [ style = dotted ] // GraphicLibrary -> "-lm" + "node8" -> "node0" // GraphicLibrary -> CompilerFlags + "node8" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node10" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node8" -> "node10" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node7" -> "node8" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node11" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node12" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node12" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node12" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot index 1bbf25a..26f2f64 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot @@ -28,23 +28,26 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot index 1bbf25a..26f2f64 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot @@ -28,23 +28,26 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot index 558a470..7f2e01c 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot @@ -27,18 +27,21 @@ subgraph clusterLegend { "node1" -> "node0" // CoreLibrary -> CompilerFlags "node2" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node1" -> "node2" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary - "node3" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node4" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node5" [ label = "\"-lm\"", shape = septagon ]; - "node4" -> "node5" [ style = dotted ] // GraphicLibrary -> "-lm" - "node4" -> "node0" // GraphicLibrary -> CompilerFlags - "node4" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node4" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node7" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node7" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node8" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node3" [ label = "SystemLibrary", shape = octagon ]; + "node3" -> "node1" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node1" -> "node3" [ style = dotted ] // CoreLibrary -> SystemLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" [ label = "\"-lm\"", shape = septagon ]; + "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> "-lm" + "node5" -> "node0" // GraphicLibrary -> CompilerFlags + "node5" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node5" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node8" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node9" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot index 660af37..db675a8 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot @@ -28,19 +28,22 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "GraphicApplication", shape = egg ]; - "node4" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node5" -> "node0" // GraphicLibrary -> CompilerFlags - "node5" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node7" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node7" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node8" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot index 5af7fec..234ee39 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot @@ -28,8 +28,11 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "\"-lm\"", shape = septagon ]; + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "\"-lm\"", shape = septagon ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot index 94ec41c..6dea88c 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot @@ -24,20 +24,23 @@ subgraph clusterLegend { } "node0" [ label = "ConsoleApplication", shape = egg ]; "node1" [ label = "CoreLibrary", shape = octagon ]; + "node2" [ label = "SystemLibrary", shape = octagon ]; + "node2" -> "node1" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node1" -> "node2" [ style = dotted ] // CoreLibrary -> SystemLibrary "node0" -> "node1" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node2" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node0" -> "node2" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node3" [ label = "GraphicApplication", shape = egg ]; - "node3" -> "node1" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node4" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node5" [ label = "\"-lm\"", shape = septagon ]; - "node4" -> "node5" [ style = dotted ] // GraphicLibrary -> "-lm" - "node4" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node4" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node3" -> "node4" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node7" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node8" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node3" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node0" -> "node3" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node4" [ label = "GraphicApplication", shape = egg ]; + "node4" -> "node1" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" [ label = "\"-lm\"", shape = septagon ]; + "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> "-lm" + "node5" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node5" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot index 65b7a71..df3d10a 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot @@ -28,17 +28,20 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot index 8116bc9..8f832a8 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot @@ -28,21 +28,24 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot index 1bbf25a..26f2f64 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot @@ -28,23 +28,26 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot index 439d1f7..e127daa 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot @@ -28,17 +28,20 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "\"-lm\"", shape = septagon ]; - "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot index 1be6550..4f242bb 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot @@ -28,21 +28,24 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "GraphicApplication", shape = egg ]; - "node4" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node6" [ label = "\"-lm\"", shape = septagon ]; - "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> "-lm" - "node5" -> "node0" // GraphicLibrary -> CompilerFlags - "node5" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node5" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot index 1cfbe0f..c664af8 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot @@ -28,23 +28,26 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot index 9653c33..5579306 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot @@ -28,23 +28,26 @@ subgraph clusterLegend { "node2" -> "node0" // CoreLibrary -> CompilerFlags "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node4" [ label = "SystemLibrary", shape = octagon ]; + "node4" -> "node2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "node2" -> "node4" [ style = dotted ] // CoreLibrary -> SystemLibrary "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "node5" [ label = "GraphicApplication", shape = egg ]; - "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "node7" [ label = "\"-lm\"", shape = septagon ]; - "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" - "node6" -> "node0" // GraphicLibrary -> CompilerFlags - "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot index 82d96d0..3bf20ec 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot @@ -28,23 +28,26 @@ subgraph clusterLegend { "point2" -> "point0" // CoreLibrary -> CompilerFlags "point3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; "point2" -> "point3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "point4" [ label = "SystemLibrary", shape = octagon ]; + "point4" -> "point2" [ style = dotted ] // SystemLibrary -> CoreLibrary + "point2" -> "point4" [ style = dotted ] // CoreLibrary -> SystemLibrary "point1" -> "point2" [ style = dotted ] // ConsoleApplication -> CoreLibrary - "point4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; - "point1" -> "point4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary - "point5" [ label = "GraphicApplication", shape = egg ]; - "point5" -> "point2" [ style = dotted ] // GraphicApplication -> CoreLibrary - "point6" [ label = "GraphicLibrary", shape = doubleoctagon ]; - "point7" [ label = "\"-lm\"", shape = septagon ]; - "point6" -> "point7" [ style = dotted ] // GraphicLibrary -> "-lm" - "point6" -> "point0" // GraphicLibrary -> CompilerFlags - "point6" -> "point2" [ style = dotted ] // GraphicLibrary -> CoreLibrary - "point8" [ label = "GraphicLibraryObjects", shape = hexagon ]; - "point6" -> "point8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects - "point5" -> "point6" [ style = dotted ] // GraphicApplication -> GraphicLibrary - "point9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; - "point9" -> "point0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags - "point9" -> "point2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary - "point10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; - "point10" -> "point0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags - "point10" -> "point2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "point5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "point1" -> "point5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "point6" [ label = "GraphicApplication", shape = egg ]; + "point6" -> "point2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "point7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "point8" [ label = "\"-lm\"", shape = septagon ]; + "point7" -> "point8" [ style = dotted ] // GraphicLibrary -> "-lm" + "point7" -> "point0" // GraphicLibrary -> CompilerFlags + "point7" -> "point2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "point9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "point7" -> "point9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "point6" -> "point7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "point10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "point10" -> "point0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "point10" -> "point2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "point11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "point11" -> "point0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "point11" -> "point2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary } diff --git a/Tests/RunCMake/Graphviz/test_project/system_library.c b/Tests/RunCMake/Graphviz/test_project/system_library.c new file mode 100644 index 0000000..5d67079 --- /dev/null +++ b/Tests/RunCMake/Graphviz/test_project/system_library.c @@ -0,0 +1,3 @@ +void initialize_system() +{ +} -- cgit v0.12 From 9692931f8376c47ea335c90f3544e281ddc4ca8d Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 22 Jun 2020 00:02:06 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ffe7337..e619f64 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 18) -set(CMake_VERSION_PATCH 20200621) +set(CMake_VERSION_PATCH 20200622) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From c4e890946adce7881f2710a4ae4899310ed06668 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 15 Jun 2020 11:20:59 -0400 Subject: try_compile: consistently add language properties It was very easy to forgot to add all the possible language properties that try_compile might need. Refactored the code to make it harder to skip flags. This changes adds the missing language properties for the CUDA, Fortran, OBJC, OBJCXX, and Swift languages: - CMAKE__COMPILER_EXTERNAL_TOOLCHAIN - CMAKE__COMPILER_TARGET - CMAKE__LINK_NO_PIE_SUPPORTED - CMAKE__PIE_SUPPORTED --- Source/cmCoreTryCompile.cxx | 85 ++++++++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 25 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 87f2bb5..5d11995 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -166,21 +166,35 @@ private: std::string ExtensionValue; }; -std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN = - "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN"; -std::string const kCMAKE_C_COMPILER_TARGET = "CMAKE_C_COMPILER_TARGET"; -std::string const kCMAKE_C_LINK_NO_PIE_SUPPORTED = - "CMAKE_C_LINK_NO_PIE_SUPPORTED"; -std::string const kCMAKE_C_LINK_PIE_SUPPORTED = "CMAKE_C_LINK_PIE_SUPPORTED"; -std::string const kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN = - "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN"; -std::string const kCMAKE_CXX_COMPILER_TARGET = "CMAKE_CXX_COMPILER_TARGET"; -std::string const kCMAKE_CXX_LINK_NO_PIE_SUPPORTED = - "CMAKE_CXX_LINK_NO_PIE_SUPPORTED"; -std::string const kCMAKE_CXX_LINK_PIE_SUPPORTED = - "CMAKE_CXX_LINK_PIE_SUPPORTED"; +constexpr size_t lang_property_start = 0; +constexpr size_t lang_property_size = 4; +constexpr size_t pie_property_start = 4; +constexpr size_t pie_property_size = 2; +#define SETUP_LANGUAGE(name, lang) \ + static const std::string name[lang_property_size + pie_property_size + 1] = \ + { "CMAKE_" #lang "_COMPILER_EXTERNAL_TOOLCHAIN", \ + "CMAKE_" #lang "_COMPILER_TARGET", \ + "CMAKE_" #lang "_LINK_NO_PIE_SUPPORTED", \ + "CMAKE_" #lang "_PIE_SUPPORTED", "" } + +// NOLINTNEXTLINE(bugprone-suspicious-missing-comma) +SETUP_LANGUAGE(c_properties, C); +// NOLINTNEXTLINE(bugprone-suspicious-missing-comma) +SETUP_LANGUAGE(cxx_properties, CXX); + +// NOLINTNEXTLINE(bugprone-suspicious-missing-comma) +SETUP_LANGUAGE(cuda_properties, CUDA); +// NOLINTNEXTLINE(bugprone-suspicious-missing-comma) +SETUP_LANGUAGE(fortran_properties, Fortran); +// NOLINTNEXTLINE(bugprone-suspicious-missing-comma) +SETUP_LANGUAGE(objc_properties, OBJC); +// NOLINTNEXTLINE(bugprone-suspicious-missing-comma) +SETUP_LANGUAGE(objcxx_properties, OBJCXX); +// NOLINTNEXTLINE(bugprone-suspicious-missing-comma) +SETUP_LANGUAGE(swift_properties, Swift); +#undef SETUP_LANGUAGE + std::string const kCMAKE_CUDA_ARCHITECTURES = "CMAKE_CUDA_ARCHITECTURES"; -std::string const kCMAKE_CUDA_COMPILER_TARGET = "CMAKE_CUDA_COMPILER_TARGET"; std::string const kCMAKE_CUDA_RUNTIME_LIBRARY = "CMAKE_CUDA_RUNTIME_LIBRARY"; std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS"; std::string const kCMAKE_LINK_SEARCH_END_STATIC = @@ -198,7 +212,6 @@ std::string const kCMAKE_POSITION_INDEPENDENT_CODE = std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT"; std::string const kCMAKE_SYSROOT_COMPILE = "CMAKE_SYSROOT_COMPILE"; std::string const kCMAKE_SYSROOT_LINK = "CMAKE_SYSROOT_LINK"; -std::string const kCMAKE_Swift_COMPILER_TARGET = "CMAKE_Swift_COMPILER_TARGET"; std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES = "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES"; std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES = @@ -675,12 +688,23 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, // Forward a set of variables to the inner project cache. { std::set vars; - vars.insert(kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN); - vars.insert(kCMAKE_C_COMPILER_TARGET); - vars.insert(kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN); - vars.insert(kCMAKE_CXX_COMPILER_TARGET); + vars.insert(&c_properties[lang_property_start], + &c_properties[lang_property_start + lang_property_size]); + vars.insert(&cxx_properties[lang_property_start], + &cxx_properties[lang_property_start + lang_property_size]); + vars.insert(&cuda_properties[lang_property_start], + &cuda_properties[lang_property_start + lang_property_size]); + vars.insert( + &fortran_properties[lang_property_start], + &fortran_properties[lang_property_start + lang_property_size]); + vars.insert(&objc_properties[lang_property_start], + &objc_properties[lang_property_start + lang_property_size]); + vars.insert( + &objcxx_properties[lang_property_start], + &objcxx_properties[lang_property_start + lang_property_size]); + vars.insert(&swift_properties[lang_property_start], + &swift_properties[lang_property_start + lang_property_size]); vars.insert(kCMAKE_CUDA_ARCHITECTURES); - vars.insert(kCMAKE_CUDA_COMPILER_TARGET); vars.insert(kCMAKE_CUDA_RUNTIME_LIBRARY); vars.insert(kCMAKE_ENABLE_EXPORTS); vars.insert(kCMAKE_LINK_SEARCH_END_STATIC); @@ -693,7 +717,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, vars.insert(kCMAKE_SYSROOT); vars.insert(kCMAKE_SYSROOT_COMPILE); vars.insert(kCMAKE_SYSROOT_LINK); - vars.insert(kCMAKE_Swift_COMPILER_TARGET); vars.insert(kCMAKE_WARN_DEPRECATED); vars.emplace("CMAKE_MSVC_RUNTIME_LIBRARY"_s); @@ -707,10 +730,22 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, cmPolicies::NEW) { // To ensure full support of PIE, propagate cache variables // driving the link options - vars.insert(kCMAKE_C_LINK_PIE_SUPPORTED); - vars.insert(kCMAKE_C_LINK_NO_PIE_SUPPORTED); - vars.insert(kCMAKE_CXX_LINK_PIE_SUPPORTED); - vars.insert(kCMAKE_CXX_LINK_NO_PIE_SUPPORTED); + vars.insert(&c_properties[pie_property_start], + &c_properties[pie_property_start + pie_property_size]); + vars.insert(&cxx_properties[pie_property_start], + &cxx_properties[pie_property_start + pie_property_size]); + vars.insert(&cuda_properties[pie_property_start], + &cuda_properties[pie_property_start + pie_property_size]); + vars.insert( + &fortran_properties[pie_property_start], + &fortran_properties[pie_property_start + pie_property_size]); + vars.insert(&objc_properties[pie_property_start], + &objc_properties[pie_property_start + pie_property_size]); + vars.insert( + &objcxx_properties[pie_property_start], + &objcxx_properties[pie_property_start + pie_property_size]); + vars.insert(&swift_properties[pie_property_start], + &swift_properties[pie_property_start + pie_property_size]); } /* for the TRY_COMPILEs we want to be able to specify the architecture. -- cgit v0.12 From 7628153edb74ef29e3322fd4163754e301b9cb9a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 15 Jun 2020 09:23:49 -0400 Subject: Refactor file extension queries to be more consistent It was very easy to forgot to check against all language file extensions. This updates the internal API to have a unified API. --- Source/cmAuxSourceDirectoryCommand.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 2 +- Source/cmExtraCodeLiteGenerator.cxx | 3 +- Source/cmQtAutoGenInitializer.cxx | 8 ++--- Source/cmSourceFile.cxx | 31 +++++++---------- Source/cmSourceFileLocation.cxx | 4 +-- Source/cmake.cxx | 15 +++++++-- Source/cmake.h | 39 ++++++++-------------- .../ObjectLibrary/MissingSource-stderr.txt | 4 +-- .../interface_library/global-interface-stderr.txt | 4 +-- 10 files changed, 52 insertions(+), 60 deletions(-) diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index d6f7500e..53d4cb4 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -55,7 +55,7 @@ bool cmAuxSourceDirectoryCommand(std::vector const& args, auto ext = cm::string_view(file).substr(dotpos + 1); // Process only source files auto cm = mf.GetCMakeInstance(); - if (dotpos > 0 && cm->IsSourceExtension(ext)) { + if (dotpos > 0 && cm->IsACLikeSourceExtension(ext)) { std::string fullname = cmStrCat(templateDirectory, '/', file); // add the file as a class file so // depends can be done diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 32b0ca9..652c041 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -370,7 +370,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( std::string lang = s->GetOrDetermineLanguage(); if (lang == "C" || lang == "CXX" || lang == "CUDA") { std::string const& srcext = s->GetExtension(); - isCFile = cm->IsSourceExtension(srcext); + isCFile = cm->IsACLikeSourceExtension(srcext); } std::string const& fullPath = s->ResolveFullPath(); diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index bf7555d..95cfb0a 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -227,8 +227,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( cmSystemTools::LowerCase(s->GetExtension()); // check whether it is a source or a include file // then put it accordingly into one of the two containers - if (cm->IsSourceExtension(extLower) || cm->IsCudaExtension(extLower) || - cm->IsFortranExtension(extLower)) { + if (cm->IsAKnownSourceExtension(extLower)) { cFiles[fullPath] = s; } else { otherFiles.insert(fullPath); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 511a018..e733a3e 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -789,9 +789,9 @@ bool cmQtAutoGenInitializer::InitScanFiles() // Register files that will be scanned by moc or uic if (this->MocOrUicEnabled()) { - if (cm->IsHeaderExtension(extLower)) { + if (cm->IsAHeaderExtension(extLower)) { addMUHeader(makeMUFile(sf, fullPath, true), extLower); - } else if (cm->IsSourceExtension(extLower)) { + } else if (cm->IsACLikeSourceExtension(extLower)) { addMUSource(makeMUFile(sf, fullPath, true)); } } @@ -895,14 +895,14 @@ bool cmQtAutoGenInitializer::InitScanFiles() std::string const& extLower = cmSystemTools::LowerCase(sf->GetExtension()); - if (cm->IsHeaderExtension(extLower)) { + if (cm->IsAHeaderExtension(extLower)) { if (!cm::contains(this->AutogenTarget.Headers, sf.get())) { auto muf = makeMUFile(sf.get(), fullPath, false); if (muf->SkipMoc || muf->SkipUic) { addMUHeader(std::move(muf), extLower); } } - } else if (cm->IsSourceExtension(extLower)) { + } else if (cm->IsACLikeSourceExtension(extLower)) { if (!cm::contains(this->AutogenTarget.Sources, sf.get())) { auto muf = makeMUFile(sf.get(), fullPath, false); if (muf->SkipMoc || muf->SkipUic) { diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index f525439..781ddbc 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmSourceFile.h" -#include #include #include "cmGlobalGenerator.h" @@ -130,13 +129,11 @@ bool cmSourceFile::FindFullPath(std::string* error) // Location path std::string const& lPath = this->Location.GetFullPath(); // List of extension lists - std::array const*, 2> const extsLists = { - { &makefile->GetCMakeInstance()->GetSourceExtensions(), - &makefile->GetCMakeInstance()->GetHeaderExtensions() } - }; + std::vector exts = + makefile->GetCMakeInstance()->GetAllExtensions(); // Tries to find the file in a given directory - auto findInDir = [this, &extsLists, &lPath](std::string const& dir) -> bool { + auto findInDir = [this, &exts, &lPath](std::string const& dir) -> bool { // Compute full path std::string const fullPath = cmSystemTools::CollapseFullPath(lPath, dir); // Try full path @@ -145,14 +142,12 @@ bool cmSourceFile::FindFullPath(std::string* error) return true; } // Try full path with extension - for (auto& exts : extsLists) { - for (std::string const& ext : *exts) { - if (!ext.empty()) { - std::string extPath = cmStrCat(fullPath, '.', ext); - if (cmSystemTools::FileExists(extPath)) { - this->FullPath = extPath; - return true; - } + for (std::string const& ext : exts) { + if (!ext.empty()) { + std::string extPath = cmStrCat(fullPath, '.', ext); + if (cmSystemTools::FileExists(extPath)) { + this->FullPath = extPath; + return true; } } } @@ -175,11 +170,9 @@ bool cmSourceFile::FindFullPath(std::string* error) // Compose error std::string err = cmStrCat("Cannot find source file:\n ", lPath, "\nTried extensions"); - for (auto exts : extsLists) { - for (std::string const& ext : *exts) { - err += " ."; - err += ext; - } + for (std::string const& ext : exts) { + err += " ."; + err += ext; } if (error != nullptr) { *error = std::move(err); diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index e852c05..222bafa 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -101,7 +101,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name) cmMakefile const* mf = this->Makefile; auto cm = mf->GetCMakeInstance(); if (!gg->GetLanguageFromExtension(ext.c_str()).empty() || - cm->IsSourceExtension(ext) || cm->IsHeaderExtension(ext)) { + cm->IsAKnownExtension(ext)) { // This is a known extension. Use the given filename with extension. this->Name = cmSystemTools::GetFilenameName(name); this->AmbiguousExtension = false; @@ -157,7 +157,7 @@ bool cmSourceFileLocation::MatchesAmbiguousExtension( auto ext = cm::string_view(this->Name).substr(loc.Name.size() + 1); cmMakefile const* mf = this->Makefile; auto cm = mf->GetCMakeInstance(); - return cm->IsSourceExtension(ext) || cm->IsHeaderExtension(ext); + return cm->IsAKnownExtension(ext); } bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 62a7fcb..27ecb4d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -194,7 +194,7 @@ cmake::cmake(Role role, cmState::Mode mode) }; // The "c" extension MUST precede the "C" extension. - setupExts(this->SourceFileExtensions, + setupExts(this->CLikeSourceFileExtensions, { "c", "C", "c++", "cc", "cpp", "cxx", "cu", "m", "M", "mm" }); setupExts(this->HeaderFileExtensions, { "h", "hh", "h++", "hm", "hpp", "hxx", "in", "txx" }); @@ -1959,6 +1959,17 @@ void cmake::AddGlobCacheEntry(bool recurse, bool listDirectories, backtrace); } +std::vector cmake::GetAllExtensions() const +{ + std::vector allExt = this->CLikeSourceFileExtensions.ordered; + allExt.insert(allExt.end(), this->HeaderFileExtensions.ordered.begin(), + this->HeaderFileExtensions.ordered.end()); + // cuda extensions are also in SourceFileExtensions so we ignore it here + allExt.insert(allExt.end(), this->FortranFileExtensions.ordered.begin(), + this->FortranFileExtensions.ordered.end()); + return allExt; +} + std::string cmake::StripExtension(const std::string& file) const { auto dotpos = file.rfind('.'); @@ -1968,7 +1979,7 @@ std::string cmake::StripExtension(const std::string& file) const #else auto ext = cm::string_view(file).substr(dotpos + 1); #endif - if (this->IsSourceExtension(ext) || this->IsHeaderExtension(ext)) { + if (this->IsAKnownExtension(ext)) { return file.substr(0, dotpos); } } diff --git a/Source/cmake.h b/Source/cmake.h index 086ec87..c5d608f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -264,44 +264,33 @@ public: this->GeneratorToolsetSet = true; } - const std::vector& GetSourceExtensions() const + bool IsAKnownSourceExtension(cm::string_view ext) const { - return this->SourceFileExtensions.ordered; + return this->CLikeSourceFileExtensions.Test(ext) || + this->CudaFileExtensions.Test(ext) || + this->FortranFileExtensions.Test(ext); } - bool IsSourceExtension(cm::string_view ext) const + bool IsACLikeSourceExtension(cm::string_view ext) const { - return this->SourceFileExtensions.Test(ext); + return this->CLikeSourceFileExtensions.Test(ext); } - const std::vector& GetHeaderExtensions() const - { - return this->HeaderFileExtensions.ordered; - } - - bool IsHeaderExtension(cm::string_view ext) const - { - return this->HeaderFileExtensions.Test(ext); - } - - const std::vector& GetCudaExtensions() const + bool IsAKnownExtension(cm::string_view ext) const { - return this->CudaFileExtensions.ordered; + return this->IsAKnownSourceExtension(ext) || this->IsAHeaderExtension(ext); } - bool IsCudaExtension(cm::string_view ext) const - { - return this->CudaFileExtensions.Test(ext); - } + std::vector GetAllExtensions() const; - const std::vector& GetFortranExtensions() const + const std::vector& GetHeaderExtensions() const { - return this->FortranFileExtensions.ordered; + return this->HeaderFileExtensions.ordered; } - bool IsFortranExtension(cm::string_view ext) const + bool IsAHeaderExtension(cm::string_view ext) const { - return this->FortranFileExtensions.Test(ext); + return this->HeaderFileExtensions.Test(ext); } // Strips the extension (if present and known) from a filename @@ -628,7 +617,7 @@ private: std::string CheckStampList; std::string VSSolutionFile; std::string EnvironmentGenerator; - FileExtensions SourceFileExtensions; + FileExtensions CLikeSourceFileExtensions; FileExtensions HeaderFileExtensions; FileExtensions CudaFileExtensions; FileExtensions FortranFileExtensions; diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt index 411cd7c..5c7882d 100644 --- a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt @@ -3,7 +3,7 @@ CMake Error at MissingSource.cmake:1 \(add_library\): missing.c - Tried extensions( \.[A-Za-z+]+| - )* + Tried extensions \.c \.C .* +.* Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/global-interface-stderr.txt b/Tests/RunCMake/interface_library/global-interface-stderr.txt index 23b45d9..38585eb 100644 --- a/Tests/RunCMake/interface_library/global-interface-stderr.txt +++ b/Tests/RunCMake/interface_library/global-interface-stderr.txt @@ -3,7 +3,7 @@ CMake Error at global-interface.cmake:2 \(add_library\): GLOBAL - Tried extensions( \.[A-Za-z+]+| - )* + Tried extensions \.c \.C .* +.* Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -- cgit v0.12 From e43486a63919b64fd2eef5d60c9fca1cea83ca94 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 18 Jun 2020 15:42:15 -0700 Subject: cmGeneratorTarget: Clarify name of language property lookup helper --- Source/cmGeneratorTarget.cxx | 14 ++++++++------ Source/cmGeneratorTarget.h | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1f66a9f..d537be7 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -959,16 +959,17 @@ cmProp cmGeneratorTarget::GetLanguageStandard(std::string const& lang, return this->Target->GetProperty(cmStrCat(lang, "_STANDARD")); } -cmProp cmGeneratorTarget::GetLanguageStandardProperty(std::string const& lang, - const char* suffix) const +cmProp cmGeneratorTarget::GetPropertyWithPairedLanguageSupport( + std::string const& lang, const char* suffix) const { cmProp propertyValue = this->Target->GetProperty(cmStrCat(lang, suffix)); if (propertyValue == nullptr) { // Check if we should use the value set by another language. if (lang == "OBJC") { - propertyValue = this->GetLanguageStandardProperty("C", suffix); + propertyValue = this->GetPropertyWithPairedLanguageSupport("C", suffix); } else if (lang == "OBJCXX" || lang == "CUDA") { - propertyValue = this->GetLanguageStandardProperty("CXX", suffix); + propertyValue = + this->GetPropertyWithPairedLanguageSupport("CXX", suffix); } } return propertyValue; @@ -976,13 +977,14 @@ cmProp cmGeneratorTarget::GetLanguageStandardProperty(std::string const& lang, cmProp cmGeneratorTarget::GetLanguageExtensions(std::string const& lang) const { - return this->GetLanguageStandardProperty(lang, "_EXTENSIONS"); + return this->GetPropertyWithPairedLanguageSupport(lang, "_EXTENSIONS"); } bool cmGeneratorTarget::GetLanguageStandardRequired( std::string const& lang) const { - cmProp p = this->GetLanguageStandardProperty(lang, "_STANDARD_REQUIRED"); + cmProp p = + this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED"); return p && cmIsOn(*p); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index a71e64c..cd53611 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1052,8 +1052,8 @@ private: mutable std::map LanguageStandardMap; - cmProp GetLanguageStandardProperty(std::string const& lang, - const char* suffix) const; + cmProp GetPropertyWithPairedLanguageSupport(std::string const& lang, + const char* suffix) const; public: const std::vector& GetLinkImplementationClosure( -- cgit v0.12 From ba835874a43599bcc5ee2f8321662eb34fb341aa Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 18 Jun 2020 15:42:15 -0700 Subject: Add backtrace support for language standard --- Source/cmGeneratorTarget.cxx | 37 +++++++++++++++++------- Source/cmGeneratorTarget.h | 5 +++- Source/cmMakefile.cxx | 6 ++-- Source/cmTarget.cxx | 69 ++++++++++++++++++++++++++++++++++++++++++++ Source/cmTarget.h | 7 +++++ 5 files changed, 109 insertions(+), 15 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d537be7..992682f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -947,8 +947,8 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const return it != this->ExplicitObjectName.end(); } -cmProp cmGeneratorTarget::GetLanguageStandard(std::string const& lang, - std::string const& config) const +BT const* cmGeneratorTarget::GetLanguageStandardProperty( + std::string const& lang, std::string const& config) const { std::string key = cmStrCat(cmSystemTools::UpperCase(config), '-', lang); auto langStandardIter = this->LanguageStandardMap.find(key); @@ -956,7 +956,21 @@ cmProp cmGeneratorTarget::GetLanguageStandard(std::string const& lang, return &langStandardIter->second; } - return this->Target->GetProperty(cmStrCat(lang, "_STANDARD")); + return this->Target->GetLanguageStandardProperty( + cmStrCat(lang, "_STANDARD")); +} + +cmProp cmGeneratorTarget::GetLanguageStandard(std::string const& lang, + std::string const& config) const +{ + BT const* languageStandard = + this->GetLanguageStandardProperty(lang, config); + + if (languageStandard) { + return &(languageStandard->Value); + } + + return nullptr; } cmProp cmGeneratorTarget::GetPropertyWithPairedLanguageSupport( @@ -4469,7 +4483,8 @@ bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config) const } if (!newRequiredStandard.empty()) { - this->LanguageStandardMap[key] = newRequiredStandard; + this->LanguageStandardMap[key] = + BT(newRequiredStandard, f.Backtrace); } } @@ -4480,15 +4495,15 @@ bool cmGeneratorTarget::ComputeCompileFeatures( std::string const& config, std::set const& languagePairs) const { for (const auto& language : languagePairs) { - cmProp generatorTargetLanguageStandard = - this->GetLanguageStandard(language.first, config); + BT const* generatorTargetLanguageStandard = + this->GetLanguageStandardProperty(language.first, config); if (!generatorTargetLanguageStandard) { // If the standard isn't explicitly set we copy it over from the // specified paired language. std::string key = cmStrCat(cmSystemTools::UpperCase(config), '-', language.first); - cmProp standardToCopy = - this->GetLanguageStandard(language.second, config); + BT const* standardToCopy = + this->GetLanguageStandardProperty(language.second, config); if (standardToCopy != nullptr) { this->LanguageStandardMap[key] = *standardToCopy; generatorTargetLanguageStandard = &this->LanguageStandardMap[key]; @@ -4496,7 +4511,7 @@ bool cmGeneratorTarget::ComputeCompileFeatures( cmProp defaultStandard = this->Makefile->GetDef( cmStrCat("CMAKE_", language.second, "_STANDARD_DEFAULT")); if (defaultStandard != nullptr) { - this->LanguageStandardMap[key] = *defaultStandard; + this->LanguageStandardMap[key] = BT(*defaultStandard); generatorTargetLanguageStandard = &this->LanguageStandardMap[key]; } } @@ -4504,8 +4519,8 @@ bool cmGeneratorTarget::ComputeCompileFeatures( // Custom updates for the CUDA standard. if (generatorTargetLanguageStandard != nullptr && language.first == "CUDA") { - if (*generatorTargetLanguageStandard == "98") { - this->LanguageStandardMap[key] = "03"; + if (generatorTargetLanguageStandard->Value == "98") { + this->LanguageStandardMap[key].Value = "03"; } } } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index cd53611..20f3a07 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -148,6 +148,9 @@ public: bool HasExplicitObjectName(cmSourceFile const* file) const; void AddExplicitObjectName(cmSourceFile const* sf); + BT const* GetLanguageStandardProperty( + std::string const& lang, std::string const& config) const; + cmProp GetLanguageStandard(std::string const& lang, std::string const& config) const; @@ -1050,7 +1053,7 @@ private: bool GetRPATH(const std::string& config, const std::string& prop, std::string& rpath) const; - mutable std::map LanguageStandardMap; + mutable std::map> LanguageStandardMap; cmProp GetPropertyWithPairedLanguageSupport(std::string const& lang, const char* suffix) const; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1f1c06a..3161e38 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -5070,7 +5070,7 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, target->GetProperty(cmStrCat(lang, "_STANDARD")), newRequiredStandard, error)) { if (!newRequiredStandard.empty()) { - target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard); + target->SetLanguageStandardProperty(lang, newRequiredStandard, feature); } return true; } @@ -5251,7 +5251,7 @@ bool cmMakefile::AddRequiredTargetCudaFeature(cmTarget* target, target->GetProperty(cmStrCat(lang, "_STANDARD")), newRequiredStandard, error)) { if (!newRequiredStandard.empty()) { - target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard); + target->SetLanguageStandardProperty(lang, newRequiredStandard, feature); } return true; } @@ -5356,7 +5356,7 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, target->GetProperty(cmStrCat(lang, "_STANDARD")), newRequiredStandard, error)) { if (!newRequiredStandard.empty()) { - target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard); + target->SetLanguageStandardProperty(lang, newRequiredStandard, feature); } return true; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 36e1ad5..d3b37cb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -185,6 +186,7 @@ public: std::vector InstallGenerators; std::set SystemIncludeDirectories; cmTarget::LinkLibraryVectorType OriginalLinkLibraries; + std::map> LanguageStandardProperties; std::vector IncludeDirectoriesEntries; std::vector IncludeDirectoriesBacktraces; std::vector CompileOptionsEntries; @@ -598,6 +600,35 @@ cmGlobalGenerator* cmTarget::GetGlobalGenerator() const return impl->Makefile->GetGlobalGenerator(); } +BT const* cmTarget::GetLanguageStandardProperty( + const std::string& propertyName) const +{ + auto entry = impl->LanguageStandardProperties.find(propertyName); + if (entry != impl->LanguageStandardProperties.end()) { + return &entry->second; + } + + return nullptr; +} + +void cmTarget::SetLanguageStandardProperty(std::string const& lang, + std::string const& value, + const std::string& feature) +{ + cmListFileBacktrace featureBacktrace; + for (size_t i = 0; i < impl->CompileFeaturesEntries.size(); i++) { + if (impl->CompileFeaturesEntries[i] == feature) { + if (i < impl->CompileFeaturesBacktraces.size()) { + featureBacktrace = impl->CompileFeaturesBacktraces[i]; + } + break; + } + } + + impl->LanguageStandardProperties[cmStrCat(lang, "_STANDARD")] = + BT(value, featureBacktrace); +} + void cmTarget::AddUtility(std::string const& name, bool cross, cmMakefile* mf) { impl->Utilities.insert(BT>( @@ -1127,6 +1158,11 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) return; } #define MAKE_STATIC_PROP(PROP) static const std::string prop##PROP = #PROP + MAKE_STATIC_PROP(C_STANDARD); + MAKE_STATIC_PROP(CXX_STANDARD); + MAKE_STATIC_PROP(CUDA_STANDARD); + MAKE_STATIC_PROP(OBJC_STANDARD); + MAKE_STATIC_PROP(OBJCXX_STANDARD); MAKE_STATIC_PROP(COMPILE_DEFINITIONS); MAKE_STATIC_PROP(COMPILE_FEATURES); MAKE_STATIC_PROP(COMPILE_OPTIONS); @@ -1310,6 +1346,15 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmProp tmp = reusedTarget->GetProperty("COMPILE_PDB_NAME"); this->SetProperty("COMPILE_PDB_NAME", tmp ? tmp->c_str() : nullptr); this->AddUtility(reusedFrom, false, impl->Makefile); + } else if (prop == propC_STANDARD || prop == propCXX_STANDARD || + prop == propCUDA_STANDARD || prop == propOBJC_STANDARD || + prop == propOBJCXX_STANDARD) { + if (value) { + impl->LanguageStandardProperties[prop] = + BT(value, impl->Makefile->GetBacktrace()); + } else { + impl->LanguageStandardProperties.erase(prop); + } } else { impl->Properties.SetProperty(prop, value); } @@ -1413,6 +1458,11 @@ void cmTarget::AppendProperty(const std::string& prop, } else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME")) { impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, prop + " property may not be APPENDed."); + } else if (prop == "C_STANDARD" || prop == "CXX_STANDARD" || + prop == "CUDA_STANDARD" || prop == "OBJC_STANDARD" || + prop == "OBJCXX_STANDARD") { + impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, + prop + " property may not be appended."); } else { impl->Properties.AppendProperty(prop, value, asString); } @@ -1626,6 +1676,11 @@ cmProp cmTarget::GetComputedProperty(const std::string& prop, cmProp cmTarget::GetProperty(const std::string& prop) const { #define MAKE_STATIC_PROP(PROP) static const std::string prop##PROP = #PROP + MAKE_STATIC_PROP(C_STANDARD); + MAKE_STATIC_PROP(CXX_STANDARD); + MAKE_STATIC_PROP(CUDA_STANDARD); + MAKE_STATIC_PROP(OBJC_STANDARD); + MAKE_STATIC_PROP(OBJCXX_STANDARD); MAKE_STATIC_PROP(LINK_LIBRARIES); MAKE_STATIC_PROP(TYPE); MAKE_STATIC_PROP(INCLUDE_DIRECTORIES); @@ -1646,6 +1701,11 @@ cmProp cmTarget::GetProperty(const std::string& prop) const MAKE_STATIC_PROP(TRUE); #undef MAKE_STATIC_PROP static std::unordered_set const specialProps{ + propC_STANDARD, + propCXX_STANDARD, + propCUDA_STANDARD, + propOBJC_STANDARD, + propOBJCXX_STANDARD, propLINK_LIBRARIES, propTYPE, propINCLUDE_DIRECTORIES, @@ -1664,6 +1724,15 @@ cmProp cmTarget::GetProperty(const std::string& prop) const propSOURCES }; if (specialProps.count(prop)) { + if (prop == propC_STANDARD || prop == propCXX_STANDARD || + prop == propCUDA_STANDARD || prop == propOBJC_STANDARD || + prop == propOBJCXX_STANDARD) { + auto propertyIter = impl->LanguageStandardProperties.find(prop); + if (propertyIter == impl->LanguageStandardProperties.end()) { + return nullptr; + } + return &(propertyIter->second.Value); + } if (prop == propLINK_LIBRARIES) { if (impl->LinkImplementationPropertyEntries.empty()) { return nullptr; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f0ddb68..175822d 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -233,6 +233,13 @@ public: void AddSystemIncludeDirectories(std::set const& incs); std::set const& GetSystemIncludeDirectories() const; + BT const* GetLanguageStandardProperty( + const std::string& propertyName) const; + + void SetLanguageStandardProperty(std::string const& lang, + std::string const& value, + const std::string& feature); + cmStringRange GetIncludeDirectoriesEntries() const; cmBacktraceRange GetIncludeDirectoriesBacktraces() const; -- cgit v0.12 From ee5893c10eba2353741c0db5b28c2401759c393e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 23 Jun 2020 00:02:37 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e619f64..f3c7db0 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 18) -set(CMake_VERSION_PATCH 20200622) +set(CMake_VERSION_PATCH 20200623) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 56e645a4c3f644a0ed32c472363781c5f01d81d8 Mon Sep 17 00:00:00 2001 From: evatux Date: Tue, 23 Jun 2020 09:16:14 -0700 Subject: Find{BLAS,LAPACK}: Add missing thread library for Intel MKL on Win32 The patch also updates the documentation to explicitly state that Intel10_32 stands for threaded case (linked with Intel OpenMP). Later, one may need to add Intel10_32_seq to support linking with the sequential version of Intel MKL. Fixes: #20857 --- Modules/FindBLAS.cmake | 6 +++++- Modules/FindLAPACK.cmake | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index c5d791e..29871c5 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -36,7 +36,7 @@ The following variables may be set to influence this module's behavior: * ``SCSL`` * ``SGIMATH`` * ``IBMESSL`` - * ``Intel10_32`` (intel mkl v10 32 bit) + * ``Intel10_32`` (intel mkl v10 32 bit, threaded code) * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model) * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model) * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model) @@ -397,6 +397,10 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") # Add threading/sequential libs set(BLAS_SEARCH_LIBS_WIN_THREAD "") + if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD + "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") + endif() if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index a18cec4..01ce074 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -28,7 +28,7 @@ The following variables may be set to influence this module's behavior: * ``OpenBLAS`` * ``FLAME`` - * ``Intel10_32`` (intel mkl v10 32 bit) + * ``Intel10_32`` (intel mkl v10 32 bit, threaded code) * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model) * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model) * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model) -- cgit v0.12 From bb2d9a02be8d78c9e7a22f09fc8e5890283a4a8d Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 24 Jun 2020 00:02:09 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f3c7db0..6cc9b1a 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 18) -set(CMake_VERSION_PATCH 20200623) +set(CMake_VERSION_PATCH 20200624) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From c4cc21d20b79d682a99cc28957cf973ebf1993ff Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 24 Jun 2020 08:34:08 -0400 Subject: cmVisualStudio10TargetGenerator: Do not segfault on empty config The VS generator should error out earlier when no configurations are specified, but for now cover this symptom. --- Source/cmVisualStudio10TargetGenerator.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a3ccd2b..a191f70 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4131,8 +4131,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) } // Don't reference targets that don't produce any output. - if (dt->GetManagedType(this->Configurations[0]) == - cmGeneratorTarget::ManagedType::Undefined) { + if (this->Configurations.empty() || + dt->GetManagedType(this->Configurations[0]) == + cmGeneratorTarget::ManagedType::Undefined) { e2.Element("ReferenceOutputAssembly", "false"); e2.Element("CopyToOutputDirectory", "Never"); } -- cgit v0.12 From eae15dce6a3fdb9b02c86891553e5cf408401672 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 23 Jun 2020 09:18:02 -0400 Subject: Genex: $ now supports multiple configurations Instead of having to do $,$> you can do $ --- Help/manual/cmake-generator-expressions.7.rst | 9 +++---- Source/cmGeneratorExpressionNode.cxx | 28 ++++++++++++---------- Tests/GeneratorExpression/CMakeLists.txt | 10 ++++---- Tests/GeneratorExpression/check-part3.cmake | 2 +- .../GeneratorExpression/BadCONFIG-stderr.txt | 9 ------- Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake | 1 - .../CONFIG-empty-entries-check.cmake | 6 +++++ .../GeneratorExpression/CONFIG-empty-entries.cmake | 9 +++++++ .../CONFIG-multiple-entries-check.cmake | 6 +++++ .../CONFIG-multiple-entries.cmake | 8 +++++++ .../GeneratorExpression/RunCMakeTest.cmake | 14 +++++++++++ Tests/VSWinStorePhone/CMakeLists.txt | 2 +- 12 files changed, 70 insertions(+), 34 deletions(-) create mode 100644 Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 124da44..935f557 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -105,10 +105,11 @@ Variable Queries ``$`` ``1`` if ``target`` exists, else ``0``. -``$`` - ``1`` if config is ``cfg``, else ``0``. This is a case-insensitive comparison. - The mapping in :prop_tgt:`MAP_IMPORTED_CONFIG_` is also considered by - this expression when it is evaluated on a property on an :prop_tgt:`IMPORTED` +``$`` + ``1`` if config is any one of the entires in ``cfgs``, else ``0``. This is a + case-insensitive comparison. The mapping in + :prop_tgt:`MAP_IMPORTED_CONFIG_` is also considered by this + expression when it is evaluated on a property on an :prop_tgt:`IMPORTED` target. ``$`` where ``platform_ids`` is a comma-separated list. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 3e0c21c..b712b71 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -881,7 +881,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode { ConfigurationTestNode() {} // NOLINT(modernize-use-equals-default) - int NumExpectedParameters() const override { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } std::string Evaluate( const std::vector& parameters, @@ -899,13 +899,15 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode return std::string(); } context->HadContextSensitiveCondition = true; - if (context->Config.empty()) { - return parameters.front().empty() ? "1" : "0"; - } - - if (cmsysString_strcasecmp(parameters.front().c_str(), - context->Config.c_str()) == 0) { - return "1"; + for (auto& param : parameters) { + if (context->Config.empty()) { + if (param.empty()) { + return "1"; + } + } else if (cmsysString_strcasecmp(param.c_str(), + context->Config.c_str()) == 0) { + return "1"; + } } if (context->CurrentTarget && context->CurrentTarget->IsImported()) { @@ -922,10 +924,12 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode "MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(context->Config)); if (cmProp mapValue = context->CurrentTarget->GetProperty(mapProp)) { cmExpandList(cmSystemTools::UpperCase(*mapValue), mappedConfigs); - return cm::contains(mappedConfigs, - cmSystemTools::UpperCase(parameters.front())) - ? "1" - : "0"; + + for (auto& param : parameters) { + if (cm::contains(mappedConfigs, cmSystemTools::UpperCase(param))) { + return "1"; + } + } } } } diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 9d51342..ebbe288 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -40,9 +40,9 @@ add_custom_target(check-part1 ALL -Dtest_and_0_invalidcontent=$ -Dtest_config_0=$x> -Dtest_config_1=$> - -Dtest_config_debug=$$$ - -Dtest_config_release=$$$ - -Dtest_config_relwithdebinfo=$$$ + -Dtest_config_debug=$ + -Dtest_config_release=$$ + -Dtest_config_relwithdebinfo=$$ -Dtest_config_minsizerel=$$$ -Dtest_not_0=$ -Dtest_not_1=$ @@ -180,9 +180,7 @@ set_property(TARGET imported3 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) set_property(TARGET imported3 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<$:$>) set_property(TARGET imported3 APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES $<$:$>) -set_property(TARGET imported3 APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES $<$:$>) + INTERFACE_INCLUDE_DIRECTORIES $<$:$>) set_property(TARGET imported3 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<$:$>) diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 4fb7308..b5eafa6 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -13,7 +13,7 @@ if(config AND NOT config STREQUAL NoConfig) message(SEND_ERROR "test_imported_includes is not correct: ${test_imported_includes}") endif() else() - if(NOT "${test_imported_includes}" MATCHES "^;;;$") + if(NOT "${test_imported_includes}" MATCHES "^;;$") message(SEND_ERROR "test_imported_includes is not an empty list: ${test_imported_includes}") endif() endif() diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt index 42dd0ce..130de2b 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -10,15 +10,6 @@ Call Stack \(most recent call first\): CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): Error evaluating generator expression: - \$ - - \$ expression requires one or zero parameters. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): - Error evaluating generator expression: - \$ Expression syntax not recognized. diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake index 5c22aaa..1735ab7 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -1,6 +1,5 @@ add_custom_target(check ALL COMMAND check $ - $ $ $<$:foo> VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake new file mode 100644 index 0000000..b43256b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CONFIG-empty-entries-generated.txt" content) + +set(expected "1234") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake new file mode 100644 index 0000000..a4d53f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0070 NEW) + +set(text) +string(APPEND text "$<$:1>") +string(APPEND text "$<$:2>") +string(APPEND text "$<$:3>") +string(APPEND text "$<$:4>") +string(APPEND text "$<$:5>") +file(GENERATE OUTPUT CONFIG-empty-entries-generated.txt CONTENT ${text}) diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake new file mode 100644 index 0000000..66f42c7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CONFIG-multiple-entries-generated.txt" content) + +set(expected "14") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake new file mode 100644 index 0000000..6829282 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0070 NEW) + +set(text) +string(APPEND text "$<$:1>") +string(APPEND text "$<$:2>") +string(APPEND text "$<$:3>") +string(APPEND text "$<$:4>") +file(GENERATE OUTPUT CONFIG-multiple-entries-generated.txt CONTENT "${text}") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 0278cf6..6349112 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -12,6 +12,7 @@ run_cmake(BadTargetTypeInterface) run_cmake(BadTargetTypeObject) run_cmake(BadInstallPrefix) run_cmake(BadSHELL_PATH) +run_cmake(BadCONFIG) run_cmake(CMP0044-WARN) run_cmake(NonValidTarget-C_COMPILER_ID) run_cmake(NonValidTarget-CXX_COMPILER_ID) @@ -44,6 +45,19 @@ run_cmake(FILTER-InvalidOperator) run_cmake(FILTER-Exclude) run_cmake(FILTER-Include) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS [==[-DCMAKE_CONFIGURATION_TYPES=CustomConfig]==]) +else() + set(RunCMake_TEST_OPTIONS [==[-DCMAKE_BUILD_TYPE=CustomConfig]==]) +endif() +run_cmake(CONFIG-multiple-entries) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS [==[-DCMAKE_CONFIGURATION_TYPES=]==]) +else() + set(RunCMake_TEST_OPTIONS [==[-DCMAKE_BUILD_TYPE=]==]) +endif() +run_cmake(CONFIG-empty-entries) + set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD) run_cmake(CMP0085-OLD) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index 558d5de..56e4c1d 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -114,7 +114,7 @@ set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "Assets") set_property(SOURCE ${STRING_FILES} PROPERTY VS_TOOL_OVERRIDE "PRIResource") set_property(SOURCE ${DEBUG_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $) set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY - VS_DEPLOYMENT_CONTENT $,$,$>) + VS_DEPLOYMENT_CONTENT $) set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel) set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS) -- cgit v0.12 From 6051a49c78a36b82e77a62e09f0ba5a5b5d14532 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 12 Jun 2020 15:11:04 -0400 Subject: Visual Studio: Add Android support --- Help/release/dev/visual-studio-android.rst | 7 ++ Modules/CMakeDetermineCompilerId.cmake | 29 +++++- Modules/CompilerId/VS-10.vcxproj.in | 4 +- Modules/Platform/Android-Clang.cmake | 3 + Modules/Platform/Android-Determine.cmake | 61 ++++++++++++- Modules/Platform/Android-Initialize.cmake | 2 +- Modules/Platform/Android/VCXProjInspect.vcxproj.in | 38 ++++++++ Source/cmGlobalVisualStudio10Generator.cxx | 100 +++++++++++++++++---- Source/cmGlobalVisualStudio10Generator.h | 16 ++++ Source/cmGlobalVisualStudio14Generator.cxx | 6 ++ Source/cmGlobalVisualStudio14Generator.h | 6 ++ Source/cmGlobalVisualStudioVersionedGenerator.cxx | 38 ++++++++ Source/cmGlobalVisualStudioVersionedGenerator.h | 2 + Source/cmVisualStudio10TargetGenerator.cxx | 59 ++++++++++-- Source/cmVisualStudio10TargetGenerator.h | 2 + Tests/CMakeLists.txt | 61 +++++++++---- Tests/RunCMake/Android/RunCMakeTest.cmake | 53 +++++++++-- Tests/RunCMake/Android/ndk-arm64-v8a-stderr.txt | 7 ++ Tests/RunCMake/Android/ndk-armeabi-arm-stderr.txt | 7 ++ .../RunCMake/Android/ndk-armeabi-thumb-stderr.txt | 7 ++ .../Android/ndk-armeabi-v7a-neon-stderr.txt | 7 ++ Tests/RunCMake/Android/ndk-armeabi-v7a-stderr.txt | 7 ++ Tests/RunCMake/Android/ndk-x86-stderr.txt | 7 ++ Tests/RunCMake/Android/ndk-x86_64-stderr.txt | 7 ++ Tests/RunCMake/CMakeLists.txt | 4 +- Tests/VSAndroid/AndroidManifest.xml | 16 ++++ Tests/VSAndroid/CMakeLists.txt | 57 ++++++++++++ Tests/VSAndroid/build.xml | 4 + Tests/VSAndroid/jni/first.c | 22 +++++ Tests/VSAndroid/jni/first.h | 22 +++++ Tests/VSAndroid/jni/second.c | 25 ++++++ Tests/VSAndroid/proguard-android.txt | 57 ++++++++++++ Tests/VSAndroid/res/values/strings.xml | 4 + .../VSAndroid/src/com/example/twolibs/TwoLibs.java | 46 ++++++++++ Tests/VSNsightTegra/AndroidManifest.xml | 16 ---- Tests/VSNsightTegra/CMakeLists.txt | 57 ------------ Tests/VSNsightTegra/build.xml | 4 - Tests/VSNsightTegra/jni/first.c | 22 ----- Tests/VSNsightTegra/jni/first.h | 22 ----- Tests/VSNsightTegra/jni/second.c | 25 ------ Tests/VSNsightTegra/proguard-android.txt | 57 ------------ Tests/VSNsightTegra/res/values/strings.xml | 4 - .../src/com/example/twolibs/TwoLibs.java | 46 ---------- 43 files changed, 731 insertions(+), 315 deletions(-) create mode 100644 Help/release/dev/visual-studio-android.rst create mode 100644 Modules/Platform/Android/VCXProjInspect.vcxproj.in create mode 100644 Tests/RunCMake/Android/ndk-arm64-v8a-stderr.txt create mode 100644 Tests/RunCMake/Android/ndk-armeabi-arm-stderr.txt create mode 100644 Tests/RunCMake/Android/ndk-armeabi-thumb-stderr.txt create mode 100644 Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stderr.txt create mode 100644 Tests/RunCMake/Android/ndk-armeabi-v7a-stderr.txt create mode 100644 Tests/RunCMake/Android/ndk-x86-stderr.txt create mode 100644 Tests/RunCMake/Android/ndk-x86_64-stderr.txt create mode 100644 Tests/VSAndroid/AndroidManifest.xml create mode 100644 Tests/VSAndroid/CMakeLists.txt create mode 100644 Tests/VSAndroid/build.xml create mode 100644 Tests/VSAndroid/jni/first.c create mode 100644 Tests/VSAndroid/jni/first.h create mode 100644 Tests/VSAndroid/jni/second.c create mode 100644 Tests/VSAndroid/proguard-android.txt create mode 100644 Tests/VSAndroid/res/values/strings.xml create mode 100644 Tests/VSAndroid/src/com/example/twolibs/TwoLibs.java delete mode 100644 Tests/VSNsightTegra/AndroidManifest.xml delete mode 100644 Tests/VSNsightTegra/CMakeLists.txt delete mode 100644 Tests/VSNsightTegra/build.xml delete mode 100644 Tests/VSNsightTegra/jni/first.c delete mode 100644 Tests/VSNsightTegra/jni/first.h delete mode 100644 Tests/VSNsightTegra/jni/second.c delete mode 100644 Tests/VSNsightTegra/proguard-android.txt delete mode 100644 Tests/VSNsightTegra/res/values/strings.xml delete mode 100644 Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java diff --git a/Help/release/dev/visual-studio-android.rst b/Help/release/dev/visual-studio-android.rst new file mode 100644 index 0000000..4e1a110 --- /dev/null +++ b/Help/release/dev/visual-studio-android.rst @@ -0,0 +1,7 @@ +visual-studio-android +--------------------- + +* The :ref:`Visual Studio Generators` for Visual Studio 2015 and above gained + support for the Visual Studio Tools for Android. This allows you to set + :variable:`CMAKE_SYSTEM_NAME` to `Android` to generate `.vcxproj` files for + the Android tools. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index df48fa5..ebfd5a4 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -248,7 +248,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_PostBuildEvent_Command "") if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm](_v[0-9]+(_xp)?)?$") set(id_cl_var "ClangClExecutable") - elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Cc][Ll][Aa][Nn][Gg][Cc][Ll]$") + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Cc][Ll][Aa][Nn][Gg]([Cc][Ll]$|_[0-9])") set(id_cl "$(CLToolExe)") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") set(id_cl clang.exe) @@ -310,17 +310,36 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_PreferredToolArchitecture "") endif() if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") + set(id_keyword "Win32Proj") set(id_system "Windows Phone") elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(id_keyword "Win32Proj") set(id_system "Windows Store") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") + set(id_keyword "Android") + set(id_system "Android") else() + set(id_keyword "Win32Proj") set(id_system "") endif() - if(id_system AND CMAKE_SYSTEM_VERSION MATCHES "^([0-9]+\\.[0-9]+)") + if(id_keyword STREQUAL "Android") + if(CMAKE_GENERATOR MATCHES "Visual Studio 14") + set(id_system_version "2.0") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[56]") + set(id_system_version "3.0") + else() + set(id_system_version "") + endif() + elseif(id_system AND CMAKE_SYSTEM_VERSION MATCHES "^([0-9]+\\.[0-9]+)") set(id_system_version "${CMAKE_MATCH_1}") else() set(id_system_version "") endif() + if(id_keyword STREQUAL "Android") + set(id_config_type "DynamicLibrary") + else() + set(id_config_type "Application") + endif() if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) set(id_WindowsTargetPlatformVersion "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") endif() @@ -333,9 +352,11 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} string(APPEND id_CustomGlobals "<${CMAKE_MATCH_1}>${CMAKE_MATCH_2}\n ") endif() endforeach() - if(id_platform STREQUAL ARM64) + if(id_keyword STREQUAL "Android") + set(id_WindowsSDKDesktopARMSupport "") + elseif(id_platform STREQUAL "ARM64") set(id_WindowsSDKDesktopARMSupport "true") - elseif(id_platform STREQUAL ARM) + elseif(id_platform STREQUAL "ARM") set(id_WindowsSDKDesktopARMSupport "true") else() set(id_WindowsSDKDesktopARMSupport "") diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in index b48a332..3598fc7 100644 --- a/Modules/CompilerId/VS-10.vcxproj.in +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -9,7 +9,7 @@ {CAE07175-D007-4FC3-BFE8-47B392814159} CompilerId@id_lang@ - Win32Proj + @id_keyword@ @id_system@ @id_system_version@ @id_WindowsTargetPlatformVersion@ @@ -24,7 +24,7 @@ @id_PreferredToolArchitecture@ - Application + @id_config_type@ @id_toolset@ MultiByte diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake index 759448b..160eada 100644 --- a/Modules/Platform/Android-Clang.cmake +++ b/Modules/Platform/Android-Clang.cmake @@ -53,4 +53,7 @@ macro(__android_compiler_clang lang) endif() list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}") endif() + if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(_ANDROID_STL_NOSTDLIBXX 1) + endif() endmacro() diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index 2225897..11a0504 100644 --- a/Modules/Platform/Android-Determine.cmake +++ b/Modules/Platform/Android-Determine.cmake @@ -7,8 +7,8 @@ # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with -# that functionality for now. Later we may try to integrate this. -if(CMAKE_GENERATOR MATCHES "Visual Studio") +# that functionality for now. +if(CMAKE_GENERATOR_PLATFORM STREQUAL "Tegra-Android") return() endif() @@ -27,6 +27,63 @@ endif() cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST +# If using Android tools for Visual Studio, compile a sample project to get the +# sysroot. +if(CMAKE_GENERATOR MATCHES "Visual Studio") + if(NOT CMAKE_SYSROOT) + set(vcx_platform ${CMAKE_GENERATOR_PLATFORM}) + if(CMAKE_GENERATOR MATCHES "Visual Studio 1[45]") + set(vcx_sysroot_var "Sysroot") + else() + set(vcx_sysroot_var "SysrootLink") + endif() + if(CMAKE_GENERATOR MATCHES "Visual Studio 14") + set(vcx_revision "2.0") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[56]") + set(vcx_revision "3.0") + else() + set(vcx_revision "") + endif() + configure_file(${CMAKE_ROOT}/Modules/Platform/Android/VCXProjInspect.vcxproj.in + ${CMAKE_PLATFORM_INFO_DIR}/VCXProjInspect.vcxproj @ONLY) + execute_process( + COMMAND "${CMAKE_VS_MSBUILD_COMMAND}" "VCXProjInspect.vcxproj" + "/p:Configuration=Debug" "/p:Platform=${vcx_platform}" + WORKING_DIRECTORY ${CMAKE_PLATFORM_INFO_DIR} + OUTPUT_VARIABLE VCXPROJ_INSPECT_OUTPUT + ERROR_VARIABLE VCXPROJ_INSPECT_OUTPUT + RESULT_VARIABLE VCXPROJ_INSPECT_RESULT + ) + if(NOT CMAKE_SYSROOT AND VCXPROJ_INSPECT_OUTPUT MATCHES "CMAKE_SYSROOT=([^%\r\n]+)[\r\n]") + # Strip VS diagnostic output from the end of the line. + string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _sysroot "${CMAKE_MATCH_1}") + if(EXISTS "${_sysroot}") + file(TO_CMAKE_PATH "${_sysroot}" CMAKE_SYSROOT) + endif() + endif() + if(VCXPROJ_INSPECT_RESULT) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the sysroot for the Android NDK failed. +The output was: +${VCXPROJ_INSPECT_RESULT} +${VCXPROJ_INSPECT_OUTPUT} + +") + else() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the sysroot for the Android NDK succeeded. +The output was: +${VCXPROJ_INSPECT_RESULT} +${VCXPROJ_INSPECT_OUTPUT} + +") + endif() + endif() + if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION) + set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION "clang") + endif() +endif() + # If the user provided CMAKE_SYSROOT for us, extract information from it. set(_ANDROID_SYSROOT_NDK "") set(_ANDROID_SYSROOT_API "") diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake index b90dd7a..5019c28 100644 --- a/Modules/Platform/Android-Initialize.cmake +++ b/Modules/Platform/Android-Initialize.cmake @@ -6,7 +6,7 @@ # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with -# that functionality for now. Later we may try to integrate this. +# that functionality for now. if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") return() endif() diff --git a/Modules/Platform/Android/VCXProjInspect.vcxproj.in b/Modules/Platform/Android/VCXProjInspect.vcxproj.in new file mode 100644 index 0000000..6919d2c --- /dev/null +++ b/Modules/Platform/Android/VCXProjInspect.vcxproj.in @@ -0,0 +1,38 @@ + + + + + Debug + @vcx_platform@ + + + + {14D44772-ECF7-47BD-9E29-BC62FAF940A5} + VCXProjInspect + Android + Android + @vcx_revision@ + + + + + + DynamicLibrary + MultiByte + + + + + + <_ProjectFileVersion>10.0.30319.1 + false + + + + %40echo CMAKE_SYSROOT=$(@vcx_sysroot_var@) + + + + + + diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index cef9062..3805546 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -508,18 +508,16 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } - std::string v = this->GetInstalledNsightTegraVersion(); - if (v.empty()) { - mf->IssueMessage(MessageType::FATAL_ERROR, - "CMAKE_SYSTEM_NAME is 'Android' but " - "'NVIDIA Nsight Tegra Visual Studio Edition' " - "is not installed."); - return false; + if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") == "Tegra-Android") { + if (!this->InitializeTegraAndroid(mf)) { + return false; + } + } else { + this->SystemIsAndroid = true; + if (!this->InitializeAndroid(mf)) { + return false; + } } - this->DefaultPlatformName = "Tegra-Android"; - this->DefaultPlatformToolset = "Default"; - this->NsightTegraVersion = v; - mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v); } return true; @@ -561,6 +559,31 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf) return false; } +bool cmGlobalVisualStudio10Generator::InitializeTegraAndroid(cmMakefile* mf) +{ + std::string v = this->GetInstalledNsightTegraVersion(); + if (v.empty()) { + mf->IssueMessage(MessageType::FATAL_ERROR, + "CMAKE_SYSTEM_NAME is 'Android' but " + "'NVIDIA Nsight Tegra Visual Studio Edition' " + "is not installed."); + return false; + } + this->DefaultPlatformName = "Tegra-Android"; + this->DefaultPlatformToolset = "Default"; + this->NsightTegraVersion = v; + mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v); + return true; +} + +bool cmGlobalVisualStudio10Generator::InitializeAndroid(cmMakefile* mf) +{ + std::ostringstream e; + e << this->GetName() << " does not support Android."; + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + return false; +} + bool cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset( std::string& toolset) const { @@ -595,6 +618,28 @@ void cmGlobalVisualStudio10Generator::Generate() { this->LongestSource = LongestSourcePath(); this->cmGlobalVisualStudio8Generator::Generate(); + if (!this->AndroidExecutableWarnings.empty() && + !this->CMakeInstance->GetIsInTryCompile()) { + std::ostringstream e; + /* clang-format off */ + e << + "You are using Visual Studio tools for Android, which does not support " + "standalone executables. However, the following executable targets do " + "not have the ANDROID_GUI property set, and thus will not be built as " + "expected. They will be built as shared libraries with executable " + "filenames:\n" + " "; + /* clang-format on */ + bool first = true; + for (auto const& name : this->AndroidExecutableWarnings) { + if (!first) { + e << ", "; + } + first = false; + e << name; + } + this->CMakeInstance->IssueMessage(MessageType::WARNING, e.str()); + } if (this->LongestSource.Length > 0) { cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator(); std::ostringstream e; @@ -661,8 +706,14 @@ std::string const& cmGlobalVisualStudio10Generator::GetPlatformToolsetString() if (!this->GeneratorToolset.empty()) { return this->GeneratorToolset; } - if (!this->DefaultPlatformToolset.empty()) { - return this->DefaultPlatformToolset; + if (this->SystemIsAndroid) { + if (!this->DefaultAndroidToolset.empty()) { + return this->DefaultAndroidToolset; + } + } else { + if (!this->DefaultPlatformToolset.empty()) { + return this->DefaultPlatformToolset; + } } static std::string const empty; return empty; @@ -876,7 +927,10 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) epg.Attribute("Label", "Globals"); cmXMLElement(epg, "ProjectGuid") .Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}"); - cmXMLElement(epg, "Keyword").Content("Win32Proj"); + cmXMLElement(epg, "Keyword") + .Content(mf->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "Android" + ? "Android" + : "Win32Proj"); cmXMLElement(epg, "Platform").Content(this->GetPlatformName()); if (this->GetSystemName() == "WindowsPhone") { cmXMLElement(epg, "ApplicationType").Content("Windows Phone"); @@ -886,15 +940,21 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) cmXMLElement(epg, "ApplicationType").Content("Windows Store"); cmXMLElement(epg, "ApplicationTypeRevision") .Content(this->GetApplicationTypeRevision()); + } else if (this->GetSystemName() == "Android") { + cmXMLElement(epg, "ApplicationType").Content("Android"); + cmXMLElement(epg, "ApplicationTypeRevision") + .Content(this->GetApplicationTypeRevision()); } if (!this->WindowsTargetPlatformVersion.empty()) { cmXMLElement(epg, "WindowsTargetPlatformVersion") .Content(this->WindowsTargetPlatformVersion); } - if (this->GetPlatformName() == "ARM64") { - cmXMLElement(epg, "WindowsSDKDesktopARM64Support").Content("true"); - } else if (this->GetPlatformName() == "ARM") { - cmXMLElement(epg, "WindowsSDKDesktopARMSupport").Content("true"); + if (this->GetSystemName() != "Android") { + if (this->GetPlatformName() == "ARM64") { + cmXMLElement(epg, "WindowsSDKDesktopARM64Support").Content("true"); + } else if (this->GetPlatformName() == "ARM") { + cmXMLElement(epg, "WindowsSDKDesktopARMSupport").Content("true"); + } } } cmXMLElement(eprj, "Import") @@ -1206,6 +1266,10 @@ std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion() std::string cmGlobalVisualStudio10Generator::GetApplicationTypeRevision() const { + if (this->GetSystemName() == "Android") { + return this->GetAndroidApplicationTypeRevision(); + } + // Return the first two '.'-separated components of the Windows version. std::string::size_type end1 = this->SystemVersion.find('.'); std::string::size_type end2 = diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index bd5c4be..0c53537 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -4,6 +4,7 @@ #define cmGlobalVisualStudio10Generator_h #include +#include #include "cmGlobalVisualStudio8Generator.h" #include "cmVisualStudio10ToolsetOptions.h" @@ -43,6 +44,11 @@ public: void EnableLanguage(std::vector const& languages, cmMakefile*, bool optional) override; + void AddAndroidExecutableWarning(const std::string& name) + { + this->AndroidExecutableWarnings.insert(name); + } + bool IsCudaEnabled() const { return this->CudaEnabled; } /** Generating for Nsight Tegra VS plugin? */ @@ -100,6 +106,9 @@ public: /** Return true if building for WindowsStore */ bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; } + /** Return true if building for Android */ + bool TargetsAndroid() const { return this->SystemIsAndroid; } + const char* GetCMakeCFGIntDir() const override { return "$(Configuration)"; } bool Find64BitTools(cmMakefile* mf); @@ -128,6 +137,8 @@ public: /** Return the first two components of CMAKE_SYSTEM_VERSION. */ std::string GetApplicationTypeRevision() const; + virtual const char* GetAndroidApplicationTypeRevision() const { return ""; } + cmIDEFlagTable const* GetClFlagTable() const; cmIDEFlagTable const* GetCSharpFlagTable() const; cmIDEFlagTable const* GetRcFlagTable() const; @@ -148,6 +159,8 @@ protected: virtual bool InitializeWindowsCE(cmMakefile* mf); virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); + virtual bool InitializeTegraAndroid(cmMakefile* mf); + virtual bool InitializeAndroid(cmMakefile* mf); virtual bool ProcessGeneratorToolsetField(std::string const& key, std::string const& value); @@ -171,6 +184,7 @@ protected: std::string GeneratorToolsetCudaCustomDir; std::string DefaultPlatformToolset; std::string DefaultPlatformToolsetHostArchitecture; + std::string DefaultAndroidToolset; std::string WindowsTargetPlatformVersion; std::string SystemName; std::string SystemVersion; @@ -188,6 +202,7 @@ protected: bool SystemIsWindowsCE = false; bool SystemIsWindowsPhone = false; bool SystemIsWindowsStore = false; + bool SystemIsAndroid = false; private: class Factory; @@ -211,6 +226,7 @@ private: std::string MSBuildCommand; bool MSBuildCommandInitialized; cmVisualStudio10ToolsetOptions ToolsetOptions; + std::set AndroidExecutableWarnings; virtual std::string FindMSBuildCommand(); std::string FindDevEnvCommand() override; std::string GetVSMakeProgram() override { return this->GetMSBuildCommand(); } diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index f549b6a..451d448 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -109,6 +109,7 @@ cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( "ProductDir", vc14Express, cmSystemTools::KeyWOW64_32); this->DefaultPlatformToolset = "v140"; + this->DefaultAndroidToolset = "Clang_3_8"; this->DefaultCLFlagTableName = "v140"; this->DefaultCSharpFlagTableName = "v140"; this->DefaultLibFlagTableName = "v14"; @@ -159,6 +160,11 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf) return true; } +bool cmGlobalVisualStudio14Generator::InitializeAndroid(cmMakefile*) +{ + return true; +} + bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf, bool required) { diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index ccc2917..39353f2 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -23,12 +23,18 @@ public: bool MatchesGeneratorName(const std::string& name) const override; + const char* GetAndroidApplicationTypeRevision() const override + { + return "2.0"; + } + protected: cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name, std::string const& platformInGeneratorName); bool InitializeWindows(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; + bool InitializeAndroid(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; // These aren't virtual because we need to check if the selected version diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 605dc8b..e2e045c 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -100,6 +100,24 @@ static const char* VSVersionToToolset( return ""; } +static const char* VSVersionToAndroidToolset( + cmGlobalVisualStudioGenerator::VSVersion v) +{ + switch (v) { + case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VS12: + return ""; + case cmGlobalVisualStudioGenerator::VS14: + return "Clang_3_8"; + case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VS16: + return "Clang_5_0"; + } + return ""; +} + static const char vs15generatorName[] = "Visual Studio 15 2017"; // Map generator name without year to name with year. @@ -284,6 +302,7 @@ cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator( this->Version = version; this->ExpressEdition = false; this->DefaultPlatformToolset = VSVersionToToolset(this->Version); + this->DefaultAndroidToolset = VSVersionToAndroidToolset(this->Version); this->DefaultCLFlagTableName = VSVersionToToolset(this->Version); this->DefaultCSharpFlagTableName = VSVersionToToolset(this->Version); this->DefaultLinkFlagTableName = VSVersionToToolset(this->Version); @@ -408,6 +427,25 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const vsInstanceVersion > vsInstanceVersion16_7_P2); } +const char* +cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision() + const +{ + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VS12: + return ""; + case cmGlobalVisualStudioGenerator::VS14: + return "2.0"; + case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VS16: + return "3.0"; + } + return ""; +} + std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const { const char* version = this->GetPlatformToolsetVersion(); diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index cbd3ba7..d5b8337 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -36,6 +36,8 @@ public: bool IsStdOutEncodingSupported() const override; + const char* GetAndroidApplicationTypeRevision() const override; + protected: cmGlobalVisualStudioVersionedGenerator( VSVersion version, cmake* cm, const std::string& name, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 31bb7be..e977891 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -234,13 +234,14 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator( { this->Makefile->GetConfigurations(this->Configurations); this->NsightTegra = gg->IsNsightTegra(); + this->Android = gg->TargetsAndroid(); for (int i = 0; i < 4; ++i) { this->NsightTegraVersion[i] = 0; } sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u", &this->NsightTegraVersion[0], &this->NsightTegraVersion[1], &this->NsightTegraVersion[2], &this->NsightTegraVersion[3]); - this->MSTools = !this->NsightTegra; + this->MSTools = !this->NsightTegra && !this->Android; this->Managed = false; this->TargetCompileAsWinRT = false; this->IsMissingFiles = false; @@ -333,6 +334,13 @@ void cmVisualStudio10TargetGenerator::Generate() this->ProjectType = csproj; this->Managed = true; } + + if (this->Android && + this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE && + !this->GeneratorTarget->Target->IsAndroidGuiExecutable()) { + this->GlobalGenerator->AddAndroidExecutableWarning(this->Name); + } + // Tell the global generator the name of the project file this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME", this->Name); @@ -427,7 +435,7 @@ void cmVisualStudio10TargetGenerator::Generate() e1.Attribute("Label", "Globals"); e1.Element("ProjectGuid", "{" + this->GUID + "}"); - if (this->MSTools && + if ((this->MSTools || this->Android) && this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) { this->WriteApplicationTypeSettings(e1); this->VerifyNecessaryFiles(); @@ -469,7 +477,11 @@ void cmVisualStudio10TargetGenerator::Generate() cmProp vsGlobalKeyword = this->GeneratorTarget->GetProperty("VS_GLOBAL_KEYWORD"); if (!vsGlobalKeyword) { - e1.Element("Keyword", "Win32Proj"); + if (this->GlobalGenerator->TargetsAndroid()) { + e1.Element("Keyword", "Android"); + } else { + e1.Element("Keyword", "Win32Proj"); + } } else { e1.Element("Keyword", *vsGlobalKeyword); } @@ -1137,6 +1149,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) !this->GeneratorTarget->Target->IsAndroidGuiExecutable()) { // Android executables are .so too. configType = "DynamicLibrary"; + } else if (this->Android) { + configType = "DynamicLibrary"; } else { configType = "Application"; } @@ -1166,6 +1180,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) } } else if (this->NsightTegra) { this->WriteNsightTegraConfigurationValues(e1, c); + } else if (this->Android) { + this->WriteAndroidConfigurationValues(e1, c); } } } @@ -1324,6 +1340,24 @@ void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues( } } +void cmVisualStudio10TargetGenerator::WriteAndroidConfigurationValues( + Elem& e1, std::string const&) +{ + cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; + if (cmProp projectToolsetOverride = + this->GeneratorTarget->GetProperty("VS_PLATFORM_TOOLSET")) { + e1.Element("PlatformToolset", *projectToolsetOverride); + } else if (const char* toolset = gg->GetPlatformToolset()) { + e1.Element("PlatformToolset", toolset); + } + if (cmProp stlType = + this->GeneratorTarget->GetProperty("ANDROID_STL_TYPE")) { + if (*stlType != "none") { + e1.Element("UseOfStl", *stlType); + } + } +} + void cmVisualStudio10TargetGenerator::WriteCustomCommands(Elem& e0) { this->CSharpCustomCommandNames.clear(); @@ -2909,7 +2943,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( } } - if (this->MSTools) { + if (this->Android) { + e2.Element("ObjectFileName", "$(IntDir)%(filename).o"); + } else if (this->MSTools) { cmsys::RegularExpression clangToolset("v[0-9]+_clang_.*"); const char* toolset = this->GlobalGenerator->GetPlatformToolset(); if (toolset && clangToolset.find(toolset)) { @@ -4347,6 +4383,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) bool isAppContainer = false; bool const isWindowsPhone = this->GlobalGenerator->TargetsWindowsPhone(); bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore(); + bool const isAndroid = this->GlobalGenerator->TargetsAndroid(); std::string const& rev = this->GlobalGenerator->GetApplicationTypeRevision(); if (isWindowsPhone || isWindowsStore) { e1.Element("ApplicationType", @@ -4384,13 +4421,19 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) this->Name + "_$(Configuration)_$(Platform).xap"); } } + } else if (isAndroid) { + e1.Element("ApplicationType", "Android"); + e1.Element("ApplicationTypeRevision", + gg->GetAndroidApplicationTypeRevision()); } if (isAppContainer) { e1.Element("AppContainerApplication", "true"); - } else if (this->Platform == "ARM64") { - e1.Element("WindowsSDKDesktopARM64Support", "true"); - } else if (this->Platform == "ARM") { - e1.Element("WindowsSDKDesktopARMSupport", "true"); + } else if (!isAndroid) { + if (this->Platform == "ARM64") { + e1.Element("WindowsSDKDesktopARM64Support", "true"); + } else if (this->Platform == "ARM") { + e1.Element("WindowsSDKDesktopARMSupport", "true"); + } } std::string const& targetPlatformVersion = gg->GetWindowsTargetPlatformVersion(); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 7c71de3..c54057a 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -70,6 +70,7 @@ private: void WriteExtraSource(Elem& e1, cmSourceFile const* sf); void WriteNsightTegraConfigurationValues(Elem& e1, std::string const& config); + void WriteAndroidConfigurationValues(Elem& e1, std::string const& config); void WriteSource(Elem& e2, cmSourceFile const* sf); void WriteExcludeFromBuild(Elem& e2, std::vector const& exclude_configs); @@ -215,6 +216,7 @@ private: bool MSTools; bool Managed; bool NsightTegra; + bool Android; unsigned int NsightTegraVersion[4]; bool TargetCompileAsWinRT; std::set IPOEnabledConfigurations; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b771ff5..8c871c3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -206,6 +206,26 @@ if(BUILD_TESTING) set(${reg} 0) endif() endforeach() + if(COMMAND cmake_host_system_information) + set(info_vs15 "VS_15_DIR") + set(info_vs16 "VS_16_DIR") + set(vs_versions) + if(WIN32) + if(NOT CMAKE_VERSION VERSION_LESS 3.14) + set(vs_versions vs15 vs16) + elseif(NOT CMAKE_VERSION VERSION_LESS 3.8) + set(vs_versions vs15) + endif() + endif() + foreach(info ${vs_versions}) + cmake_host_system_information(RESULT found QUERY "${info_${info}}") + if(found) + set(${info} 1) + else() + set(${info} 0) + endif() + endforeach() + endif() endif() #--------------------------------------------------------------------------- @@ -2316,32 +2336,41 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH endforeach() endif() + macro(add_test_VSAndroid name generator platform) + add_test(NAME "VSAndroid.${name}.${platform}" COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VSAndroid" + "${CMake_BINARY_DIR}/Tests/VSAndroid/${name}/${platform}" + --build-generator "${generator}" + --build-project VSAndroid + --build-config $ + --build-options -DCMAKE_SYSTEM_NAME=Android "-A${platform}" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSAndroid/${name}") + endmacro() if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") - macro(add_test_VSNsightTegra name generator) - add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/VSNsightTegra" - "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}" - --build-generator "${generator}" - --build-project VSNsightTegra - --build-config $ - --build-options -DCMAKE_SYSTEM_NAME=Android - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}") - endmacro() if(vs10) - add_test_VSNsightTegra(vs10 "Visual Studio 10 2010") + add_test_VSAndroid(vs10 "Visual Studio 10 2010" "Tegra-Android") endif() if(vs11) - add_test_VSNsightTegra(vs11 "Visual Studio 11 2012") + add_test_VSAndroid(vs11 "Visual Studio 11 2012" "Tegra-Android") endif() if(vs12) - add_test_VSNsightTegra(vs12 "Visual Studio 12 2013") + add_test_VSAndroid(vs12 "Visual Studio 12 2013" "Tegra-Android") endif() if(vs14) - add_test_VSNsightTegra(vs14 "Visual Studio 14 2015") + add_test_VSAndroid(vs14 "Visual Studio 14 2015" "Tegra-Android") endif() endif() + if(vs14 AND CMake_TEST_ANDROID_VS14) + add_test_VSAndroid(vs14 "Visual Studio 14 2015" "ARM") + endif() + if(vs15 AND CMake_TEST_ANDROID_VS15) + add_test_VSAndroid(vs15 "Visual Studio 15 2017" "ARM") + endif() + if(vs16 AND CMake_TEST_ANDROID_VS16) + add_test_VSAndroid(vs16 "Visual Studio 16 2019" "ARM") + endif() if (APPLE) if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 234525a..81dd090 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -33,12 +33,18 @@ function(run_Android case) endforeach() endfunction() +set(RunCMake_GENERATOR_PLATFORM_OLD "${RunCMake_GENERATOR_PLATFORM}") + +if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") +endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSROOT=${CMAKE_CURRENT_SOURCE_DIR} ) run_cmake(BadSYSROOT) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") foreach(ndk IN LISTS TEST_ANDROID_NDK) # Load available toolchain versions and abis. @@ -82,6 +88,9 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) if(_versions MATCHES "clang") set(_versions "clang" ${_versions}) endif() + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(_versions "clang") + endif() list(REMOVE_DUPLICATES _versions) list(SORT _versions) set(_versions ";${_versions}") @@ -89,44 +98,58 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) list(REMOVE_DUPLICATES _abis_${vers}) endforeach() + set(ndk_arg -DCMAKE_ANDROID_NDK=${ndk}) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(ndk_arg) + endif() + # Test failure cases. message(STATUS "ndk='${ndk}'") + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") + endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARCH_ABI=badabi ) run_cmake(ndk-badabi) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "x86") + endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_ARM_MODE=0 ) run_cmake(ndk-badarm) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") + endif() if("armeabi" IN_LIST _abis_) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARM_NEON=0 ) run_cmake(ndk-badneon) endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=badver ) run_cmake(ndk-badver) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=1.0 ) run_cmake(ndk-badvernum) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_STL_TYPE=badstl ) run_cmake(ndk-badstl) @@ -143,6 +166,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) run_cmake(ndk-sysroot-armeabi) unset(RunCMake_TEST_OPTIONS) endif() + set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") # Find available STLs. set(stl_types @@ -169,11 +193,18 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) armeabi-v6 armeabi-v7a arm64-v8a - mips - mips64 x86 x86_64 ) + if(NOT RunCMake_GENERATOR MATCHES "Visual Studio") + list(APPEND abi_names mips mips64) + endif() + set(abi_to_arch_armeabi ARM) + set(abi_to_arch_armeabi-v6 ARM) + set(abi_to_arch_armeabi-v7a ARM) + set(abi_to_arch_arm64-v8a ARM64) + set(abi_to_arch_x86 x86) + set(abi_to_arch_x86_64 x64) # Test all combinations. foreach(vers IN LISTS _versions) @@ -193,7 +224,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) endif() message(STATUS "ndk='${ndk}' vers='${vers}' stl='${stl}'${config_status}") set(RunCMake_TEST_OPTIONS - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=${vers} -DCMAKE_ANDROID_STL_TYPE=${stl} "${build_type_arg}" @@ -205,6 +236,9 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) endif() # Run the tests for this combination. + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "${abi_to_arch_${abi}}") + endif() if("${abi}" STREQUAL "armeabi") run_Android(ndk-armeabi-thumb) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi -DCMAKE_ANDROID_ARM_MODE=0 run_Android(ndk-armeabi-arm -DCMAKE_ANDROID_ARM_MODE=1) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi @@ -214,6 +248,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) run_Android(ndk-${abi}-neon -DCMAKE_ANDROID_ARCH_ABI=${abi} -DCMAKE_ANDROID_ARM_NEON=1) endif() endif() + set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") endforeach() unset(RunCMake_TEST_OPTIONS) endforeach() diff --git a/Tests/RunCMake/Android/ndk-arm64-v8a-stderr.txt b/Tests/RunCMake/Android/ndk-arm64-v8a-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-arm64-v8a-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-armeabi-arm-stderr.txt b/Tests/RunCMake/Android/ndk-armeabi-arm-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-arm-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-armeabi-thumb-stderr.txt b/Tests/RunCMake/Android/ndk-armeabi-thumb-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-thumb-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stderr.txt b/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-armeabi-v7a-stderr.txt b/Tests/RunCMake/Android/ndk-armeabi-v7a-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-v7a-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-x86-stderr.txt b/Tests/RunCMake/Android/ndk-x86-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-x86-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/Android/ndk-x86_64-stderr.txt b/Tests/RunCMake/Android/ndk-x86_64-stderr.txt new file mode 100644 index 0000000..a3b3634 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-x86_64-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning: + You are using Visual Studio tools for Android, which does not support + standalone executables\. However, the following executable targets do not + have the ANDROID_GUI property set, and thus will not be built as expected\. + They will be built as shared libraries with executable filenames: + + android_c, android_cxx, android_sysinc_c, android_sysinc_cxx)?$ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 6c634b5..192895b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -683,8 +683,8 @@ add_RunCMake_test(AutoExportDll add_RunCMake_test(AndroidMK) if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN) - if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja") - message(FATAL_ERROR "Android tests supported only by Makefile and Ninja generators") + if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja|Visual Studio 1[456]") + message(FATAL_ERROR "Android tests supported only by Makefile, Ninja, and Visual Studio >= 14 generators") endif() foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN) if(CMake_${v}) diff --git a/Tests/VSAndroid/AndroidManifest.xml b/Tests/VSAndroid/AndroidManifest.xml new file mode 100644 index 0000000..951e8f3 --- /dev/null +++ b/Tests/VSAndroid/AndroidManifest.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/Tests/VSAndroid/CMakeLists.txt b/Tests/VSAndroid/CMakeLists.txt new file mode 100644 index 0000000..73b1e07 --- /dev/null +++ b/Tests/VSAndroid/CMakeLists.txt @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.3) +project(VSAndroid C CXX) + +set(CMAKE_ANDROID_ARCH armv7-a) +set(CMAKE_ANDROID_STL_TYPE stlport_shared) +set(CMAKE_ANDROID_API_MIN 9) +set(CMAKE_ANDROID_API 15) +set(CMAKE_ANDROID_GUI 1) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + +set(FIRST_C_FILES + jni/first.c + jni/first.h + ) + +source_group(jni FILES ${FIRST_C_FILES}) +add_library(twolib-first ${FIRST_C_FILES}) + +set(SECOND_C_FILES + jni/second.c + ) +set(SECOND_JAVA_FILES + src/com/example/twolibs/TwoLibs.java + ) +set(SECOND_RES_FILES + res/values/strings.xml + ) +set(SECOND_ANDROID_FILES + AndroidManifest.xml + ) + +source_group(jni FILES ${SECOND_C_FILES}) +source_group(res\\values FILES ${SECOND_RES_FILES}) +source_group(src\\com\\example\\twolibs FILES ${SECOND_JAVA_FILES}) +add_executable(twolib-second + ${SECOND_C_FILES} + ${SECOND_JAVA_FILES} + ${SECOND_RES_FILES} + ${SECOND_ANDROID_FILES} + ) +target_include_directories(twolib-second PUBLIC jni) +target_link_libraries(twolib-second twolib-first) +target_link_libraries(twolib-second m) # test linking to library by name + +set_property(TARGET twolib-second PROPERTY C_STANDARD 11) +set_target_properties(twolib-second PROPERTIES ANDROID_SKIP_ANT_STEP 1) +set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD 1) +set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD_CONFIG_PATH proguard-android.txt) +set_target_properties(twolib-second PROPERTIES ANDROID_SECURE_PROPS_PATH /definitely/insecure) + +set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DIRECTORIES $) +set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DEPENDENCIES $) + +set_property(TARGET twolib-second PROPERTY ANDROID_JAR_DIRECTORIES $) diff --git a/Tests/VSAndroid/build.xml b/Tests/VSAndroid/build.xml new file mode 100644 index 0000000..17a2cc0 --- /dev/null +++ b/Tests/VSAndroid/build.xml @@ -0,0 +1,4 @@ + + + + diff --git a/Tests/VSAndroid/jni/first.c b/Tests/VSAndroid/jni/first.c new file mode 100644 index 0000000..b9dee27 --- /dev/null +++ b/Tests/VSAndroid/jni/first.c @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "first.h" + +int first(int x, int y) +{ + return x + y; +} diff --git a/Tests/VSAndroid/jni/first.h b/Tests/VSAndroid/jni/first.h new file mode 100644 index 0000000..9dfd8b8 --- /dev/null +++ b/Tests/VSAndroid/jni/first.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef FIRST_H +#define FIRST_H + +extern int first(int x, int y); + +#endif /* FIRST_H */ diff --git a/Tests/VSAndroid/jni/second.c b/Tests/VSAndroid/jni/second.c new file mode 100644 index 0000000..30bdc17 --- /dev/null +++ b/Tests/VSAndroid/jni/second.c @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include + +#include "first.h" + +jint Java_com_example_twolibs_TwoLibs_add(JNIEnv* env, jobject this, jint x, + jint y) +{ + return first(x, y); +} diff --git a/Tests/VSAndroid/proguard-android.txt b/Tests/VSAndroid/proguard-android.txt new file mode 100644 index 0000000..fe73bae --- /dev/null +++ b/Tests/VSAndroid/proguard-android.txt @@ -0,0 +1,57 @@ +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html + +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose + +# Optimization is turned off by default. Dex does not like code run +# through the ProGuard optimize and preverify steps (and performs some +# of these optimizations on its own). +-dontoptimize +-dontpreverify +# Note that if you want to enable optimization, you cannot just +# include optimization flags in your own project configuration file; +# instead you will need to point to the +# "proguard-android-optimize.txt" file instead of this one from your +# project.properties file. + +-keepattributes *Annotation* +-keep public class com.google.vending.licensing.ILicensingService +-keep public class com.android.vending.licensing.ILicensingService + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; +} + +# keep setters in Views so that animations can still work. +# see http://proguard.sourceforge.net/manual/examples.html#beans +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} + +# We want to keep methods in Activity that could be used in the XML attribute onClick +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +-keepclassmembers class **.R$* { + public static ; +} + +# The support library contains references to newer platform versions. +# Don't warn about those in case this app is linking against an older +# platform version. We know about them, and they are safe. +-dontwarn android.support.** diff --git a/Tests/VSAndroid/res/values/strings.xml b/Tests/VSAndroid/res/values/strings.xml new file mode 100644 index 0000000..858cdb4 --- /dev/null +++ b/Tests/VSAndroid/res/values/strings.xml @@ -0,0 +1,4 @@ + + + TwoLibs + diff --git a/Tests/VSAndroid/src/com/example/twolibs/TwoLibs.java b/Tests/VSAndroid/src/com/example/twolibs/TwoLibs.java new file mode 100644 index 0000000..ef9da01 --- /dev/null +++ b/Tests/VSAndroid/src/com/example/twolibs/TwoLibs.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.twolibs; + +import android.app.Activity; +import android.widget.TextView; +import android.os.Bundle; + +public class TwoLibs extends Activity +{ + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + TextView tv = new TextView(this); + int x = 1000; + int y = 42; + + // here, we dynamically load the library at runtime + // before calling the native method. + // + System.loadLibrary("twolib-second"); + + int z = add(x, y); + + tv.setText( "The sum of " + x + " and " + y + " is " + z ); + setContentView(tv); + } + + public native int add(int x, int y); +} diff --git a/Tests/VSNsightTegra/AndroidManifest.xml b/Tests/VSNsightTegra/AndroidManifest.xml deleted file mode 100644 index 951e8f3..0000000 --- a/Tests/VSNsightTegra/AndroidManifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt deleted file mode 100644 index 6d74f2f..0000000 --- a/Tests/VSNsightTegra/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -project(VSNsightTegra C CXX) - -set(CMAKE_ANDROID_ARCH armv7-a) -set(CMAKE_ANDROID_STL_TYPE stlport_shared) -set(CMAKE_ANDROID_API_MIN 9) -set(CMAKE_ANDROID_API 15) -set(CMAKE_ANDROID_GUI 1) - -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") - -set(FIRST_C_FILES - jni/first.c - jni/first.h - ) - -source_group(jni FILES ${FIRST_C_FILES}) -add_library(twolib-first ${FIRST_C_FILES}) - -set(SECOND_C_FILES - jni/second.c - ) -set(SECOND_JAVA_FILES - src/com/example/twolibs/TwoLibs.java - ) -set(SECOND_RES_FILES - res/values/strings.xml - ) -set(SECOND_ANDROID_FILES - AndroidManifest.xml - ) - -source_group(jni FILES ${SECOND_C_FILES}) -source_group(res\\values FILES ${SECOND_RES_FILES}) -source_group(src\\com\\example\\twolibs FILES ${SECOND_JAVA_FILES}) -add_executable(twolib-second - ${SECOND_C_FILES} - ${SECOND_JAVA_FILES} - ${SECOND_RES_FILES} - ${SECOND_ANDROID_FILES} - ) -target_include_directories(twolib-second PUBLIC jni) -target_link_libraries(twolib-second twolib-first) -target_link_libraries(twolib-second m) # test linking to library by name - -set_property(TARGET twolib-second PROPERTY C_STANDARD 11) -set_target_properties(twolib-second PROPERTIES ANDROID_SKIP_ANT_STEP 1) -set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD 1) -set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD_CONFIG_PATH proguard-android.txt) -set_target_properties(twolib-second PROPERTIES ANDROID_SECURE_PROPS_PATH /definitely/insecure) - -set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DIRECTORIES $) -set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DEPENDENCIES $) - -set_property(TARGET twolib-second PROPERTY ANDROID_JAR_DIRECTORIES $) diff --git a/Tests/VSNsightTegra/build.xml b/Tests/VSNsightTegra/build.xml deleted file mode 100644 index 17a2cc0..0000000 --- a/Tests/VSNsightTegra/build.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/Tests/VSNsightTegra/jni/first.c b/Tests/VSNsightTegra/jni/first.c deleted file mode 100644 index b9dee27..0000000 --- a/Tests/VSNsightTegra/jni/first.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include "first.h" - -int first(int x, int y) -{ - return x + y; -} diff --git a/Tests/VSNsightTegra/jni/first.h b/Tests/VSNsightTegra/jni/first.h deleted file mode 100644 index 9dfd8b8..0000000 --- a/Tests/VSNsightTegra/jni/first.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef FIRST_H -#define FIRST_H - -extern int first(int x, int y); - -#endif /* FIRST_H */ diff --git a/Tests/VSNsightTegra/jni/second.c b/Tests/VSNsightTegra/jni/second.c deleted file mode 100644 index 30bdc17..0000000 --- a/Tests/VSNsightTegra/jni/second.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include - -#include "first.h" - -jint Java_com_example_twolibs_TwoLibs_add(JNIEnv* env, jobject this, jint x, - jint y) -{ - return first(x, y); -} diff --git a/Tests/VSNsightTegra/proguard-android.txt b/Tests/VSNsightTegra/proguard-android.txt deleted file mode 100644 index fe73bae..0000000 --- a/Tests/VSNsightTegra/proguard-android.txt +++ /dev/null @@ -1,57 +0,0 @@ -# This is a configuration file for ProGuard. -# http://proguard.sourceforge.net/index.html#manual/usage.html - --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --verbose - -# Optimization is turned off by default. Dex does not like code run -# through the ProGuard optimize and preverify steps (and performs some -# of these optimizations on its own). --dontoptimize --dontpreverify -# Note that if you want to enable optimization, you cannot just -# include optimization flags in your own project configuration file; -# instead you will need to point to the -# "proguard-android-optimize.txt" file instead of this one from your -# project.properties file. - --keepattributes *Annotation* --keep public class com.google.vending.licensing.ILicensingService --keep public class com.android.vending.licensing.ILicensingService - -# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native --keepclasseswithmembernames class * { - native ; -} - -# keep setters in Views so that animations can still work. -# see http://proguard.sourceforge.net/manual/examples.html#beans --keepclassmembers public class * extends android.view.View { - void set*(***); - *** get*(); -} - -# We want to keep methods in Activity that could be used in the XML attribute onClick --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - -# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} - --keepclassmembers class **.R$* { - public static ; -} - -# The support library contains references to newer platform versions. -# Don't warn about those in case this app is linking against an older -# platform version. We know about them, and they are safe. --dontwarn android.support.** diff --git a/Tests/VSNsightTegra/res/values/strings.xml b/Tests/VSNsightTegra/res/values/strings.xml deleted file mode 100644 index 858cdb4..0000000 --- a/Tests/VSNsightTegra/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - TwoLibs - diff --git a/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java b/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java deleted file mode 100644 index ef9da01..0000000 --- a/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.example.twolibs; - -import android.app.Activity; -import android.widget.TextView; -import android.os.Bundle; - -public class TwoLibs extends Activity -{ - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - - TextView tv = new TextView(this); - int x = 1000; - int y = 42; - - // here, we dynamically load the library at runtime - // before calling the native method. - // - System.loadLibrary("twolib-second"); - - int z = add(x, y); - - tv.setText( "The sum of " + x + " and " + y + " is " + z ); - setContentView(tv); - } - - public native int add(int x, int y); -} -- cgit v0.12 From aae35feea2048e6ffe4d47a068aa5246c89bd606 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 25 Jun 2020 00:02:04 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6cc9b1a..f642fc8 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 18) -set(CMake_VERSION_PATCH 20200624) +set(CMake_VERSION_PATCH 20200625) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From d4812a955b679ca4426192db4276cd4e1c1bd373 Mon Sep 17 00:00:00 2001 From: Asit Dhal Date: Sun, 21 Jun 2020 23:17:34 +0200 Subject: cmake-install: implement default directory permissions provide an argument for default directory permissions in cmake --install Fixes: #20700 --- Help/manual/cmake.1.rst | 3 + .../dev/install-default-directory-permissions.rst | 5 + Source/cmakemain.cxx | 139 +++++++++++++++++++++ Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 26 ++++ .../cmake_install.cmake | 3 + ...install-default-dir-permissions-afew-result.txt | 1 + ...install-default-dir-permissions-afew-stderr.txt | 1 + .../install-default-dir-permissions-all-result.txt | 1 + .../install-default-dir-permissions-all-stderr.txt | 1 + ...missions-assignment-at-the-beginning-result.txt | 1 + ...missions-assignment-at-the-beginning-stderr.txt | 1 + ...ir-permissions-assignment-at-the-end-result.txt | 1 + ...ir-permissions-assignment-at-the-end-stderr.txt | 1 + ...ult-dir-permissions-comma-at-the-end-result.txt | 1 + ...ult-dir-permissions-comma-at-the-end-stderr.txt | 1 + ...t-dir-permissions-invalid-assignment-result.txt | 1 + ...t-dir-permissions-invalid-assignment-stderr.txt | 1 + ...fault-dir-permissions-invalid-comma1-result.txt | 1 + ...fault-dir-permissions-invalid-comma1-stderr.txt | 1 + ...fault-dir-permissions-invalid-comma2-result.txt | 1 + ...fault-dir-permissions-invalid-comma2-stderr.txt | 1 + ...install-default-dir-permissions-none-result.txt | 1 + ...install-default-dir-permissions-none-stderr.txt | 1 + 23 files changed, 194 insertions(+) create mode 100644 Help/release/dev/install-default-directory-permissions.rst create mode 100644 Tests/RunCMake/CommandLine/dir-permissions-install-options-to-vars/cmake_install.cmake create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-all-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-all-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-none-result.txt create mode 100644 Tests/RunCMake/CommandLine/install-default-dir-permissions-none-stderr.txt diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index e4c662e..72ecfc7 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -450,6 +450,9 @@ The options are: ``--component `` Component-based install. Only install component ````. +``--default-directory-permissions `` + Default directory install permissions. Permissions in format ````. + ``--prefix `` Override the installation prefix, :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/release/dev/install-default-directory-permissions.rst b/Help/release/dev/install-default-directory-permissions.rst new file mode 100644 index 0000000..27cffee --- /dev/null +++ b/Help/release/dev/install-default-directory-permissions.rst @@ -0,0 +1,5 @@ +install-default-directory-permissions +------------------------------------- + +* The ``--install`` argument of the :manual:`cmake(1)` command line tool gained a + ``--default-directory-permissions`` argument. diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 75280fb..9fa6705 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -3,11 +3,13 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include #include #include #include #include #include +#include #include #include @@ -517,6 +519,121 @@ int do_build(int ac, char const* const* av) #endif } +bool parse_default_directory_permissions(const std::string& permissions, + std::string& parsedPermissionsVar) +{ + std::vector parsedPermissions; + enum Doing + { + DoingNone, + DoingOwner, + DoingGroup, + DoingWorld, + DoingOwnerAssignment, + DoingGroupAssignment, + DoingWorldAssignment, + }; + Doing doing = DoingNone; + + auto uniquePushBack = [&parsedPermissions](const std::string& e) { + if (std::find(parsedPermissions.begin(), parsedPermissions.end(), e) == + parsedPermissions.end()) { + parsedPermissions.push_back(e); + } + }; + + for (auto const& e : permissions) { + switch (doing) { + case DoingNone: + if (e == 'u') { + doing = DoingOwner; + } else if (e == 'g') { + doing = DoingGroup; + } else if (e == 'o') { + doing = DoingWorld; + } else { + return false; + } + break; + case DoingOwner: + if (e == '=') { + doing = DoingOwnerAssignment; + } else { + return false; + } + break; + case DoingGroup: + if (e == '=') { + doing = DoingGroupAssignment; + } else { + return false; + } + break; + case DoingWorld: + if (e == '=') { + doing = DoingWorldAssignment; + } else { + return false; + } + break; + case DoingOwnerAssignment: + if (e == 'r') { + uniquePushBack("OWNER_READ"); + } else if (e == 'w') { + uniquePushBack("OWNER_WRITE"); + } else if (e == 'x') { + uniquePushBack("OWNER_EXECUTE"); + } else if (e == ',') { + doing = DoingNone; + } else { + return false; + } + break; + case DoingGroupAssignment: + if (e == 'r') { + uniquePushBack("GROUP_READ"); + } else if (e == 'w') { + uniquePushBack("GROUP_WRITE"); + } else if (e == 'x') { + uniquePushBack("GROUP_EXECUTE"); + } else if (e == ',') { + doing = DoingNone; + } else { + return false; + } + break; + case DoingWorldAssignment: + if (e == 'r') { + uniquePushBack("WORLD_READ"); + } else if (e == 'w') { + uniquePushBack("WORLD_WRITE"); + } else if (e == 'x') { + uniquePushBack("WORLD_EXECUTE"); + } else if (e == ',') { + doing = DoingNone; + } else { + return false; + } + break; + } + } + if (doing != DoingOwnerAssignment && doing != DoingGroupAssignment && + doing != DoingWorldAssignment) { + return false; + } + + std::ostringstream oss; + for (auto i = 0u; i < parsedPermissions.size(); i++) { + if (i != 0) { + oss << ";"; + } + oss << parsedPermissions[i]; + } + + parsedPermissionsVar = oss.str(); + return true; +} + int do_install(int ac, char const* const* av) { #ifdef CMAKE_BOOTSTRAP @@ -527,6 +644,7 @@ int do_install(int ac, char const* const* av) std::string config; std::string component; + std::string defaultDirectoryPermissions; std::string prefix; std::string dir; bool strip = false; @@ -539,6 +657,7 @@ int do_install(int ac, char const* const* av) DoingConfig, DoingComponent, DoingPrefix, + DoingDefaultDirectoryPermissions, }; Doing doing = DoingDir; @@ -557,6 +676,8 @@ int do_install(int ac, char const* const* av) (strcmp(av[i], "-v") == 0)) { verbose = true; doing = DoingNone; + } else if (strcmp(av[i], "--default-directory-permissions") == 0) { + doing = DoingDefaultDirectoryPermissions; } else { switch (doing) { case DoingDir: @@ -575,6 +696,10 @@ int do_install(int ac, char const* const* av) prefix = av[i]; doing = DoingNone; break; + case DoingDefaultDirectoryPermissions: + defaultDirectoryPermissions = av[i]; + doing = DoingNone; + break; default: std::cerr << "Unknown argument " << av[i] << std::endl; dir.clear(); @@ -591,6 +716,8 @@ int do_install(int ac, char const* const* av) " = Project binary directory to install.\n" " --config = For multi-configuration tools, choose .\n" " --component = Component-based install. Only install .\n" + " --default-directory-permissions \n" + " Default install permission. Use default permission .\n" " --prefix = The installation prefix CMAKE_INSTALL_PREFIX.\n" " --strip = Performing install/strip.\n" " -v --verbose = Enable verbose output.\n" @@ -631,6 +758,18 @@ int do_install(int ac, char const* const* av) args.emplace_back("-DCMAKE_INSTALL_CONFIG_NAME=" + config); } + if (!defaultDirectoryPermissions.empty()) { + std::string parsedPermissionsVar; + if (!parse_default_directory_permissions(defaultDirectoryPermissions, + parsedPermissionsVar)) { + std::cerr << "--default-directory-permissions is in incorrect format" + << std::endl; + return 1; + } + args.emplace_back("-DCMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS=" + + parsedPermissionsVar); + } + args.emplace_back("-P"); args.emplace_back(dir + "/cmake_install.cmake"); diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f291f15..6d69945 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -67,6 +67,32 @@ run_cmake_command(install-bad-dir run_cmake_command(install-options-to-vars ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-install-options-to-vars --strip --prefix /var/test --config sample --component pack) +run_cmake_command(install-default-dir-permissions-all + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,g=rx,o=rx) +run_cmake_command(install-default-dir-permissions-afew + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,g=rx) +run_cmake_command(install-default-dir-permissions-none + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars) +run_cmake_command(install-default-dir-permissions-invalid-comma1 + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwxg=,x) +run_cmake_command(install-default-dir-permissions-invalid-comma2 + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwxg,=x) +run_cmake_command(install-default-dir-permissions-comma-at-the-end + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,) +run_cmake_command(install-default-dir-permissions-invalid-assignment + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,=x) +run_cmake_command(install-default-dir-permissions-assignment-at-the-end + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions u=rwx,g=) +run_cmake_command(install-default-dir-permissions-assignment-at-the-beginning + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars + --default-directory-permissions =u=rwx,g=rx) run_cmake_command(cache-bad-entry ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-entry/) diff --git a/Tests/RunCMake/CommandLine/dir-permissions-install-options-to-vars/cmake_install.cmake b/Tests/RunCMake/CommandLine/dir-permissions-install-options-to-vars/cmake_install.cmake new file mode 100644 index 0000000..42ef745 --- /dev/null +++ b/Tests/RunCMake/CommandLine/dir-permissions-install-options-to-vars/cmake_install.cmake @@ -0,0 +1,3 @@ +if(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS) + message("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is ${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}") +endif() diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-stderr.txt new file mode 100644 index 0000000..42f4b3f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-afew-stderr.txt @@ -0,0 +1 @@ +CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is OWNER_READ;OWNER_WRITE;OWNER_EXECUTE;GROUP_READ;GROUP_EXECUTE diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-stderr.txt new file mode 100644 index 0000000..813d9c3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-all-stderr.txt @@ -0,0 +1 @@ +CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is OWNER_READ;OWNER_WRITE;OWNER_EXECUTE;GROUP_READ;GROUP_EXECUTE;WORLD_READ;WORLD_EXECUTE diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-beginning-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-stderr.txt new file mode 100644 index 0000000..6680932 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-assignment-at-the-end-stderr.txt @@ -0,0 +1 @@ +CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is OWNER_READ;OWNER_WRITE;OWNER_EXECUTE diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-comma-at-the-end-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-assignment-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma1-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-stderr.txt new file mode 100644 index 0000000..1b80952 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-invalid-comma2-stderr.txt @@ -0,0 +1 @@ +--default-directory-permissions is in incorrect format diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-result.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-stderr.txt b/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-default-dir-permissions-none-stderr.txt @@ -0,0 +1 @@ +^$ -- cgit v0.12 From 035a3940f5c5ac4206b9b841be5d974e0b038c2f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 26 Jun 2020 05:51:02 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f642fc8..a7eb045 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 18) -set(CMake_VERSION_PATCH 20200625) +set(CMake_VERSION_PATCH 20200626) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 7d6861f367673b57bf45e14863f1104e8e28eafa Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 18 Jun 2020 15:43:08 -0700 Subject: fileapi: Extend codemodel targets with language standard --- Help/manual/cmake-file-api.7.rst | 18 ++++ Source/cmFileAPI.cxx | 2 +- Source/cmFileAPICodemodel.cxx | 36 +++++++ .../RunCMake/CommandLine/E_capabilities-stdout.txt | 2 +- Tests/RunCMake/FileAPI/codemodel-v2-check.py | 33 ++++++- .../FileAPI/codemodel-v2-data/directories/cxx.json | 2 + .../FileAPI/codemodel-v2-data/projects/cxx.json | 2 + .../codemodel-v2-data/targets/all_build_cxx.json | 8 ++ .../codemodel-v2-data/targets/all_build_top.json | 8 ++ .../targets/cxx_standard_compile_feature_exe.json | 110 +++++++++++++++++++++ ...ndard_compile_feature_exe_languagestandard.json | 22 +++++ .../targets/cxx_standard_exe.json | 110 +++++++++++++++++++++ Tests/RunCMake/FileAPI/cxx/CMakeLists.txt | 10 ++ 13 files changed, 360 insertions(+), 3 deletions(-) create mode 100644 Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json create mode 100644 Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json create mode 100644 Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json diff --git a/Help/manual/cmake-file-api.7.rst b/Help/manual/cmake-file-api.7.rst index 91be31d..b54859c 100644 --- a/Help/manual/cmake-file-api.7.rst +++ b/Help/manual/cmake-file-api.7.rst @@ -869,6 +869,24 @@ with members: A string specifying the language (e.g. ``C``, ``CXX``, ``Fortran``) of the toolchain is used to compile the source file. + ``languageStandard`` + Optional member that is present when the language standard is set + explicitly (e.g. via :prop_tgt:`CXX_STANDARD`) or implicitly by + compile features. Each entry is a JSON object with two members: + + ``backtraces`` + Optional member that is present when a CMake language backtrace to + the ``_STANDARD`` setting is available. If the language + standard was set implicitly by compile features those are used as + the backtrace(s). It's possible for multiple compile features to + require the same language standard so there could be multiple + backtraces. The value is a JSON array with each entry being an + unsigned integer 0-based index into the ``backtraceGraph`` + member's ``nodes`` array. + + ``standard`` + String representing the language standard. + ``compileCommandFragments`` Optional member that is present when fragments of the compiler command line invocation are available. The value is a JSON array of entries diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx index 594969b..c2ab2f1 100644 --- a/Source/cmFileAPI.cxx +++ b/Source/cmFileAPI.cxx @@ -665,7 +665,7 @@ std::string cmFileAPI::NoSupportedVersion( // The "codemodel" object kind. -static unsigned int const CodeModelV2Minor = 1; +static unsigned int const CodeModelV2Minor = 2; void cmFileAPI::BuildClientRequestCodeModel( ClientRequest& r, std::vector const& versions) diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index fe331ec..21d9abb 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -277,6 +277,7 @@ struct CompileData std::string Language; std::string Sysroot; + JBT LanguageStandard; std::vector> Flags; std::vector> Defines; std::vector> PrecompileHeaders; @@ -287,6 +288,7 @@ struct CompileData return (l.Language == r.Language && l.Sysroot == r.Sysroot && l.Flags == r.Flags && l.Defines == r.Defines && l.PrecompileHeaders == r.PrecompileHeaders && + l.LanguageStandard == r.LanguageStandard && l.Includes == r.Includes); } }; @@ -320,6 +322,10 @@ struct hash result = result ^ hash()(i.Value) ^ hash()(i.Backtrace.Index); } + if (!in.LanguageStandard.Value.empty()) { + result = result ^ hash()(in.LanguageStandard.Value) ^ + hash()(in.LanguageStandard.Backtrace.Index); + } return result; } }; @@ -377,6 +383,7 @@ class Target Json::Value DumpCompileData(CompileData const& cd); Json::Value DumpInclude(CompileData::IncludeEntry const& inc); Json::Value DumpPrecompileHeader(JBT const& header); + Json::Value DumpLanguageStandard(JBT const& standard); Json::Value DumpDefine(JBT const& def); Json::Value DumpSources(); Json::Value DumpSource(cmGeneratorTarget::SourceAndKind const& sk, @@ -838,6 +845,11 @@ void Target::ProcessLanguage(std::string const& lang) for (BT const& pch : precompileHeaders) { cd.PrecompileHeaders.emplace_back(this->ToJBT(pch)); } + BT const* languageStandard = + this->GT->GetLanguageStandardProperty(lang, this->Config); + if (languageStandard) { + cd.LanguageStandard = this->ToJBT(*languageStandard); + } } Json::ArrayIndex Target::AddSourceGroup(cmSourceGroup* sg, Json::ArrayIndex si) @@ -996,6 +1008,9 @@ CompileData Target::MergeCompileData(CompileData const& fd) // All compile groups share the precompile headers of the target. cd.PrecompileHeaders = td.PrecompileHeaders; + // All compile groups share the language standard of the target. + cd.LanguageStandard = td.LanguageStandard; + // Use target-wide flags followed by source-specific flags. cd.Flags.reserve(td.Flags.size() + fd.Flags.size()); cd.Flags.insert(cd.Flags.end(), td.Flags.begin(), td.Flags.end()); @@ -1153,6 +1168,10 @@ Json::Value Target::DumpCompileData(CompileData const& cd) } result["precompileHeaders"] = std::move(precompileHeaders); } + if (!cd.LanguageStandard.Value.empty()) { + result["languageStandard"] = + this->DumpLanguageStandard(cd.LanguageStandard); + } return result; } @@ -1176,6 +1195,23 @@ Json::Value Target::DumpPrecompileHeader(JBT const& header) return precompileHeader; } +Json::Value Target::DumpLanguageStandard(JBT const& standard) +{ + Json::Value languageStandard = Json::objectValue; + languageStandard["standard"] = standard.Value; + if (standard.Backtrace) { + // Only one backtrace is currently stored for a given language standard, + // but we represent this as an array because it's possible for multiple + // compile features to set the same language standard value. Representing + // this as an array will allow things to just work once we support storing + // multiple backtraces for a language standard value. + Json::Value backtraces = Json::arrayValue; + backtraces.append(standard.Backtrace.Index); + languageStandard["backtraces"] = backtraces; + } + return languageStandard; +} + Json::Value Target::DumpDefine(JBT const& def) { Json::Value define = Json::objectValue; diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index 03286f1..e24e131 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":1}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":true,"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":2}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":true,"version":{.*}}$ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index a3dd9ff..b567bf1 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -12,7 +12,7 @@ def read_codemodel_json_data(filename): def check_objects(o, g): assert is_list(o) assert len(o) == 1 - check_index_object(o[0], "codemodel", 2, 1, check_object_codemodel(g)) + check_index_object(o[0], "codemodel", 2, 2, check_object_codemodel(g)) def check_backtrace(t, b, backtrace): btg = t["backtraceGraph"] @@ -42,6 +42,16 @@ def check_backtrace(t, b, backtrace): assert b is None +def check_backtraces(t, actual, expected): + assert is_list(actual) + assert is_list(expected) + assert len(actual) == len(expected) + + i = 0 + while i < len(actual): + check_backtrace(t, actual[i], expected[i]) + i += 1 + def check_directory(c): def _check(actual, expected): assert is_dict(actual) @@ -421,6 +431,19 @@ def check_target(c): missing_exception=lambda e: "Precompile header: %s" % e["header"], extra_exception=lambda a: "Precompile header: %s" % a["header"]) + if "languageStandard" in expected: + expected_keys.append("languageStandard") + + def check_language_standard(actual, expected): + assert is_dict(actual) + expected_keys = ["backtraces", "standard"] + assert actual["standard"] == expected["standard"] + check_backtraces(obj, actual["backtraces"], expected["backtraces"]) + + assert sorted(actual.keys()) == sorted(expected_keys) + + check_language_standard(actual["languageStandard"], expected["languageStandard"]) + if expected["defines"] is not None: expected_keys.append("defines") @@ -544,6 +567,8 @@ def gen_check_targets(c, g, inSource): read_codemodel_json_data("targets/zero_check_cxx.json"), read_codemodel_json_data("targets/cxx_lib.json"), read_codemodel_json_data("targets/cxx_exe.json"), + read_codemodel_json_data("targets/cxx_standard_compile_feature_exe.json"), + read_codemodel_json_data("targets/cxx_standard_exe.json"), read_codemodel_json_data("targets/cxx_shared_lib.json"), read_codemodel_json_data("targets/cxx_shared_exe.json"), read_codemodel_json_data("targets/cxx_static_lib.json"), @@ -592,6 +617,12 @@ def gen_check_targets(c, g, inSource): e["sources"] = precompile_header_data["sources"] e["sourceGroups"] = precompile_header_data["sourceGroups"] + if os.path.exists(os.path.join(reply_dir, "..", "..", "..", "..", "cxx", "cxx_std_11.txt")): + for e in expected: + if e["name"] == "cxx_standard_compile_feature_exe": + language_standard_data = read_codemodel_json_data("targets/cxx_standard_compile_feature_exe_languagestandard.json") + e["compileGroups"][0]["languageStandard"] = language_standard_data["languageStandard"] + if not os.path.exists(os.path.join(reply_dir, "..", "..", "..", "..", "ipo_enabled.txt")): for e in expected: try: diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json index ebe717a..a51b6eb 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json @@ -7,6 +7,8 @@ "^ALL_BUILD::@a56b12a3f5c0529fb296$", "^ZERO_CHECK::@a56b12a3f5c0529fb296$", "^cxx_exe::@a56b12a3f5c0529fb296$", + "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "^cxx_standard_exe::@a56b12a3f5c0529fb296$", "^cxx_lib::@a56b12a3f5c0529fb296$", "^cxx_shared_exe::@a56b12a3f5c0529fb296$", "^cxx_shared_lib::@a56b12a3f5c0529fb296$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json index 296ae6c..363e853 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json @@ -10,6 +10,8 @@ "^ZERO_CHECK::@a56b12a3f5c0529fb296$", "^cxx_lib::@a56b12a3f5c0529fb296$", "^cxx_exe::@a56b12a3f5c0529fb296$", + "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "^cxx_standard_exe::@a56b12a3f5c0529fb296$", "^cxx_shared_lib::@a56b12a3f5c0529fb296$", "^cxx_shared_exe::@a56b12a3f5c0529fb296$", "^cxx_static_lib::@a56b12a3f5c0529fb296$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json index 92a7944..1f443b1 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json @@ -80,6 +80,14 @@ "backtrace": null }, { + "id": "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_standard_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", "backtrace": null }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json index b4def78..59bd750 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json @@ -116,6 +116,14 @@ "backtrace": null }, { + "id": "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_standard_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", "backtrace": null }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json new file mode 100644 index 0000000..d6d573f --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json @@ -0,0 +1,110 @@ +{ + "name": "cxx_standard_compile_feature_exe", + "id": "^cxx_standard_compile_feature_exe::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 26, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "languageStandard" : + { + "backtraces": [ + [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 27, + "command": "set_property", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + ], + "standard" : "98" + }, + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 26, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^cxx_standard_compile_feature_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_standard_compile_feature_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_standard_compile_feature_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json new file mode 100644 index 0000000..57b4161 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe_languagestandard.json @@ -0,0 +1,22 @@ +{ + "languageStandard" : + { + "backtraces": [ + [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 29, + "command": "target_compile_features", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + ], + "standard" : "11" + } +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json new file mode 100644 index 0000000..9cb2832 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json @@ -0,0 +1,110 @@ +{ + "name": "cxx_standard_exe", + "id": "^cxx_standard_exe::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 23, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "languageStandard" : + { + "backtraces": [ + [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 24, + "command": "set_property", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + ], + "standard" : "17" + }, + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 23, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^cxx_standard_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_standard_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_standard_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt index fa51195..5758cc4 100644 --- a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt @@ -19,3 +19,13 @@ target_link_options(cxx_exe PUBLIC TargetLinkOptions) target_link_directories(cxx_exe PUBLIC "${CMAKE_BINARY_DIR}/TargetLinkDir") target_precompile_headers(cxx_exe PUBLIC ../empty.h) + +add_executable(cxx_standard_exe ../empty.cxx) +set_property(TARGET cxx_standard_exe PROPERTY CXX_STANDARD 17) + +add_executable(cxx_standard_compile_feature_exe ../empty.cxx) +set_property(TARGET cxx_standard_compile_feature_exe PROPERTY CXX_STANDARD 98) +if(CMAKE_CXX_STANDARD_DEFAULT AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION) + target_compile_features(cxx_standard_compile_feature_exe PRIVATE cxx_std_11) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_std_11.txt" "") +endif() -- cgit v0.12 From 467509d7674d62deb9aaca6c9d68628eb108f146 Mon Sep 17 00:00:00 2001 From: Ryan Kawicki Date: Thu, 25 Jun 2020 22:14:55 -0500 Subject: FindVulkan: Support for finding glslc The GLSL SPIR-V compiler is part of the Vulkan SDK and may be used by projects for compiling shaders as part of the build process. This is not strictly required to build a Vulkan application, which is why the variable is not part of the REQUIRED_VARs for the module. --- Help/release/dev/FindVulkan-glslc.rst | 10 ++++++++++ Modules/FindVulkan.cmake | 30 ++++++++++++++++++++++++++---- Tests/FindVulkan/Test/CMakeLists.txt | 9 +++++++++ Tests/FindVulkan/Test/Run-glslc.cmake | 20 ++++++++++++++++++++ Tests/FindVulkan/Test/main.c | 4 ++-- 5 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/FindVulkan-glslc.rst create mode 100644 Tests/FindVulkan/Test/Run-glslc.cmake diff --git a/Help/release/dev/FindVulkan-glslc.rst b/Help/release/dev/FindVulkan-glslc.rst new file mode 100644 index 0000000..246bc8f --- /dev/null +++ b/Help/release/dev/FindVulkan-glslc.rst @@ -0,0 +1,10 @@ +FindVulkan-glslc +---------------- + +* The :module:`FindVulkan` module gained a new output variable + ``Vulkan_GLSLC_EXECUTABLE`` which contains the path to the + GLSL SPIR-V compiler. + +* The :module:`FindVulkan` module gained a new target + ``Vulkan::glslc`` which contains the path to the + GLSL SPIR-V compiler. diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index 4b999b6..89510b7 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -14,6 +14,9 @@ IMPORTED Targets This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if Vulkan has been found. +This module defines :prop_tgt:`IMPORTED` target ``Vulkan::glslc``, if +Vulkan and the GLSLC SPIR-V compiler has been found. + Result Variables ^^^^^^^^^^^^^^^^ @@ -23,10 +26,11 @@ This module defines the following variables:: Vulkan_INCLUDE_DIRS - include directories for Vulkan Vulkan_LIBRARIES - link against this library to use Vulkan -The module will also define two cache variables:: +The module will also define three cache variables:: - Vulkan_INCLUDE_DIR - the Vulkan include directory - Vulkan_LIBRARY - the path to the Vulkan library + Vulkan_INCLUDE_DIR - the Vulkan include directory + Vulkan_LIBRARY - the path to the Vulkan library + Vulkan_GLSLC_EXECUTABLE - the path to the GLSL SPIR-V compiler Hints ^^^^^ @@ -53,6 +57,11 @@ if(WIN32) "$ENV{VULKAN_SDK}/Lib" "$ENV{VULKAN_SDK}/Bin" ) + find_program(Vulkan_GLSLC_EXECUTABLE + NAMES glslc + HINTS + "$ENV{VULKAN_SDK}/Bin" + ) elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) find_library(Vulkan_LIBRARY NAMES vulkan-1 @@ -60,6 +69,11 @@ if(WIN32) "$ENV{VULKAN_SDK}/Lib32" "$ENV{VULKAN_SDK}/Bin32" ) + find_program(Vulkan_GLSLC_EXECUTABLE + NAMES glslc + HINTS + "$ENV{VULKAN_SDK}/Bin32" + ) endif() else() find_path(Vulkan_INCLUDE_DIR @@ -68,6 +82,9 @@ else() find_library(Vulkan_LIBRARY NAMES vulkan HINTS "$ENV{VULKAN_SDK}/lib") + find_program(Vulkan_GLSLC_EXECUTABLE + NAMES glslc + HINTS "$ENV{VULKAN_SDK}/bin") endif() set(Vulkan_LIBRARIES ${Vulkan_LIBRARY}) @@ -78,7 +95,7 @@ find_package_handle_standard_args(Vulkan DEFAULT_MSG Vulkan_LIBRARY Vulkan_INCLUDE_DIR) -mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY) +mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY Vulkan_GLSLC_EXECUTABLE) if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan) add_library(Vulkan::Vulkan UNKNOWN IMPORTED) @@ -86,3 +103,8 @@ if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan) IMPORTED_LOCATION "${Vulkan_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}") endif() + +if(Vulkan_FOUND AND Vulkan_GLSLC_EXECUTABLE AND NOT TARGET Vulkan::glslc) + add_executable(Vulkan::glslc IMPORTED) + set_property(TARGET Vulkan::glslc PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLC_EXECUTABLE}") +endif() diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt index 0b13d53..9d36a0d 100644 --- a/Tests/FindVulkan/Test/CMakeLists.txt +++ b/Tests/FindVulkan/Test/CMakeLists.txt @@ -13,3 +13,12 @@ add_executable(test_var main.c) target_include_directories(test_var PRIVATE ${Vulkan_INCLUDE_DIRS}) target_link_libraries(test_var PRIVATE ${Vulkan_LIBRARIES}) add_test(NAME test_var COMMAND test_var) + +if(Vulkan_GLSLC_EXECUTABLE) + add_test(NAME test_glslc + COMMAND ${CMAKE_COMMAND} + "-DVULKAN_GLSLC_EXECUTABLE=${Vulkan_GLSLC_EXECUTABLE}" + "-DVULKAN_GLSLC_EXECUTABLE_TARGET=$" + -P "${CMAKE_CURRENT_LIST_DIR}/Run-glslc.cmake" + ) +endif() diff --git a/Tests/FindVulkan/Test/Run-glslc.cmake b/Tests/FindVulkan/Test/Run-glslc.cmake new file mode 100644 index 0000000..086eb9d --- /dev/null +++ b/Tests/FindVulkan/Test/Run-glslc.cmake @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.12) + +function(run_glslc exe exe_display) + execute_process(COMMAND ${exe} --help + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(SEND_ERROR "Result of ${exe_display} --help is ${result}, should be 0") + endif() + + if(NOT output MATCHES "^glslc - Compile shaders into SPIR-V") + message(SEND_ERROR "Output of ${exe_display} --help is \"${output}\", should begin with \"glslc - Compile shaders into SPIR-V\"") + endif() +endfunction() + +run_glslc("${VULKAN_GLSLC_EXECUTABLE}" "\${VULKAN_GLSLC_EXECUTABLE}") +run_glslc("${VULKAN_GLSLC_EXECUTABLE_TARGET}" "Vulkan::glslc") diff --git a/Tests/FindVulkan/Test/main.c b/Tests/FindVulkan/Test/main.c index b29c9ec..1bff651 100644 --- a/Tests/FindVulkan/Test/main.c +++ b/Tests/FindVulkan/Test/main.c @@ -2,10 +2,10 @@ int main() { - VkInstanceCreateInfo instanceCreateInfo = {}; + VkInstanceCreateInfo instanceCreateInfo = { 0 }; instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; - VkApplicationInfo applicationInfo = {}; + VkApplicationInfo applicationInfo = { 0 }; applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; applicationInfo.apiVersion = VK_API_VERSION_1_0; applicationInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0); -- cgit v0.12 From 4041b4da062fcb9e73fb46c1f3e4b64dc5fc4be1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 27 Jun 2020 00:02:10 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a7eb045..496cbb3 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 18) -set(CMake_VERSION_PATCH 20200626) +set(CMake_VERSION_PATCH 20200627) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 45542049563f0ee8358ead563a4e4cc7d7270110 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 28 Jun 2020 00:02:36 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 496cbb3..eec5e97 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 18) -set(CMake_VERSION_PATCH 20200627) +set(CMake_VERSION_PATCH 20200628) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From df4d8838abddfa65224357105aa07be8da0ad090 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 29 Jun 2020 00:02:06 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eec5e97..e4bd907 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 18) -set(CMake_VERSION_PATCH 20200628) +set(CMake_VERSION_PATCH 20200629) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From a468cc431cf910a95d839594a2916a25165023e1 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" Date: Tue, 23 Jun 2020 11:50:54 +0200 Subject: FindTIFF: add component CXX to include the C++ wrapper libtiffxx Fixes: #20860 --- Help/release/dev/FindTIFF-tiffxx.rst | 5 ++ Modules/FindTIFF.cmake | 99 +++++++++++++++++++++++++++++++++--- Tests/FindTIFF/Test/CMakeLists.txt | 13 ++++- Tests/FindTIFF/Test/main.cxx | 16 ++++++ 4 files changed, 125 insertions(+), 8 deletions(-) create mode 100644 Help/release/dev/FindTIFF-tiffxx.rst create mode 100644 Tests/FindTIFF/Test/main.cxx diff --git a/Help/release/dev/FindTIFF-tiffxx.rst b/Help/release/dev/FindTIFF-tiffxx.rst new file mode 100644 index 0000000..656d38f --- /dev/null +++ b/Help/release/dev/FindTIFF-tiffxx.rst @@ -0,0 +1,5 @@ +FindTIFF-tiffxx +--------------- + +* The :module:`FindTIFF` module gained a ``CXX`` component to + find the ``tiffxx`` library containing C++ bindings. diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index 00a3a41..3b74c94 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -5,7 +5,14 @@ FindTIFF -------- -Find the TIFF library (``libtiff``). +Find the TIFF library (``libtiff``, https://libtiff.gitlab.io/libtiff/). + +Optional COMPONENTS +^^^^^^^^^^^^^^^^^^^ + +This module supports the optional component `CXX`, for use with the COMPONENTS +argument of the :command:`find_package` command. This component has an associated +imported target, as described below. Imported targets ^^^^^^^^^^^^^^^^ @@ -15,6 +22,11 @@ This module defines the following :prop_tgt:`IMPORTED` targets: ``TIFF::TIFF`` The TIFF library, if found. +``TIFF::CXX`` + The C++ wrapper libtiffxx, if requested by the `COMPONENTS CXX` option, + if the compiler is not MSVC (which includes the C++ wrapper in libtiff), + and if found. + Result variables ^^^^^^^^^^^^^^^^ @@ -36,10 +48,19 @@ The following cache variables may also be set: ``TIFF_INCLUDE_DIR`` the directory containing the TIFF headers -``TIFF_LIBRARY`` - the path to the TIFF library +``TIFF_LIBRARY_RELEASE`` + the path to the TIFF library for release configurations +``TIFF_LIBRARY_DEBUG`` + the path to the TIFF library for debug configurations +``TIFFXX_LIBRARY_RELEASE`` + the path to the TIFFXX library for release configurations +``TIFFXX_LIBRARY_DEBUG`` + the path to the TIFFXX library for debug configurations #]=======================================================================] +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) + find_path(TIFF_INCLUDE_DIR tiff.h) set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) @@ -54,8 +75,6 @@ if(NOT TIFF_LIBRARY) select_library_configurations(TIFF) mark_as_advanced(TIFF_LIBRARY_RELEASE TIFF_LIBRARY_DEBUG) endif() -unset(TIFF_NAMES) -unset(TIFF_NAMES_DEBUG) if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str @@ -66,13 +85,46 @@ if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") unset(tiff_version_str) endif() +foreach(_comp IN LISTS TIFF_FIND_COMPONENTS) + if(_comp STREQUAL "CXX") + if(MSVC) + # C++ bindings are built into the main tiff library. + set(TIFF_CXX_FOUND 1) + else() + foreach(name ${TIFF_NAMES}) + list(APPEND TIFFXX_NAMES "${name}xx") + list(APPEND TIFFXX_NAMES_DEBUG "${name}xxd") + endforeach() + find_library(TIFFXX_LIBRARY_RELEASE NAMES ${TIFFXX_NAMES}) + find_library(TIFFXX_LIBRARY_DEBUG NAMES ${TIFFXX_NAMES_DEBUG}) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(TIFFXX) + mark_as_advanced(TIFFXX_LIBRARY_RELEASE TIFFXX_LIBRARY_DEBUG) + unset(TIFFXX_NAMES) + unset(TIFFXX_NAMES_DEBUG) + if(TIFFXX_LIBRARY) + set(TIFF_CXX_FOUND 1) + endif() + endif() + endif() +endforeach() +unset(_comp) + +unset(TIFF_NAMES) +unset(TIFF_NAMES_DEBUG) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF + HANDLE_COMPONENTS REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR VERSION_VAR TIFF_VERSION_STRING) if(TIFF_FOUND) set(TIFF_LIBRARIES ${TIFF_LIBRARY}) + if("CXX" IN_LIST TIFF_FIND_COMPONENTS AND NOT MSVC) + list(APPEND TIFF_LIBRARIES ${TIFFXX_LIBRARY}) + endif() + set(TIFF_INCLUDE_DIRS "${TIFF_INCLUDE_DIR}") if(NOT TARGET TIFF::TIFF) @@ -101,6 +153,41 @@ if(TIFF_FOUND) IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}") endif() endif() + + if(NOT TARGET TIFF::CXX) + if(MSVC) + add_library(TIFF::CXX INTERFACE IMPORTED) + set_property(TARGET TIFF::CXX PROPERTY INTERFACE_LINK_LIBRARIES TIFF::TIFF) + else() + add_library(TIFF::CXX UNKNOWN IMPORTED) + set_property(TARGET TIFF::CXX PROPERTY INTERFACE_LINK_LIBRARIES TIFF::TIFF) + if(TIFF_INCLUDE_DIRS) + set_target_properties(TIFF::CXX PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIRS}") + endif() + if(EXISTS "${TIFFXX_LIBRARY}") + set_target_properties(TIFF::CXX PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${TIFFXX_LIBRARY}") + endif() + if(EXISTS "${TIFFXX_LIBRARY_RELEASE}") + set_property(TARGET TIFF::CXX APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(TIFF::CXX PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${TIFFXX_LIBRARY_RELEASE}") + endif() + if(EXISTS "${TIFFXX_LIBRARY_DEBUG}") + set_property(TARGET TIFF::CXX APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(TIFF::CXX PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${TIFFXX_LIBRARY_DEBUG}") + endif() + endif() + endif() + endif() -mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY) +mark_as_advanced(TIFF_INCLUDE_DIR) +cmake_policy(POP) diff --git a/Tests/FindTIFF/Test/CMakeLists.txt b/Tests/FindTIFF/Test/CMakeLists.txt index 85453ed..e235db3 100644 --- a/Tests/FindTIFF/Test/CMakeLists.txt +++ b/Tests/FindTIFF/Test/CMakeLists.txt @@ -1,14 +1,23 @@ cmake_minimum_required(VERSION 3.1) -project(TestFindTIFF C) +project(TestFindTIFF) include(CTest) -find_package(TIFF REQUIRED) +find_package(TIFF REQUIRED COMPONENTS CXX) add_executable(test_tiff_tgt main.c) target_link_libraries(test_tiff_tgt TIFF::TIFF) add_test(NAME test_tiff_tgt COMMAND test_tiff_tgt) +add_executable(test_tiffxx_tgt main.cxx) +target_link_libraries(test_tiffxx_tgt TIFF::CXX) +add_test(NAME test_tiffxx_tgt COMMAND test_tiffxx_tgt) + add_executable(test_tiff_var main.c) target_include_directories(test_tiff_var PRIVATE ${TIFF_INCLUDE_DIRS}) target_link_libraries(test_tiff_var PRIVATE ${TIFF_LIBRARIES}) add_test(NAME test_tiff_var COMMAND test_tiff_var) + +add_executable(test_tiffxx_var main.cxx) +target_include_directories(test_tiffxx_var PRIVATE ${TIFF_INCLUDE_DIRS}) +target_link_libraries(test_tiffxx_var PRIVATE ${TIFF_LIBRARIES}) +add_test(NAME test_tiffxx_var COMMAND test_tiffxx_var) diff --git a/Tests/FindTIFF/Test/main.cxx b/Tests/FindTIFF/Test/main.cxx new file mode 100644 index 0000000..f80a31f --- /dev/null +++ b/Tests/FindTIFF/Test/main.cxx @@ -0,0 +1,16 @@ +#include + +#include +#include + +int main() +{ + /* Without any TIFF file to open, test that the call fails as + expected. This tests that linking worked. */ + TIFF* tiff = TIFFOpen("invalid.tiff", "r"); + assert(!tiff); + + std::ifstream s; + TIFF* tiffxx = TIFFStreamOpen("invalid.tiff", &s); + return 0; +} -- cgit v0.12 From df6b077625f86e4ec0d534f6cd88f8610c5b8f8a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 29 Jun 2020 16:45:43 -0400 Subject: cmake: Remove broken '--warn-unused-vars' option This option has been broken since commit b9f9915516 (cmMakefile: Remove VarUsageStack., 2015-05-17, v3.3.0-rc1~52^2). That commit removed the check that an initialized variable has actually been used and caused the option to warn on every variable ever set. This was not caught by the test suite because the test for the feature only checked that warnings appear when needed and not that they do not appear when not needed. The option was never very practical to use. Remove it to avoid the runtime cost of usage tracking and checks for every variable (which we were doing even when the option was not used). --- Help/manual/cmake.1.rst | 6 ++-- Help/release/dev/remove-warn-unused-vars.rst | 6 ++++ Source/QtDialog/CMakeSetupDialog.cxx | 6 ---- Source/QtDialog/CMakeSetupDialog.h | 1 - Source/QtDialog/QCMake.cxx | 7 ----- Source/QtDialog/QCMake.h | 4 --- Source/cmDefinitions.cxx | 14 --------- Source/cmDefinitions.h | 4 --- Source/cmMakefile.cxx | 44 ++-------------------------- Source/cmMakefile.h | 7 ----- Source/cmServerProtocol.cxx | 5 ++-- Source/cmServerProtocol.h | 1 + Source/cmStateSnapshot.cxx | 5 ---- Source/cmStateSnapshot.h | 1 - Source/cmake.cxx | 3 +- Source/cmake.h | 3 -- Source/cmakemain.cxx | 1 - Tests/CMakeLists.txt | 30 ------------------- Tests/VariableUnusedViaSet/CMakeLists.txt | 4 --- Tests/VariableUnusedViaUnset/CMakeLists.txt | 8 ----- 20 files changed, 16 insertions(+), 144 deletions(-) create mode 100644 Help/release/dev/remove-warn-unused-vars.rst delete mode 100644 Tests/VariableUnusedViaSet/CMakeLists.txt delete mode 100644 Tests/VariableUnusedViaUnset/CMakeLists.txt diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 72ecfc7..d5fe34c 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -341,9 +341,9 @@ Options Print a warning when an uninitialized variable is used. ``--warn-unused-vars`` - Warn about unused variables. - - Find variables that are declared or set, but not used. + Does nothing. In CMake versions 3.2 and below this enabled warnings about + unused variables. In CMake versions 3.3 through 3.18 the option was broken. + In CMake 3.19 and above the option has been removed. ``--no-warn-unused-cli`` Don't warn about command line options. diff --git a/Help/release/dev/remove-warn-unused-vars.rst b/Help/release/dev/remove-warn-unused-vars.rst new file mode 100644 index 0000000..7a06e91 --- /dev/null +++ b/Help/release/dev/remove-warn-unused-vars.rst @@ -0,0 +1,6 @@ +remove-warn-unused-vars +----------------------- + +* The :manual:`cmake(1)` command-line option ``--warn-unused-vars`` has + been removed and is now silently ignored. The option has not worked + correctly since CMake 3.3. diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 6dbfe11..fcc8408 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -152,9 +152,6 @@ CMakeSetupDialog::CMakeSetupDialog() this->WarnUninitializedAction = OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)")); this->WarnUninitializedAction->setCheckable(true); - this->WarnUnusedAction = - OptionsMenu->addAction(tr("&Warn Unused (--warn-unused-vars)")); - this->WarnUnusedAction->setCheckable(true); QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output")); debugAction->setCheckable(true); @@ -290,9 +287,6 @@ void CMakeSetupDialog::initialize() QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)), this->CMakeThread->cmakeInstance(), SLOT(setWarnUninitializedMode(bool))); - QObject::connect(this->WarnUnusedAction, SIGNAL(triggered(bool)), - this->CMakeThread->cmakeInstance(), - SLOT(setWarnUnusedMode(bool))); if (!this->SourceDirectory->text().isEmpty() || !this->BinaryDirectory->lineEdit()->text().isEmpty()) { diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index d1e2035..914be12 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -111,7 +111,6 @@ protected: QAction* ConfigureAction; QAction* GenerateAction; QAction* WarnUninitializedAction; - QAction* WarnUnusedAction; QAction* InstallForCommandLineAction; State CurrentState; diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index f0b967b..6090256 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -21,7 +21,6 @@ QCMake::QCMake(QObject* p) : QObject(p) { this->WarnUninitializedMode = false; - this->WarnUnusedMode = false; qRegisterMetaType(); qRegisterMetaType(); @@ -170,7 +169,6 @@ void QCMake::configure() this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data()); this->CMakeInstance->LoadCache(); this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode); - this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode); this->CMakeInstance->PreLoadCMakeFiles(); InterruptFlag = 0; @@ -478,11 +476,6 @@ void QCMake::setWarnUninitializedMode(bool value) this->WarnUninitializedMode = value; } -void QCMake::setWarnUnusedMode(bool value) -{ - this->WarnUnusedMode = value; -} - void QCMake::checkOpenPossible() { std::string data = this->BinaryDirectory.toLocal8Bit().data(); diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 110a971..39555d6 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -114,8 +114,6 @@ public slots: void setDeprecatedWarningsAsErrors(bool value); /// set whether to run cmake with warnings about uninitialized variables void setWarnUninitializedMode(bool value); - /// set whether to run cmake with warnings about unused variables - void setWarnUnusedMode(bool value); /// check if project IDE open is possible and emit openPossible signal void checkOpenPossible(); @@ -175,8 +173,6 @@ protected: void stderrCallback(std::string const& msg); bool WarnUninitializedMode; - bool WarnUnusedMode; - bool WarnUnusedAllMode; QString SourceDirectory; QString BinaryDirectory; QString Generator; diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 69a6427..4a4f87d 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -19,7 +19,6 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key, { auto it = begin->Map.find(cm::String::borrow(key)); if (it != begin->Map.end()) { - it->second.Used = true; return it->second; } } @@ -108,16 +107,3 @@ void cmDefinitions::Unset(const std::string& key) { this->Map[key] = Def(); } - -std::vector cmDefinitions::UnusedKeys() const -{ - std::vector keys; - keys.reserve(this->Map.size()); - // Consider local definitions. - for (auto const& mi : this->Map) { - if (!mi.second.Used) { - keys.push_back(*mi.first.str_if_stable()); - } - } - return keys; -} diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 0e38fb1..d57750a 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -48,9 +48,6 @@ public: /** Unset a definition. */ void Unset(const std::string& key); - /** List of unused keys. */ - std::vector UnusedKeys() const; - private: /** String with existence boolean. */ struct Def @@ -62,7 +59,6 @@ private: { } cm::String Value; - bool Used = false; }; static Def NoDef; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d34259f..25013df 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -83,7 +83,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator, { this->IsSourceFileTryCompile = false; - this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); this->SuppressSideEffects = false; @@ -751,7 +750,6 @@ void cmMakefile::ReadListFile(cmListFile const& listFile, break; } } - this->CheckForUnusedVariables(); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile); this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile); @@ -1511,8 +1509,6 @@ void cmMakefile::PopFunctionScope(bool reportError) #endif this->PopLoopBlockBarrier(); - - this->CheckForUnusedVariables(); } void cmMakefile::PushMacroScope(std::string const& fileName, @@ -1859,9 +1855,6 @@ void cmMakefile::AddSystemIncludeDirectories(const std::set& incs) void cmMakefile::AddDefinition(const std::string& name, cm::string_view value) { - if (this->VariableInitialized(name)) { - this->LogUnused("changing definition", name); - } this->StateSnapshot.SetDefinition(name, value); #ifndef CMAKE_BOOTSTRAP @@ -1922,16 +1915,6 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, this->StateSnapshot.RemoveDefinition(name); } -void cmMakefile::CheckForUnusedVariables() const -{ - if (!this->WarnUnused) { - return; - } - for (const std::string& key : this->StateSnapshot.UnusedKeys()) { - this->LogUnused("out of scope", key); - } -} - void cmMakefile::MarkVariableAsUsed(const std::string& var) { this->StateSnapshot.GetDefinition(var); @@ -1959,29 +1942,8 @@ void cmMakefile::MaybeWarnUninitialized(std::string const& variable, } } -void cmMakefile::LogUnused(const char* reason, const std::string& name) const -{ - if (this->WarnUnused) { - std::string path; - if (!this->ExecutionStatusStack.empty()) { - path = this->GetExecutionContext().FilePath; - } else { - path = cmStrCat(this->GetCurrentSourceDirectory(), "/CMakeLists.txt"); - } - - if (this->CheckSystemVars || this->IsProjectFile(path.c_str())) { - std::ostringstream msg; - msg << "unused variable (" << reason << ") \'" << name << "\'"; - this->IssueMessage(MessageType::AUTHOR_WARNING, msg.str()); - } - } -} - void cmMakefile::RemoveDefinition(const std::string& name) { - if (this->VariableInitialized(name)) { - this->LogUnused("unsetting", name); - } this->StateSnapshot.RemoveDefinition(name); #ifndef CMAKE_BOOTSTRAP cmVariableWatch* vv = this->GetVariableWatch(); @@ -3724,7 +3686,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, if (cmakeArgs) { // FIXME: Workaround to ignore unused CLI variables in try-compile. // - // Ideally we should use SetArgs to honor options like --warn-unused-vars. + // Ideally we should use SetArgs for options like --no-warn-unused-cli. // However, there is a subtle problem when certain arguments are passed to // a macro wrapping around try_compile or try_run that does not escape // semicolons in its parameters but just passes ${ARGV} or ${ARGN}. In @@ -3743,7 +3705,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // the value VAR=a is sufficient for the try_compile or try_run to get the // correct result. Calling SetArgs here would break such projects that // previously built. Instead we work around the issue by never reporting - // unused arguments and ignoring options such as --warn-unused-vars. + // unused arguments and ignoring options such as --no-warn-unused-cli. cm.SetWarnUnusedCli(false); // cm.SetArgs(*cmakeArgs, true); @@ -4247,8 +4209,6 @@ void cmMakefile::PopScope() this->PopLoopBlockBarrier(); - this->CheckForUnusedVariables(); - this->PopSnapshot(); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 332554e..045ded4 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -995,9 +995,6 @@ protected: // add link libraries and directories to the target void AddGlobalLinkInformation(cmTarget& target); - // Check for a an unused variable - void LogUnused(const char* reason, const std::string& name) const; - mutable std::set CMP0054ReportedIds; // libraries, classes, and executables @@ -1233,10 +1230,6 @@ private: std::string const& config, const std::string& feature) const; - void CheckForUnusedVariables() const; - - // Unused variable flags - bool WarnUnused; bool CheckSystemVars; bool CheckCMP0000; std::set WarnedCMP0074; diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 4f7131f..e586fd9 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -136,6 +136,7 @@ bool cmServerProtocol::Activate(cmServer* server, this->m_Server = server; this->m_CMakeInstance = cm::make_unique(cmake::RoleProject, cmState::Project); + this->m_WarnUnused = false; const bool result = this->DoActivate(request, errorMessage); if (!result) { this->m_CMakeInstance = nullptr; @@ -636,7 +637,7 @@ cmServerResponse cmServerProtocol1::ProcessGlobalSettings( obj[kTRACE_KEY] = cm->GetTrace(); obj[kTRACE_EXPAND_KEY] = cm->GetTraceExpand(); obj[kWARN_UNINITIALIZED_KEY] = cm->GetWarnUninitialized(); - obj[kWARN_UNUSED_KEY] = cm->GetWarnUnused(); + obj[kWARN_UNUSED_KEY] = m_WarnUnused; obj[kWARN_UNUSED_CLI_KEY] = cm->GetWarnUnusedCli(); obj[kCHECK_SYSTEM_VARS_KEY] = cm->GetCheckSystemVars(); @@ -682,7 +683,7 @@ cmServerResponse cmServerProtocol1::ProcessSetGlobalSettings( setBool(request, kTRACE_EXPAND_KEY, [cm](bool e) { cm->SetTraceExpand(e); }); setBool(request, kWARN_UNINITIALIZED_KEY, [cm](bool e) { cm->SetWarnUninitialized(e); }); - setBool(request, kWARN_UNUSED_KEY, [cm](bool e) { cm->SetWarnUnused(e); }); + setBool(request, kWARN_UNUSED_KEY, [this](bool e) { m_WarnUnused = e; }); setBool(request, kWARN_UNUSED_CLI_KEY, [cm](bool e) { cm->SetWarnUnusedCli(e); }); setBool(request, kCHECK_SYSTEM_VARS_KEY, diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h index c71b7bf..6009e23 100644 --- a/Source/cmServerProtocol.h +++ b/Source/cmServerProtocol.h @@ -94,6 +94,7 @@ protected: // Implement protocol specific activation tasks here. Called from Activate(). virtual bool DoActivate(const cmServerRequest& request, std::string* errorMessage); + bool m_WarnUnused = false; // storage for legacy option private: std::unique_ptr m_CMakeInstance; diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 15a98af..cfabc3f 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -232,11 +232,6 @@ void cmStateSnapshot::RemoveDefinition(std::string const& name) this->Position->Vars->Unset(name); } -std::vector cmStateSnapshot::UnusedKeys() const -{ - return this->Position->Vars->UnusedKeys(); -} - std::vector cmStateSnapshot::ClosureKeys() const { return cmDefinitions::ClosureKeys(this->Position->Vars, diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h index 021fd53..c19f174 100644 --- a/Source/cmStateSnapshot.h +++ b/Source/cmStateSnapshot.h @@ -28,7 +28,6 @@ public: bool IsInitialized(std::string const& name) const; void SetDefinition(std::string const& name, cm::string_view value); void RemoveDefinition(std::string const& name); - std::vector UnusedKeys() const; std::vector ClosureKeys() const; bool RaiseScope(std::string const& var, const char* varDef); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 27ecb4d..638f10e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -773,8 +773,7 @@ void cmake::SetArgs(const std::vector& args) std::cout << "Warn about uninitialized values.\n"; this->SetWarnUninitialized(true); } else if (cmHasLiteralPrefix(arg, "--warn-unused-vars")) { - std::cout << "Finding unused variables.\n"; - this->SetWarnUnused(true); + // Option was removed. } else if (cmHasLiteralPrefix(arg, "--no-warn-unused-cli")) { std::cout << "Not searching for unused variables given on the " << "command line.\n"; diff --git a/Source/cmake.h b/Source/cmake.h index c5d608f..0c4f429 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -450,8 +450,6 @@ public: bool GetWarnUninitialized() { return this->WarnUninitialized; } void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; } - bool GetWarnUnused() { return this->WarnUnused; } - void SetWarnUnused(bool b) { this->WarnUnused = b; } bool GetWarnUnusedCli() { return this->WarnUnusedCli; } void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; } bool GetCheckSystemVars() { return this->CheckSystemVars; } @@ -605,7 +603,6 @@ private: TraceFormat TraceFormatVar = TRACE_HUMAN; cmGeneratedFileStream TraceFile; bool WarnUninitialized = false; - bool WarnUnused = false; bool WarnUnusedCli = true; bool CheckSystemVars = false; std::map UsedCliVariables; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 9fa6705..cebf34e 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -93,7 +93,6 @@ const char* cmDocumentationOptions[][2] = { { "--trace-redirect=", "Redirect trace output to a file instead of stderr." }, { "--warn-uninitialized", "Warn about uninitialized values." }, - { "--warn-unused-vars", "Warn about unused variables." }, { "--no-warn-unused-cli", "Don't warn about command line options." }, { "--check-system-vars", "Find problems with variable usage in system " diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 067ffdb..19aa4c4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2417,36 +2417,6 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") endif() - add_test(WarnUnusedUnusedViaSet ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaSet" - "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet" - ${build_generator_args} - --build-noclean - --build-project WarnUnusedUnusedViaSet - --build-options - "--warn-unused-vars") - set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES - PASS_REGULAR_EXPRESSION "unused variable \\(changing definition\\) 'UNUSED_VARIABLE'") - set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES - FAIL_REGULAR_EXPRESSION "unused variable \\(unsetting\\) 'UNUSED_VARIABLE'") - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet") - - add_test(WarnUnusedUnusedViaUnset ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaUnset" - "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset" - ${build_generator_args} - --build-noclean - --build-project WarnUnusedUnusedViaUnset - --build-options - "--warn-unused-vars") - set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES - PASS_REGULAR_EXPRESSION "CMake Warning \\(dev\\) at CMakeLists.txt:7 \\(set\\):") - set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES - FAIL_REGULAR_EXPRESSION "CMakeLists.txt:5 \\(set\\):") - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset") - add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/WarnUnusedCliUnused" diff --git a/Tests/VariableUnusedViaSet/CMakeLists.txt b/Tests/VariableUnusedViaSet/CMakeLists.txt deleted file mode 100644 index 0123ab2..0000000 --- a/Tests/VariableUnusedViaSet/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(UNUSED_VARIABLE) -# Warning should occur here -set(UNUSED_VARIABLE "Usage") -message(STATUS "${UNUSED_VARIABLE}") diff --git a/Tests/VariableUnusedViaUnset/CMakeLists.txt b/Tests/VariableUnusedViaUnset/CMakeLists.txt deleted file mode 100644 index 4b4031d..0000000 --- a/Tests/VariableUnusedViaUnset/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# NOTE: Changing lines in here changes the test results since the first -# instance shouldn't warn, but the second should and they have the same message - -# A warning should NOT be issued for this line: -set(UNUSED_VARIABLE) -# Warning should occur here: -set(UNUSED_VARIABLE) -message(STATUS "${UNUSED_VARIABLE}") -- cgit v0.12 From 4b7b8c2885977eacc3ba769f7b3877e514957de3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 30 Jun 2020 00:02:07 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e4bd907..b579c7b 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 18) -set(CMake_VERSION_PATCH 20200629) +set(CMake_VERSION_PATCH 20200630) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 27b03281e2028d8239c3f7e43ea67f30a70dc42b Mon Sep 17 00:00:00 2001 From: Rahul Gottipati Date: Thu, 25 Jun 2020 19:06:25 +0530 Subject: configure_file: Add option to control file permissions transfer to copy Issue: #20866 --- Help/command/configure_file.rst | 6 ++++++ Help/release/dev/configure_file-permission-control.rst | 5 +++++ Source/CPack/cmCPackGenerator.cxx | 2 +- Source/cmConfigureFileCommand.cxx | 6 +++++- Source/cmCreateTestSourceList.cxx | 2 +- Source/cmLocalGenerator.cxx | 4 ++-- Source/cmMakefile.cxx | 17 ++++++++++++++++- Source/cmMakefile.h | 1 + Source/cmVisualStudio10TargetGenerator.cxx | 2 +- Tests/RunCMake/configure_file/NoSourcePermissions.cmake | 10 ++++++++++ Tests/RunCMake/configure_file/NoSourcePermissions.sh | 3 +++ Tests/RunCMake/configure_file/RunCMakeTest.cmake | 1 + 12 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 Help/release/dev/configure_file-permission-control.rst create mode 100644 Tests/RunCMake/configure_file/NoSourcePermissions.cmake create mode 100755 Tests/RunCMake/configure_file/NoSourcePermissions.sh diff --git a/Help/command/configure_file.rst b/Help/command/configure_file.rst index 29e85bd..46d1a05 100644 --- a/Help/command/configure_file.rst +++ b/Help/command/configure_file.rst @@ -7,6 +7,7 @@ Copy a file to another location and modify its contents. configure_file( [COPYONLY] [ESCAPE_QUOTES] [@ONLY] + [NO_SOURCE_PERMISSIONS] [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) Copies an ```` file to an ```` file and substitutes @@ -82,6 +83,11 @@ The arguments are: Restrict variable replacement to references of the form ``@VAR@``. This is useful for configuring scripts that use ``${VAR}`` syntax. + ``NO_SOURCE_PERMISSIONS`` + Does not transfer the file permissions of the original file to the copy. + The copied file permissions default to the standard 644 value + (-rw-r--r--). + ``NEWLINE_STYLE