[Cmake-commits] CMake branch, master, updated. v3.10.0-rc2-101-g358ceee

Kitware Robot kwrobot at kitware.com
Thu Oct 19 09:35:09 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  358ceee5d84723f60c2db5cdff52445d478d6a42 (commit)
       via  d20927533014312ae4b6ef6c1a3da5daf4e60618 (commit)
       via  ec0dbd044a06b9f7d6cd6d708d975b5dcb05babe (commit)
       via  d45aa38a068ef38331b5dab195c42502e3829eb0 (commit)
       via  60c272b69ae1c3363aba02488c04c83f66264251 (commit)
       via  754e39dd36cdeea4a15fca9ef9fa29f0fa8006d4 (commit)
       via  5d67e9025d1c7f1259477450831135667b6f1eeb (commit)
       via  344d149ae45251125f3dad038d9f10e531eb6fd1 (commit)
       via  ad9327d936dbbad8d6c818b41fe7c93b7d6a76e6 (commit)
      from  c412f40b5ac35ea7ca95ad45cc90d088e09fcb11 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=358ceee5d84723f60c2db5cdff52445d478d6a42
commit 358ceee5d84723f60c2db5cdff52445d478d6a42
Merge: d209275 d45aa38
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 19 13:27:22 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Oct 19 09:27:43 2017 -0400

    Merge topic 'curl_netrc_options'
    
    d45aa38a Add dev notes for topic 'curl_netrc_options'
    60c272b6 ExternalProject: Add support for NETRC and NETRC_FILE suboption
    754e39dd Add testcases for file(DOWNLOAD|UPLOAD) netrc options
    5d67e902 file(DOWNLOAD|UPLOAD): Add 'NETRC' and 'NETRC_FILE' suboption
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: Ruslan Baratov <ruslan_baratov at yahoo.com>
    Merge-request: !1376


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d20927533014312ae4b6ef6c1a3da5daf4e60618
commit d20927533014312ae4b6ef6c1a3da5daf4e60618
Merge: ec0dbd0 ad9327d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 19 13:27:05 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Oct 19 09:27:09 2017 -0400

    Merge topic 'ti-compiler-depfile-support'
    
    ad9327d9 Compiler/TI: Add support for depfile generation for Ninja
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1389


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec0dbd044a06b9f7d6cd6d708d975b5dcb05babe
commit ec0dbd044a06b9f7d6cd6d708d975b5dcb05babe
Merge: c412f40 344d149
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 19 13:26:20 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Oct 19 09:26:33 2017 -0400

    Merge topic 'ide-direct-CMakeLists.txt'
    
    344d149a VS,Xcode: Add CMakeLists.txt sources without mutating targets
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1392


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d45aa38a068ef38331b5dab195c42502e3829eb0
commit d45aa38a068ef38331b5dab195c42502e3829eb0
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Wed Oct 18 10:29:03 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 18 15:21:43 2017 -0400

    Add dev notes for topic 'curl_netrc_options'

diff --git a/Help/release/dev/curl_netrc_options.rst b/Help/release/dev/curl_netrc_options.rst
new file mode 100644
index 0000000..850c9ce
--- /dev/null
+++ b/Help/release/dev/curl_netrc_options.rst
@@ -0,0 +1,14 @@
+curl_netrc_options
+------------------
+
+* The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands
+  gained ``NETRC`` and ``NETRC_FILE`` options to specify use of a
+  ``.netrc`` file.
+
+* The :module:`ExternalProject` module gained ``NETRC`` and ``NETRC_FILE``
+  options to specify use of a ``.netrc`` file.
+
+* The :variable:`CMAKE_NETRC` and :variable:`CMAKE_NETRC_FILE` variables
+  were added to specify use of a ``.netrc`` file by the
+  :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands and
+  the :module:`ExternalProject` module.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60c272b69ae1c3363aba02488c04c83f66264251
commit 60c272b69ae1c3363aba02488c04c83f66264251
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Wed Oct 18 10:28:28 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 18 15:21:43 2017 -0400

    ExternalProject: Add support for NETRC and NETRC_FILE suboption

diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index d30c86e..971f7d0 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -47,7 +47,7 @@ syn keyword cmakeModule contained
             \ ExternalProject
 
 syn keyword cmakeKWExternalProject contained
-            \ ALGO AWS BINARY_DIR BUILD_ALWAYS BUILD_BYPRODUCTS BUILD_COMMAND BUILD_IN_SOURCE CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY COMMENT CONFIGURE_COMMAND CVS CVSROOT CVS_MODULE CVS_REPOSITORY CVS_TAG DEPENDEES DEPENDERS DEPENDS DOWNLOADED_FILE DOWNLOAD_COMMAND DOWNLOAD_DIR DOWNLOAD_NAME DOWNLOAD_NO_EXTRACT DOWNLOAD_NO_PROGRESS EP_BASE EP_INDEPENDENT_STEP_TARGETS EP_PREFIX EP_STEP_TARGETS EP_UPDATE_DISCONNECTED EXCLUDE_FROM_ALL FORCE GIT_CONFIG GIT_PROGRESS GIT_REMOTE_NAME GIT_REPOSITORY GIT_SHALLOW GIT_SUBMODULES GIT_TAG HG_REPOSITORY HG_TAG HTTP_HEADER HTTP_PASSWORD HTTP_USERNAME INDEPENDENT_STEP_TARGETS INSTALL_COMMAND INSTALL_DIR JOB_POOLS LIST_SEPARATOR LOG_ LOG_BUILD LOG_CONFIGURE LOG_DOWNLOAD LOG_INSTALL LOG_TEST LOG_UPDATE MAKE_EXE NAMES NOTE NO_DEPENDS PATCH_COMMAND PREFIX PROPERTY SOURCE_DIR SOURCE_SUBDIR STAMP_DIR STEP_TARGETS STRING SVN_PASSWORD SVN_REPOSITORY SVN_REVISION SVN_TRUST_CERT SVN_USERNAME TEST_AFTER_INSTALL TEST_BEFORE_INSTALL TEST_COMMAND TEST_EXCLUDE_FROM_MAIN TIMEOUT TLS_CAINFO TLS_VERIFY TMP_DIR TRUE UPDATE_COMMAND UPDATE_DISCONNECTED URL URL_HASH USES_TERMINAL_BUILD USES_TERMINAL_CONFIGURE USES_TERMINAL_DOWNLOAD USES_TERMINAL_INSTALL USES_TERMINAL_TEST USES_TERMINAL_UPDATE WORKING_DIRECTORY
+            \ ALGO AWS BINARY_DIR BUILD_ALWAYS BUILD_BYPRODUCTS BUILD_COMMAND BUILD_IN_SOURCE CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY COMMENT CONFIGURE_COMMAND CVS CVSROOT CVS_MODULE CVS_REPOSITORY CVS_TAG DEPENDEES DEPENDERS DEPENDS DOWNLOADED_FILE DOWNLOAD_COMMAND DOWNLOAD_DIR DOWNLOAD_NAME DOWNLOAD_NO_EXTRACT DOWNLOAD_NO_PROGRESS EP_BASE EP_INDEPENDENT_STEP_TARGETS EP_PREFIX EP_STEP_TARGETS EP_UPDATE_DISCONNECTED EXCLUDE_FROM_ALL FORCE GIT_CONFIG GIT_PROGRESS GIT_REMOTE_NAME GIT_REPOSITORY GIT_SHALLOW GIT_SUBMODULES GIT_TAG HG_REPOSITORY HG_TAG HTTP_HEADER HTTP_PASSWORD HTTP_USERNAME INDEPENDENT_STEP_TARGETS INSTALL_COMMAND INSTALL_DIR JOB_POOLS LIST_SEPARATOR LOG_ LOG_BUILD LOG_CONFIGURE LOG_DOWNLOAD LOG_INSTALL LOG_TEST LOG_UPDATE MAKE_EXE NAMES NETRC NETRC_FILE NOTE NO_DEPENDS PATCH_COMMAND PREFIX PROPERTY SOURCE_DIR SOURCE_SUBDIR STAMP_DIR STEP_TARGETS STRING SVN_PASSWORD SVN_REPOSITORY SVN_REVISION SVN_TRUST_CERT SVN_USERNAME TEST_AFTER_INSTALL TEST_BEFORE_INSTALL TEST_COMMAND TEST_EXCLUDE_FROM_MAIN TIMEOUT TLS_CAINFO TLS_VERIFY TMP_DIR TRUE UPDATE_COMMAND UPDATE_DISCONNECTED URL URL_HASH USES_TERMINAL_BUILD USES_TERMINAL_CONFIGURE USES_TERMINAL_DOWNLOAD USES_TERMINAL_INSTALL USES_TERMINAL_TEST USES_TERMINAL_UPDATE WORKING_DIRECTORY
 
 syn keyword cmakeKWadd_compile_options contained
             \ COMPILE_OPTIONS
diff --git a/Modules/ExternalProject-download.cmake.in b/Modules/ExternalProject-download.cmake.in
index 7f92596..99fb917 100644
--- a/Modules/ExternalProject-download.cmake.in
+++ b/Modules/ExternalProject-download.cmake.in
@@ -116,6 +116,8 @@ foreach(i RANGE ${retry_number})
 
     @TLS_VERIFY_CODE@
     @TLS_CAINFO_CODE@
+    @NETRC_CODE@
+    @NETRC_FILE_CODE@
 
     file(
         DOWNLOAD
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 76f5080..c041f03 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -193,6 +193,28 @@ External Project Definition
         ``CMAKE_TLS_CAINFO`` variable will be used instead (see
         :command:`file(DOWNLOAD)`)
 
+      ``NETRC <level>``
+        Specify whether the .netrc file is to be used for operation. If this
+        option is not specified, the value of the ``CMAKE_NETRC`` variable
+        will be used instead (see :command:`file(DOWNLOAD)`)
+        Valid levels are:
+
+        ``IGNORED``
+          The .netrc file is ignored.
+          This is the default.
+        ``OPTIONAL``
+          The .netrc file is optional, and information in the URL is preferred.
+          The file will be scanned to find which ever information is not specified
+          in the URL.
+        ``REQUIRED``
+          The .netrc file is required, and information in the URL is ignored.
+
+      ``NETRC_FILE <file>``
+        Specify an alternative .netrc file to the one in your home directory
+        if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option
+        is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will
+        be used instead (see :command:`file(DOWNLOAD)`)
+
     *Git*
       NOTE: A git version of 1.6.5 or later is required if this download method
       is used.
@@ -1343,7 +1365,7 @@ endif()
 
 endfunction(_ep_write_gitupdate_script)
 
-function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers)
+function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers netrc netrc_file)
   if(timeout)
     set(TIMEOUT_ARGS TIMEOUT ${timeout})
     set(TIMEOUT_MSG "${timeout} seconds")
@@ -1368,6 +1390,8 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
 
   set(TLS_VERIFY_CODE "")
   set(TLS_CAINFO_CODE "")
+  set(NETRC_CODE "")
+  set(NETRC_FILE_CODE "")
 
   # check for curl globals in the project
   if(DEFINED CMAKE_TLS_VERIFY)
@@ -1376,6 +1400,12 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
   if(DEFINED CMAKE_TLS_CAINFO)
     set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")")
   endif()
+  if(DEFINED CMAKE_NETRC)
+    set(NETRC_CODE "set(CMAKE_NETRC \"${CMAKE_NETRC}\")")
+  endif()
+  if(DEFINED CMAKE_NETRC_FILE)
+    set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${CMAKE_NETRC_FILE}\")")
+  endif()
 
   # now check for curl locals so that the local values
   # will override the globals
@@ -1390,6 +1420,16 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
   if(tls_cainfo_len GREATER 0)
     set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
   endif()
+  # check for netrc argument
+  string(LENGTH "${netrc}" netrc_len)
+  if(netrc_len GREATER 0)
+    set(NETRC_CODE "set(CMAKE_NETRC \"${netrc}\")")
+  endif()
+  # check for netrc_file argument
+  string(LENGTH "${netrc_file}" netrc_file_len)
+  if(netrc_file_len GREATER 0)
+    set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${netrc_file}\")")
+  endif()
 
   if(userpwd STREQUAL ":")
     set(USERPWD_ARGS)
@@ -2433,11 +2473,13 @@ function(_ep_add_download_command name)
         get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS)
         get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
         get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
+        get_property(netrc TARGET ${name} PROPERTY _EP_NETRC)
+        get_property(netrc_file TARGET ${name} PROPERTY _EP_NETRC_FILE)
         get_property(http_username TARGET ${name} PROPERTY _EP_HTTP_USERNAME)
         get_property(http_password TARGET ${name} PROPERTY _EP_HTTP_PASSWORD)
         get_property(http_headers TARGET ${name} PROPERTY _EP_HTTP_HEADER)
         set(download_script "${stamp_dir}/download-${name}.cmake")
-        _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}")
+        _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}" "${netrc}" "${netrc_file}")
         set(cmd ${CMAKE_COMMAND} -P "${download_script}"
           COMMAND)
         if (no_extract)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=754e39dd36cdeea4a15fca9ef9fa29f0fa8006d4
commit 754e39dd36cdeea4a15fca9ef9fa29f0fa8006d4
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Wed Oct 18 10:27:55 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 18 15:21:42 2017 -0400

    Add testcases for file(DOWNLOAD|UPLOAD) netrc options

diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt
new file mode 100644
index 0000000..96ce62a
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt
@@ -0,0 +1,19 @@
+^CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\):
+  file DOWNLOAD missing level value for NETRC\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\):
+  file DOWNLOAD missing file value for NETRC_FILE\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\):
+  file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: INVALID
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\):
+  file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: FALSE
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake
new file mode 100644
index 0000000..6a62df9
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake
@@ -0,0 +1,15 @@
+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/")
+  set(slash /)
+endif()
+file(DOWNLOAD "" "" NETRC)
+file(DOWNLOAD "" "" NETRC_FILE)
+set(CMAKE_NETRC FALSE)
+file(DOWNLOAD
+  "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-netrc-bad.txt"
+  "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt"
+  NETRC INVALID
+  )
+file(DOWNLOAD
+  "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-netrc-bad.txt"
+  "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt"
+  )
diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 26051b4..3be4fb7 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -3,9 +3,11 @@ include(RunCMake)
 run_cmake(DOWNLOAD-hash-mismatch)
 run_cmake(DOWNLOAD-unused-argument)
 run_cmake(DOWNLOAD-httpheader-not-set)
+run_cmake(DOWNLOAD-netrc-bad)
 run_cmake(DOWNLOAD-pass-not-set)
 run_cmake(UPLOAD-unused-argument)
 run_cmake(UPLOAD-httpheader-not-set)
+run_cmake(UPLOAD-netrc-bad)
 run_cmake(UPLOAD-pass-not-set)
 run_cmake(INSTALL-DIRECTORY)
 run_cmake(INSTALL-FILES_FROM_DIR)
diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt
new file mode 100644
index 0000000..d5752ea
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt
@@ -0,0 +1,19 @@
+^CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\):
+  file UPLOAD missing level value for NETRC\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\):
+  file UPLOAD missing file value for NETRC_FILE\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\):
+  file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: INVALID
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\):
+  file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: FALSE
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake b/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake
new file mode 100644
index 0000000..e59a2c4
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake
@@ -0,0 +1,15 @@
+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/")
+  set(slash /)
+endif()
+file(UPLOAD "" "" NETRC)
+file(UPLOAD "" "" NETRC_FILE)
+set(CMAKE_NETRC FALSE)
+file(UPLOAD
+  "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-netrc-bad.txt"
+  "file://${slash}${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt"
+  NETRC INVALID
+  )
+file(UPLOAD
+  "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-netrc-bad.txt"
+  "file://${slash}${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt"
+  )
diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad.txt
new file mode 100644
index 0000000..e69de29

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d67e9025d1c7f1259477450831135667b6f1eeb
commit 5d67e9025d1c7f1259477450831135667b6f1eeb
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Wed Oct 18 10:26:55 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 18 15:21:42 2017 -0400

    file(DOWNLOAD|UPLOAD): Add 'NETRC' and 'NETRC_FILE' suboption

diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 5f9af05..d30c86e 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -149,7 +149,7 @@ syn keyword cmakeKWexport_library_dependencies contained
             \ APPEND EXPORT INCLUDE LINK_INTERFACE_LIBRARIES SET
 
 syn keyword cmakeKWfile contained
-            \ ALGO APPEND ASCII CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY CONDITION CONFIG CONTENT COPY CR DESTINATION DIRECTORY_PERMISSIONS DOWNLOAD ENCODING EXCLUDE EXPECTED_HASH FILES_MATCHING FILE_PERMISSIONS FOLLOW_SYMLINKS FUNCTION GENERATE GLOB GLOB_RECURSE GUARD HASH HEX HTTPHEADER INACTIVITY_TIMEOUT INSTALL LENGTH_MAXIMUM LENGTH_MINIMUM LF LIMIT LIMIT_COUNT LIMIT_INPUT LIMIT_OUTPUT LIST_DIRECTORIES LOCK LOG MAKE_DIRECTORY NEWLINE_CONSUME NO_HEX_CONVERSION NO_SOURCE_PERMISSIONS OFFSET OLD PATTERN PROCESS READ REGEX RELATIVE RELATIVE_PATH RELEASE REMOVE REMOVE_RECURSE RENAME RESULT_VARIABLE SHOW_PROGRESS SSL STATUS STRINGS TIMESTAMP TLS_CAINFO TLS_VERIFY TO_CMAKE_PATH TO_NATIVE_PATH UPLOAD USERPWD USE_SOURCE_PERMISSIONS UTC UTF WRITE
+            \ ALGO APPEND ASCII CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY CONDITION CONFIG CONTENT COPY CR DESTINATION DIRECTORY_PERMISSIONS DOWNLOAD ENCODING EXCLUDE EXPECTED_HASH FILES_MATCHING FILE_PERMISSIONS FOLLOW_SYMLINKS FUNCTION GENERATE GLOB GLOB_RECURSE GUARD HASH HEX HTTPHEADER INACTIVITY_TIMEOUT INSTALL LENGTH_MAXIMUM LENGTH_MINIMUM LF LIMIT LIMIT_COUNT LIMIT_INPUT LIMIT_OUTPUT LIST_DIRECTORIES LOCK LOG MAKE_DIRECTORY NETRC NETRC_FILE NEWLINE_CONSUME NO_HEX_CONVERSION NO_SOURCE_PERMISSIONS OFFSET OLD PATTERN PROCESS READ REGEX RELATIVE RELATIVE_PATH RELEASE REMOVE REMOVE_RECURSE RENAME RESULT_VARIABLE SHOW_PROGRESS SSL STATUS STRINGS TIMESTAMP TLS_CAINFO TLS_VERIFY TO_CMAKE_PATH TO_NATIVE_PATH UPLOAD USERPWD USE_SOURCE_PERMISSIONS UTC UTF WRITE
 
 syn keyword cmakeKWfind_file contained
             \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
diff --git a/Help/command/file.rst b/Help/command/file.rst
index edccac5..4d4ebb4 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -232,6 +232,31 @@ Options to both ``DOWNLOAD`` and ``UPLOAD`` are:
 ``HTTPHEADER <HTTP-header>``
   HTTP header for operation. Suboption can be repeated several times.
 
+``NETRC <level>``
+  Specify whether the .netrc file is to be used for operation.  If this
+  option is not specified, the value of the ``CMAKE_NETRC`` variable
+  will be used instead.
+  Valid levels are:
+
+  ``IGNORED``
+    The .netrc file is ignored.
+    This is the default.
+  ``OPTIONAL``
+    The .netrc file is optional, and information in the URL is preferred.
+    The file will be scanned to find which ever information is not specified
+    in the URL.
+  ``REQUIRED``
+    The .netrc file is required, and information in the URL is ignored.
+
+``NETRC_FILE <file>``
+  Specify an alternative .netrc file to the one in your home directory,
+  if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option
+  is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will
+  be used instead.
+
+If neither ``NETRC`` option is given CMake will check variables
+``CMAKE_NETRC`` and ``CMAKE_NETRC_FILE``, respectively.
+
 Additional options to ``DOWNLOAD`` are:
 
 ``EXPECTED_HASH ALGO=<value>``
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 2e369e3..3880bcf 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -60,6 +60,8 @@ Variables that Provide Information
    /variable/CMAKE_MATCH_n
    /variable/CMAKE_MINIMUM_REQUIRED_VERSION
    /variable/CMAKE_MINOR_VERSION
+   /variable/CMAKE_NETRC
+   /variable/CMAKE_NETRC_FILE
    /variable/CMAKE_PARENT_LIST_FILE
    /variable/CMAKE_PATCH_VERSION
    /variable/CMAKE_PROJECT_DESCRIPTION
diff --git a/Help/variable/CMAKE_NETRC.rst b/Help/variable/CMAKE_NETRC.rst
new file mode 100644
index 0000000..52f857e
--- /dev/null
+++ b/Help/variable/CMAKE_NETRC.rst
@@ -0,0 +1,9 @@
+CMAKE_NETRC
+-----------
+
+This variable is used to initialize the ``NETRC`` option for
+:command:`file(DOWNLOAD)` and :command:`file(DOWNLOAD)` commands and the
+module :module:`ExternalProject`. See those commands for additional
+information.
+
+The local option takes precedence over this variable.
diff --git a/Help/variable/CMAKE_NETRC_FILE.rst b/Help/variable/CMAKE_NETRC_FILE.rst
new file mode 100644
index 0000000..1508f1e
--- /dev/null
+++ b/Help/variable/CMAKE_NETRC_FILE.rst
@@ -0,0 +1,9 @@
+CMAKE_NETRC_FILE
+----------------
+
+This variable is used to initialize the ``NETRC_FILE`` option for
+:command:`file(DOWNLOAD)` and :command:`file(DOWNLOAD)` commands and the
+module :module:`ExternalProject`. See those commands for additional
+information.
+
+The local option takes precedence over this variable.
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index 341b8c0..8ef8bff 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -56,3 +56,41 @@ std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile)
 #endif
   return e;
 }
+
+std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
+                                 const std::string& netrc_file)
+{
+  std::string e;
+  CURL_NETRC_OPTION curl_netrc_level = CURL_NETRC_LAST;
+  ::CURLcode res;
+
+  if (!netrc_level.empty()) {
+    if (netrc_level == "OPTIONAL") {
+      curl_netrc_level = CURL_NETRC_OPTIONAL;
+    } else if (netrc_level == "REQUIRED") {
+      curl_netrc_level = CURL_NETRC_REQUIRED;
+    } else if (netrc_level == "IGNORED") {
+      curl_netrc_level = CURL_NETRC_IGNORED;
+    } else {
+      e = "NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: ";
+      e += netrc_level;
+      return e;
+    }
+  }
+
+  if (curl_netrc_level != CURL_NETRC_LAST &&
+      curl_netrc_level != CURL_NETRC_IGNORED) {
+    res = ::curl_easy_setopt(curl, CURLOPT_NETRC, curl_netrc_level);
+    check_curl_result(res, "Unable to set netrc level: ");
+    if (!e.empty()) {
+      return e;
+    }
+
+    // check to see if a .netrc file has been specified
+    if (!netrc_file.empty()) {
+      res = ::curl_easy_setopt(curl, CURLOPT_NETRC_FILE, netrc_file.c_str());
+      check_curl_result(res, "Unable to set .netrc file path : ");
+    }
+  }
+  return e;
+}
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index 0688bb2..fe7eb80 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -9,5 +9,7 @@
 #include <string>
 
 std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = nullptr);
+std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
+                                 const std::string& netrc_file);
 
 #endif
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index fdd5f0c..191a666 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2626,6 +2626,9 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
   std::string statusVar;
   bool tls_verify = this->Makefile->IsOn("CMAKE_TLS_VERIFY");
   const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO");
+  std::string netrc_level = this->Makefile->GetSafeDefinition("CMAKE_NETRC");
+  std::string netrc_file =
+    this->Makefile->GetSafeDefinition("CMAKE_NETRC_FILE");
   std::string expectedHash;
   std::string hashMatchMSG;
   std::unique_ptr<cmCryptoHash> hash;
@@ -2681,6 +2684,22 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
         this->SetError("TLS_CAFILE missing file value.");
         return false;
       }
+    } else if (*i == "NETRC_FILE") {
+      ++i;
+      if (i != args.end()) {
+        netrc_file = *i;
+      } else {
+        this->SetError("DOWNLOAD missing file value for NETRC_FILE.");
+        return false;
+      }
+    } else if (*i == "NETRC") {
+      ++i;
+      if (i != args.end()) {
+        netrc_level = *i;
+      } else {
+        this->SetError("DOWNLOAD missing level value for NETRC.");
+        return false;
+      }
     } else if (*i == "EXPECTED_MD5") {
       ++i;
       if (i == args.end()) {
@@ -2822,6 +2841,16 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
     return false;
   }
 
+  // check to see if netrc parameters have been specified
+  // local command args takes precedence over CMAKE_NETRC*
+  netrc_level = cmSystemTools::UpperCase(netrc_level);
+  std::string const& netrc_option_err =
+    cmCurlSetNETRCOption(curl, netrc_level, netrc_file);
+  if (!netrc_option_err.empty()) {
+    this->SetError(netrc_option_err);
+    return false;
+  }
+
   cmFileCommandVectorOfChar chunkDebug;
 
   res = ::curl_easy_setopt(curl, CURLOPT_WRITEDATA, &fout);
@@ -2964,6 +2993,9 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
   std::string statusVar;
   bool showProgress = false;
   std::string userpwd;
+  std::string netrc_level = this->Makefile->GetSafeDefinition("CMAKE_NETRC");
+  std::string netrc_file =
+    this->Makefile->GetSafeDefinition("CMAKE_NETRC_FILE");
 
   std::vector<std::string> curl_headers;
 
@@ -3000,6 +3032,22 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
       statusVar = *i;
     } else if (*i == "SHOW_PROGRESS") {
       showProgress = true;
+    } else if (*i == "NETRC_FILE") {
+      ++i;
+      if (i != args.end()) {
+        netrc_file = *i;
+      } else {
+        this->SetError("UPLOAD missing file value for NETRC_FILE.");
+        return false;
+      }
+    } else if (*i == "NETRC") {
+      ++i;
+      if (i != args.end()) {
+        netrc_level = *i;
+      } else {
+        this->SetError("UPLOAD missing level value for NETRC.");
+        return false;
+      }
     } else if (*i == "USERPWD") {
       ++i;
       if (i == args.end()) {
@@ -3132,6 +3180,16 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
     check_curl_result(res, "UPLOAD cannot set user password: ");
   }
 
+  // check to see if netrc parameters have been specified
+  // local command args takes precedence over CMAKE_NETRC*
+  netrc_level = cmSystemTools::UpperCase(netrc_level);
+  std::string const& netrc_option_err =
+    cmCurlSetNETRCOption(curl, netrc_level, netrc_file);
+  if (!netrc_option_err.empty()) {
+    this->SetError(netrc_option_err);
+    return false;
+  }
+
   struct curl_slist* headers = nullptr;
   for (std::string const& h : curl_headers) {
     headers = ::curl_slist_append(headers, h.c_str());

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=344d149ae45251125f3dad038d9f10e531eb6fd1
commit 344d149ae45251125f3dad038d9f10e531eb6fd1
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 18 13:30:09 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 18 14:24:07 2017 -0400

    VS,Xcode: Add CMakeLists.txt sources without mutating targets
    
    Rather than injecting `CMakeLists.txt` files into each target's
    `SOURCES`, teach the generators to add them during generation using
    dedicated code.  This avoids mutating the original targets, and avoids
    polluting `$<TARGET_PROPERTY:foo,SOURCES>` with generator-specific
    content.
    
    This also avoids listing the `CMakeLists.txt` sources in the results of
    `CMAKE_DEBUG_TARGET_PROPERTIES==SOURCES` so the `RunCMake.TargetSources`
    test no longer needs a separate case for IDEs.

diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index b752f84..99600df 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -106,15 +106,6 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
   // Configure CMake Visual Studio macros, for this user on this version
   // of Visual Studio.
   this->ConfigureCMakeVisualStudioMacros();
-
-  // Add CMakeLists.txt with custom command to rerun CMake.
-  for (std::vector<cmLocalGenerator*>::const_iterator lgi =
-         this->LocalGenerators.begin();
-       lgi != this->LocalGenerators.end(); ++lgi) {
-    cmLocalVisualStudioGenerator* lg =
-      static_cast<cmLocalVisualStudioGenerator*>(*lgi);
-    lg->AddCMakeListsRules();
-  }
 }
 
 void cmGlobalVisualStudioGenerator::ComputeTargetObjectDirectory(
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e5471f2..78943e4 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -438,12 +438,6 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
   cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
   root->AddGeneratorTarget(allBuildGt);
 
-  // Refer to the main build configuration file for easy editing.
-  std::string listfile = root->GetCurrentSourceDirectory();
-  listfile += "/";
-  listfile += "CMakeLists.txt";
-  allBuildGt->AddSource(listfile);
-
   // Add XCODE depend helper
   std::string dir = root->GetCurrentBinaryDirectory();
   cmCustomCommandLine makeHelper;
@@ -513,12 +507,6 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
           !target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
         allbuild->AddUtility(target->GetName());
       }
-
-      // Refer to the build configuration file for easy editing.
-      listfile = gen->GetCurrentSourceDirectory();
-      listfile += "/";
-      listfile += "CMakeLists.txt";
-      target->AddSource(listfile);
     }
   }
 }
@@ -996,6 +984,13 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
     if (!gtgt->GetConfigCommonSourceFiles(classes)) {
       return false;
     }
+
+    // Add CMakeLists.txt file for user convenience.
+    std::string listfile =
+      gtgt->GetLocalGenerator()->GetCurrentSourceDirectory();
+    listfile += "/CMakeLists.txt";
+    classes.push_back(gtgt->Makefile->GetOrCreateSource(listfile));
+
     std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
 
     gtgt->ComputeObjectMapping();
@@ -2299,6 +2294,12 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
       return nullptr;
     }
 
+    // Add CMakeLists.txt file for user convenience.
+    std::string listfile =
+      gtgt->GetLocalGenerator()->GetCurrentSourceDirectory();
+    listfile += "/CMakeLists.txt";
+    sources.push_back(gtgt->Makefile->GetOrCreateSource(listfile));
+
     for (std::vector<cmSourceFile*>::const_iterator i = sources.begin();
          i != sources.end(); ++i) {
       if (!(*i)->GetPropertyAsBool("GENERATED")) {
@@ -2740,6 +2741,20 @@ bool cmGlobalXCodeGenerator::CreateGroups(
         std::string key = GetGroupMapKeyFromPath(gtgt, source);
         this->GroupMap[key] = pbxgroup;
       }
+
+      // Add CMakeLists.txt file for user convenience.
+      {
+        std::string listfile =
+          gtgt->GetLocalGenerator()->GetCurrentSourceDirectory();
+        listfile += "/CMakeLists.txt";
+        cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(listfile);
+        std::string const& source = sf->GetFullPath();
+        cmSourceGroup* sourceGroup =
+          mf->FindSourceGroup(source.c_str(), sourceGroups);
+        cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup);
+        std::string key = GetGroupMapKeyFromPath(gtgt, source);
+        this->GroupMap[key] = pbxgroup;
+      }
     }
   }
   return true;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index d8030b7..beb80f2 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -36,6 +36,13 @@ private:
   cmLocalVisualStudio7Generator* LocalGenerator;
 };
 
+class cmLocalVisualStudio7Generator::AllConfigSources
+{
+public:
+  std::vector<cmGeneratorTarget::AllConfigSource> Sources;
+  std::map<cmSourceFile const*, size_t> Index;
+};
+
 extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[];
 
 static void cmConvertToWindowsSlash(std::string& s)
@@ -83,29 +90,6 @@ void cmLocalVisualStudio7Generator::Generate()
   this->WriteStampFiles();
 }
 
-void cmLocalVisualStudio7Generator::AddCMakeListsRules()
-{
-  // Create the regeneration custom rule.
-  if (!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION")) {
-    // Create a rule to regenerate the build system when the target
-    // specification source changes.
-    if (cmSourceFile* sf = this->CreateVCProjBuildRule()) {
-      // Add the rule to targets that need it.
-      const std::vector<cmGeneratorTarget*>& tgts =
-        this->GetGeneratorTargets();
-      for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
-           l != tgts.end(); ++l) {
-        if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) {
-          continue;
-        }
-        if ((*l)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
-          (*l)->AddSource(sf->GetFullPath());
-        }
-      }
-    }
-  }
-}
-
 void cmLocalVisualStudio7Generator::FixGlobalTargets()
 {
   // Visual Studio .NET 2003 Service Pack 1 will not run post-build
@@ -239,19 +223,29 @@ void cmLocalVisualStudio7Generator::CreateSingleVCProj(
 
 cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
 {
+  if (this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION")) {
+    return nullptr;
+  }
+
+  std::string makefileIn = this->GetCurrentSourceDirectory();
+  makefileIn += "/";
+  makefileIn += "CMakeLists.txt";
+  makefileIn = cmSystemTools::CollapseFullPath(makefileIn);
+  if (cmSourceFile* file = this->Makefile->GetSource(makefileIn)) {
+    if (file->GetCustomCommand()) {
+      return file;
+    }
+  }
+  if (!cmSystemTools::FileExists(makefileIn)) {
+    return nullptr;
+  }
+
   std::string stampName = this->GetCurrentBinaryDirectory();
   stampName += "/";
   stampName += cmake::GetCMakeFilesDirectoryPostSlash();
   stampName += "generate.stamp";
   cmCustomCommandLine commandLine;
   commandLine.push_back(cmSystemTools::GetCMakeCommand());
-  std::string makefileIn = this->GetCurrentSourceDirectory();
-  makefileIn += "/";
-  makefileIn += "CMakeLists.txt";
-  makefileIn = cmSystemTools::CollapseFullPath(makefileIn.c_str());
-  if (!cmSystemTools::FileExists(makefileIn.c_str())) {
-    return 0;
-  }
   std::string comment = "Building Custom Rule ";
   comment += makefileIn;
   std::string args;
@@ -275,10 +269,13 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
     fullpathStampName.c_str(), listFiles, makefileIn.c_str(), commandLines,
     comment.c_str(), no_working_directory, true, false);
   if (cmSourceFile* file = this->Makefile->GetSource(makefileIn.c_str())) {
+    // Finalize the source file path now since we're adding this after
+    // the generator validated all project-named sources.
+    file->GetFullPath();
     return file;
   } else {
     cmSystemTools::Error("Error adding rule for ", makefileIn.c_str());
-    return 0;
+    return nullptr;
   }
 }
 
@@ -1368,13 +1365,26 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
   // We may be modifying the source groups temporarily, so make a copy.
   std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
 
-  std::vector<cmGeneratorTarget::AllConfigSource> const& sources =
-    target->GetAllConfigSources();
-  std::map<cmSourceFile const*, size_t> sourcesIndex;
+  AllConfigSources sources;
+  sources.Sources = target->GetAllConfigSources();
+
+  // Add CMakeLists.txt file with rule to re-run CMake for user convenience.
+  if (target->GetType() != cmStateEnums::GLOBAL_TARGET &&
+      target->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
+    if (cmSourceFile const* sf = this->CreateVCProjBuildRule()) {
+      cmGeneratorTarget::AllConfigSource acs;
+      acs.Source = sf;
+      acs.Kind = cmGeneratorTarget::SourceKindCustomCommand;
+      for (size_t ci = 0; ci < configs.size(); ++ci) {
+        acs.Configs.push_back(ci);
+      }
+      sources.Sources.emplace_back(std::move(acs));
+    }
+  }
 
-  for (size_t si = 0; si < sources.size(); ++si) {
-    cmSourceFile const* sf = sources[si].Source;
-    sourcesIndex[sf] = si;
+  for (size_t si = 0; si < sources.Sources.size(); ++si) {
+    cmSourceFile const* sf = sources.Sources[si].Source;
+    sources.Index[sf] = si;
     if (!sf->GetObjectLibrary().empty()) {
       if (this->FortranProject) {
         // Intel Fortran does not support per-config source locations
@@ -1400,7 +1410,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
   // Loop through every source group.
   for (unsigned int i = 0; i < sourceGroups.size(); ++i) {
     cmSourceGroup sg = sourceGroups[i];
-    this->WriteGroup(&sg, target, fout, libName, configs, sourcesIndex);
+    this->WriteGroup(&sg, target, fout, libName, configs, sources);
   }
 
   fout << "\t</Files>\n";
@@ -1567,7 +1577,7 @@ std::string cmLocalVisualStudio7Generator::ComputeLongestObjectDirectory(
 bool cmLocalVisualStudio7Generator::WriteGroup(
   const cmSourceGroup* sg, cmGeneratorTarget* target, std::ostream& fout,
   const std::string& libName, std::vector<std::string> const& configs,
-  std::map<cmSourceFile const*, size_t> const& sourcesIndex)
+  AllConfigSources const& sources)
 {
   cmGlobalVisualStudio7Generator* gg =
     static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
@@ -1579,7 +1589,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
   std::ostringstream tmpOut;
   for (unsigned int i = 0; i < children.size(); ++i) {
     if (this->WriteGroup(&children[i], target, tmpOut, libName, configs,
-                         sourcesIndex)) {
+                         sources)) {
       hasChildrenWithSources = true;
     }
   }
@@ -1595,9 +1605,6 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
     this->WriteVCProjBeginGroup(fout, name.c_str(), "");
   }
 
-  std::vector<cmGeneratorTarget::AllConfigSource> const& sources =
-    target->GetAllConfigSources();
-
   // Loop through each source in the source group.
   for (std::vector<const cmSourceFile*>::const_iterator sf =
          sourceFiles.begin();
@@ -1608,10 +1615,11 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
         target->GetType() == cmStateEnums::GLOBAL_TARGET) {
       // Look up the source kind and configs.
       std::map<cmSourceFile const*, size_t>::const_iterator map_it =
-        sourcesIndex.find(*sf);
+        sources.Index.find(*sf);
       // The map entry must exist because we populated it earlier.
-      assert(map_it != sourcesIndex.end());
-      cmGeneratorTarget::AllConfigSource const& acs = sources[map_it->second];
+      assert(map_it != sources.Index.end());
+      cmGeneratorTarget::AllConfigSource const& acs =
+        sources.Sources[map_it->second];
 
       FCInfo fcinfo(this, target, acs, configs);
 
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 7a77574..48f2e1a 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -65,7 +65,6 @@ public:
 
   virtual void ReadAndStoreExternalGUID(const std::string& name,
                                         const char* path);
-  virtual void AddCMakeListsRules();
 
 protected:
   void CreateSingleVCProj(const std::string& lname, cmGeneratorTarget* tgt);
@@ -117,10 +116,11 @@ private:
                        FCInfo& fcinfo);
   void WriteTargetVersionAttribute(std::ostream& fout, cmGeneratorTarget* gt);
 
+  class AllConfigSources;
   bool WriteGroup(const cmSourceGroup* sg, cmGeneratorTarget* target,
                   std::ostream& fout, const std::string& libName,
                   std::vector<std::string> const& configs,
-                  std::map<cmSourceFile const*, size_t> const& sourcesIndex);
+                  AllConfigSources const& sources);
 
   friend class cmLocalVisualStudio7GeneratorFCInfo;
   friend class cmLocalVisualStudio7GeneratorInternals;
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index cba24fe..ace2f89 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -44,8 +44,6 @@ public:
   virtual std::string ComputeLongestObjectDirectory(
     cmGeneratorTarget const*) const = 0;
 
-  virtual void AddCMakeListsRules() = 0;
-
   virtual void ComputeObjectFilenames(
     std::map<cmSourceFile const*, std::string>& mapping,
     cmGeneratorTarget const* = 0);
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index c61902a..1a1b1e2 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1174,6 +1174,15 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands()
        si != customCommands.end(); ++si) {
     this->WriteCustomCommand(*si);
   }
+
+  // Add CMakeLists.txt file with rule to re-run CMake for user convenience.
+  if (this->GeneratorTarget->GetType() != cmStateEnums::GLOBAL_TARGET &&
+      this->GeneratorTarget->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
+    if (cmSourceFile const* sf =
+          this->LocalGenerator->CreateVCProjBuildRule()) {
+      this->WriteCustomCommand(sf);
+    }
+  }
 }
 
 void cmVisualStudio10TargetGenerator::WriteCustomCommand(
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake
index f1452b5..c1a0f5b 100644
--- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake
@@ -1,8 +1,5 @@
 file(READ ${RunCMake_TEST_BINARY_DIR}/foo.txt foo_sources)
 
-# VS generators inject CMakeLists.txt as a source.  Remove it.
-string(REGEX REPLACE ";[^;]*CMakeLists.txt$" "" foo_sources "${foo_sources}")
-
 set(foo_expected "empty.c;empty2.c;empty3.c")
 if(NOT foo_sources STREQUAL foo_expected)
   set(RunCMake_TEST_FAILED "foo SOURCES was:\n [[${foo_sources}]]\nbut expected:\n [[${foo_expected}]]")
diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt b/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt
index 1de5dd7..c6b75fc 100644
--- a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt
+++ b/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt
@@ -6,9 +6,7 @@ CMake Error in CMakeLists.txt:
 
     .*/Tests/RunCMake/TargetSources/empty_1.cpp
     .*/Tests/RunCMake/TargetSources/empty_2.cpp
-    .*/Tests/RunCMake/TargetSources/CMakeLists.txt
 
   Config "Release":
 
     .*/Tests/RunCMake/TargetSources/empty_1.cpp
-    .*/Tests/RunCMake/TargetSources/CMakeLists.txt
diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
deleted file mode 100644
index 6fdcce7..0000000
--- a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-CMake Debug Log at OriginDebug.cmake:13 \(add_library\):
-  Used sources for target OriginDebug:
-
-   \* .*Tests/RunCMake/TargetSources/empty_2.cpp
-
-Call Stack \(most recent call first\):
-  OriginDebugIDE.cmake:4 \(include\)
-  CMakeLists.txt:3 \(include\)
-+
-CMake Debug Log at OriginDebug.cmake:16 \(set_property\):
-  Used sources for target OriginDebug:
-
-   \* .*Tests/RunCMake/TargetSources/empty_3.cpp
-
-Call Stack \(most recent call first\):
-  OriginDebugIDE.cmake:4 \(include\)
-  CMakeLists.txt:3 \(include\)
-+
-CMake Debug Log at OriginDebug.cmake:20 \(target_sources\):
-  Used sources for target OriginDebug:
-
-   \* .*Tests/RunCMake/TargetSources/empty_4.cpp
-
-Call Stack \(most recent call first\):
-  OriginDebugIDE.cmake:4 \(include\)
-  CMakeLists.txt:3 \(include\)
-+
-CMake Debug Log in CMakeLists.txt:
-  Used sources for target OriginDebug:
-
-   * .*CMakeLists.txt
-+
-CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\):
-  Used sources for target OriginDebug:
-
-   \* .*Tests/RunCMake/TargetSources/empty_1.cpp
-
-Call Stack \(most recent call first\):
-  OriginDebugIDE.cmake:4 \(include\)
-  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake b/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake
deleted file mode 100644
index a3cc3a8..0000000
--- a/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-# Separate test for the IDEs, because they show the CMakeLists.txt file
-# as a source file.
-include(${CMAKE_CURRENT_LIST_DIR}/OriginDebug.cmake)
diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
index bb55a6e..36d01de 100644
--- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
@@ -2,11 +2,9 @@ include(RunCMake)
 
 if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode")
   run_cmake(ConfigNotAllowed)
-  run_cmake(OriginDebugIDE)
-else()
-  run_cmake(OriginDebug)
 endif()
 
+run_cmake(OriginDebug)
 run_cmake(CMP0026-LOCATION)
 run_cmake(RelativePathInInterface)
 run_cmake(ExportBuild)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad9327d936dbbad8d6c818b41fe7c93b7d6a76e6
commit ad9327d936dbbad8d6c818b41fe7c93b7d6a76e6
Author:     Nico Müller <nicomueller1991 at googlemail.com>
AuthorDate: Mon Oct 16 23:27:05 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 18 09:43:22 2017 -0400

    Compiler/TI: Add support for depfile generation for Ninja
    
    TI C/C++ compiler are now able to generate dependency files during
    compilation.
    
    Fixes: #17360

diff --git a/Help/release/dev/ti-compiler-depfile-support.rst b/Help/release/dev/ti-compiler-depfile-support.rst
new file mode 100644
index 0000000..f870afd
--- /dev/null
+++ b/Help/release/dev/ti-compiler-depfile-support.rst
@@ -0,0 +1,4 @@
+ti-compiler-depfile-support
+---------------------------
+
+* TI C/C++ compilers are now supported by the :generator:`Ninja` generator.
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake
index ebc79f4..e149237 100644
--- a/Modules/Compiler/TI-C.cmake
+++ b/Modules/Compiler/TI-C.cmake
@@ -2,6 +2,8 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
 set(CMAKE_LINK_LIBRARY_FLAG "--library=")
 set(CMAKE_INCLUDE_FLAG_C "--include_path=")
 
+set(CMAKE_DEPFILE_FLAGS_C "--preproc_with_compile --preproc_dependency=<DEPFILE>")
+
 set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> --compile_only --skip_assembler --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
 set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
 
diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake
index 4104c3b..8b0069b 100644
--- a/Modules/Compiler/TI-CXX.cmake
+++ b/Modules/Compiler/TI-CXX.cmake
@@ -2,6 +2,8 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
 set(CMAKE_LINK_LIBRARY_FLAG "--library=")
 set(CMAKE_INCLUDE_FLAG_CXX "--include_path=")
 
+set(CMAKE_DEPFILE_FLAGS_CCX "--preproc_with_compile --preproc_dependency=<DEPFILE>")
+
 set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip_assembler --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
 set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
 

-----------------------------------------------------------------------

Summary of changes:
 Auxiliary/vim/syntax/cmake.vim                     |    4 +-
 Help/command/file.rst                              |   25 +++++
 Help/manual/cmake-variables.7.rst                  |    2 +
 Help/release/dev/curl_netrc_options.rst            |   14 +++
 Help/release/dev/ti-compiler-depfile-support.rst   |    4 +
 Help/variable/CMAKE_NETRC.rst                      |    9 ++
 Help/variable/CMAKE_NETRC_FILE.rst                 |    9 ++
 Modules/Compiler/TI-C.cmake                        |    2 +
 Modules/Compiler/TI-CXX.cmake                      |    2 +
 Modules/ExternalProject-download.cmake.in          |    2 +
 Modules/ExternalProject.cmake                      |   46 ++++++++-
 Source/cmCurl.cxx                                  |   38 ++++++++
 Source/cmCurl.h                                    |    2 +
 Source/cmFileCommand.cxx                           |   58 ++++++++++++
 Source/cmGlobalVisualStudioGenerator.cxx           |    9 --
 Source/cmGlobalXCodeGenerator.cxx                  |   39 +++++---
 Source/cmLocalVisualStudio7Generator.cxx           |  100 +++++++++++---------
 Source/cmLocalVisualStudio7Generator.h             |    4 +-
 Source/cmLocalVisualStudioGenerator.h              |    2 -
 Source/cmVisualStudio10TargetGenerator.cxx         |    9 ++
 .../TARGET_PROPERTY-SOURCES-check.cmake            |    3 -
 .../TargetSources/ConfigNotAllowed-stderr.txt      |    2 -
 .../TargetSources/OriginDebugIDE-result.txt        |    1 -
 .../TargetSources/OriginDebugIDE-stderr.txt        |   40 --------
 Tests/RunCMake/TargetSources/OriginDebugIDE.cmake  |    4 -
 Tests/RunCMake/TargetSources/RunCMakeTest.cmake    |    4 +-
 .../DOWNLOAD-netrc-bad-result.txt}                 |    0
 Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt  |   19 ++++
 Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake       |   15 +++
 .../RunCMake/file/DOWNLOAD-netrc-bad.txt           |    0
 Tests/RunCMake/file/RunCMakeTest.cmake             |    2 +
 .../UPLOAD-netrc-bad-result.txt}                   |    0
 Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt    |   19 ++++
 Tests/RunCMake/file/UPLOAD-netrc-bad.cmake         |   15 +++
 .../RunCMake/file/UPLOAD-netrc-bad.txt             |    0
 35 files changed, 376 insertions(+), 128 deletions(-)
 create mode 100644 Help/release/dev/curl_netrc_options.rst
 create mode 100644 Help/release/dev/ti-compiler-depfile-support.rst
 create mode 100644 Help/variable/CMAKE_NETRC.rst
 create mode 100644 Help/variable/CMAKE_NETRC_FILE.rst
 delete mode 100644 Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt
 delete mode 100644 Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
 delete mode 100644 Tests/RunCMake/TargetSources/OriginDebugIDE.cmake
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/DOWNLOAD-netrc-bad-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt
 create mode 100644 Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt (100%)
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/UPLOAD-netrc-bad-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt
 create mode 100644 Tests/RunCMake/file/UPLOAD-netrc-bad.cmake
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/file/UPLOAD-netrc-bad.txt (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list