summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/vim/syntax/cmake.vim9
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/prop_tgt/JOB_POOL_PRECOMPILE_HEADER.rst21
-rw-r--r--Help/variable/CMAKE_JOB_POOL_PRECOMPILE_HEADER.rst6
-rw-r--r--Modules/Platform/Windows-PGI.cmake3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmFileCommand.cxx3
-rw-r--r--Source/cmNinjaTargetGenerator.cxx7
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Tests/CMakeTests/CMakeLists.txt3
-rw-r--r--Tests/CMakeTests/FileDownloadTest.cmake.in81
-rw-r--r--Tests/CMakeTests/FileTestScript.cmake2
13 files changed, 121 insertions, 19 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 31ec1d0..0676f7e 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -221,6 +221,7 @@ syn keyword cmakeProperty contained
\ JOB_POOLS
\ JOB_POOL_COMPILE
\ JOB_POOL_LINK
+ \ JOB_POOL_PRECOMPILE_HEADER
\ KEEP_EXTENSION
\ LABELS
\ LANGUAGE
@@ -1066,6 +1067,7 @@ syn keyword cmakeVariable contained
\ CMAKE_JOB_POOLS
\ CMAKE_JOB_POOL_COMPILE
\ CMAKE_JOB_POOL_LINK
+ \ CMAKE_JOB_POOL_PRECOMPILE_HEADER
\ CMAKE_Java
\ CMAKE_Java_ANDROID_TOOLCHAIN_MACHINE
\ CMAKE_Java_ANDROID_TOOLCHAIN_PREFIX
@@ -2864,6 +2866,11 @@ syn keyword cmakeKWtarget_link_options contained
\ _LINKER_WRAPPER_FLAG
\ _LINKER_WRAPPER_FLAG_SEP
+syn keyword cmakeKWtarget_precompile_headers contained
+ \ INTERFACE
+ \ PRIVATE
+ \ PUBLIC
+
syn keyword cmakeKWtarget_sources contained
\ ALIAS
\ IMPORTED
@@ -3168,6 +3175,7 @@ syn keyword cmakeCommand
\ target_link_directories
\ target_link_libraries
\ target_link_options
+ \ target_precompile_headers
\ target_sources
\ try_compile
\ try_run
@@ -3324,6 +3332,7 @@ hi def link cmakeKWtarget_include_directories ModeMsg
hi def link cmakeKWtarget_link_directories ModeMsg
hi def link cmakeKWtarget_link_libraries ModeMsg
hi def link cmakeKWtarget_link_options ModeMsg
+hi def link cmakeKWtarget_precompile_headers ModeMsg
hi def link cmakeKWtarget_sources ModeMsg
hi def link cmakeKWtry_compile ModeMsg
hi def link cmakeKWtry_run ModeMsg
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index b3802d1..393735e 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -253,6 +253,7 @@ Properties on Targets
/prop_tgt/IOS_INSTALL_COMBINED
/prop_tgt/JOB_POOL_COMPILE
/prop_tgt/JOB_POOL_LINK
+ /prop_tgt/JOB_POOL_PRECOMPILE_HEADER
/prop_tgt/LABELS
/prop_tgt/LANG_CLANG_TIDY
/prop_tgt/LANG_COMPILER_LAUNCHER
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 26f1d80..0f7d2ec 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -65,6 +65,7 @@ Variables that Provide Information
/variable/CMAKE_IMPORT_LIBRARY_SUFFIX
/variable/CMAKE_JOB_POOL_COMPILE
/variable/CMAKE_JOB_POOL_LINK
+ /variable/CMAKE_JOB_POOL_PRECOMPILE_HEADER
/variable/CMAKE_JOB_POOLS
/variable/CMAKE_LANG_COMPILER_AR
/variable/CMAKE_LANG_COMPILER_RANLIB
diff --git a/Help/prop_tgt/JOB_POOL_PRECOMPILE_HEADER.rst b/Help/prop_tgt/JOB_POOL_PRECOMPILE_HEADER.rst
new file mode 100644
index 0000000..ece28a4
--- /dev/null
+++ b/Help/prop_tgt/JOB_POOL_PRECOMPILE_HEADER.rst
@@ -0,0 +1,21 @@
+JOB_POOL_PRECOMPILE_HEADER
+--------------------------
+
+Ninja only: Pool used for generating pre-compiled headers.
+
+The number of parallel compile processes could be limited by defining
+pools with the global :prop_gbl:`JOB_POOLS`
+property and then specifying here the pool name.
+
+For instance:
+
+.. code-block:: cmake
+
+ set_property(TARGET myexe PROPERTY JOB_POOL_PRECOMPILE_HEADER two_jobs)
+
+This property is initialized by the value of
+:variable:`CMAKE_JOB_POOL_PRECOMPILE_HEADER`.
+
+If neither :prop_tgt:`JOB_POOL_PRECOMPILE_HEADER` nor
+:variable:`CMAKE_JOB_POOL_PRECOMPILE_HEADER` are set then
+:prop_tgt:`JOB_POOL_COMPILE` will be used for this task.
diff --git a/Help/variable/CMAKE_JOB_POOL_PRECOMPILE_HEADER.rst b/Help/variable/CMAKE_JOB_POOL_PRECOMPILE_HEADER.rst
new file mode 100644
index 0000000..f9467b3
--- /dev/null
+++ b/Help/variable/CMAKE_JOB_POOL_PRECOMPILE_HEADER.rst
@@ -0,0 +1,6 @@
+CMAKE_JOB_POOL_PRECOMPILE_HEADER
+--------------------------------
+
+This variable is used to initialize the :prop_tgt:`JOB_POOL_PRECOMPILE_HEADER`
+property on all the targets. See :prop_tgt:`JOB_POOL_PRECOMPILE_HEADER`
+for additional information.
diff --git a/Modules/Platform/Windows-PGI.cmake b/Modules/Platform/Windows-PGI.cmake
index ad77e8a..8166240 100644
--- a/Modules/Platform/Windows-PGI.cmake
+++ b/Modules/Platform/Windows-PGI.cmake
@@ -9,9 +9,10 @@ endif()
set(__WINDOWS_COMPILER_PGI 1)
# PGI on Windows doesn't support parallel compile processes
-if(NOT DEFINED CMAKE_JOB_POOL_LINK OR NOT DEFINED CMAKE_JOB_POOL_COMPILE)
+if(NOT DEFINED CMAKE_JOB_POOL_LINK OR NOT DEFINED CMAKE_JOB_POOL_COMPILE OR NOT DEFINED CMAKE_JOB_POOL_PRECOMPILE_HEADER)
set(CMAKE_JOB_POOL_LINK PGITaskPool)
set(CMAKE_JOB_POOL_COMPILE PGITaskPool)
+ set(CMAKE_JOB_POOL_PRECOMPILE_HEADER PGITaskPool)
get_property(_pgijp GLOBAL PROPERTY JOB_POOLS)
if(NOT _pgijp MATCHES "PGITaskPool=")
set_property(GLOBAL APPEND PROPERTY JOB_POOLS PGITaskPool=1)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 7aa2fb8..e7dacfd 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 16)
-set(CMake_VERSION_PATCH 20200115)
+set(CMake_VERSION_PATCH 20200116)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 1fdfa87..d1775a7 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1707,7 +1707,8 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
// as we receive downloaded bits from curl...
//
std::string dir = cmSystemTools::GetFilenamePath(file);
- if (!cmSystemTools::FileExists(dir) && !cmSystemTools::MakeDirectory(dir)) {
+ if (!dir.empty() && !cmSystemTools::FileExists(dir) &&
+ !cmSystemTools::MakeDirectory(dir)) {
std::string errstring = "DOWNLOAD error: cannot create directory '" + dir +
"' - Specify file by full path name and verify that you "
"have directory creation and file write privileges.";
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index bd19b28..5a8c144 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1196,6 +1196,13 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(),
vars);
+ if (!pchSource.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
+ if (source->GetFullPath() == pchSource) {
+ this->addPoolNinjaVariable("JOB_POOL_PRECOMPILE_HEADER",
+ this->GetGeneratorTarget(), vars);
+ }
+ }
+
this->SetMsvcTargetPdbVariable(vars, config);
objBuild.RspFile = objectFileName + ".rsp";
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6590629..ae1393f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -513,6 +513,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->GetType() != cmStateEnums::UTILITY) {
initProp("JOB_POOL_COMPILE");
initProp("JOB_POOL_LINK");
+ initProp("JOB_POOL_PRECOMPILE_HEADER");
}
if (impl->TargetType <= cmStateEnums::UTILITY) {
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 1619081..e32d693 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -33,8 +33,9 @@ AddCMakeTest(While "")
AddCMakeTest(CMakeHostSystemInformation "")
AddCMakeTest(FileDownload "")
-set_property(TEST CMake.FileDownload PROPERTY
+set_tests_properties(CMake.FileDownload PROPERTIES
PASS_REGULAR_EXPRESSION "file already exists with expected MD5 sum"
+ FAIL_REGULAR_EXPRESSION "Unexpected status"
)
AddCMakeTest(FileDownloadBadHash "")
set_property(TEST CMake.FileDownloadBadHash PROPERTY
diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in
index 3935449..5bd3803 100644
--- a/Tests/CMakeTests/FileDownloadTest.cmake.in
+++ b/Tests/CMakeTests/FileDownloadTest.cmake.in
@@ -1,23 +1,50 @@
+# We do not contact any real URLs, but do try a bogus one.
+# Remove any proxy configuration that may change behavior.
+unset(ENV{http_proxy})
+unset(ENV{https_proxy})
+
+set(timeout 4)
+
if(NOT "@CMAKE_CURRENT_SOURCE_DIR@" MATCHES "^/")
set(slash /)
endif()
set(url "file://${slash}@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png")
set(dir "@CMAKE_CURRENT_BINARY_DIR@/downloads")
+# Beware Windows asynchronous file/directory removal, rename and then
+# remove the renamed dir so we can be certain the dir isn't there when
+# we get to the file() commands below
+if(EXISTS "${dir}")
+ file(RENAME ${dir} "${dir}_beingRemoved")
+ file(REMOVE_RECURSE "${dir}_beingRemoved")
+endif()
+
+function(__reportIfWrongStatus statusPair expectedStatusCode)
+ list(GET statusPair 0 statusCode)
+ if(NOT statusCode EQUAL expectedStatusCode)
+ message(SEND_ERROR
+ "Unexpected status: ${statusCode}, expected: ${expectedStatusCode}")
+ endif()
+endfunction()
+
message(STATUS "FileDownload:1")
file(DOWNLOAD
${url}
${dir}/file1.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
+ STATUS status
)
+__reportIfWrongStatus("${status}" 0)
message(STATUS "FileDownload:2")
file(DOWNLOAD
${url}
${dir}/file2.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
+ STATUS status
SHOW_PROGRESS
)
+__reportIfWrongStatus("${status}" 0)
# Two calls in a row, exactly the same arguments.
# Since downloaded file should exist already for 2nd call,
@@ -31,82 +58,108 @@ message(STATUS "FileDownload:3")
file(DOWNLOAD
${url}
${dir}/file3.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
+ STATUS status
EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92
)
+__reportIfWrongStatus("${status}" 0)
message(STATUS "FileDownload:4")
file(DOWNLOAD
${url}
${dir}/file3.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
STATUS status
EXPECTED_HASH SHA1=67eee17f79d9ac557284fc0b8ad19f25723fb578
)
+__reportIfWrongStatus("${status}" 0)
message(STATUS "FileDownload:5")
file(DOWNLOAD
${url}
${dir}/file3.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
STATUS status
EXPECTED_HASH SHA224=ba283726bbb602776818b463943189afd91836cb7ee5dd6e2c7b5ae4
)
+__reportIfWrongStatus("${status}" 0)
message(STATUS "FileDownload:6")
file(DOWNLOAD
${url}
${dir}/file3.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
STATUS status
EXPECTED_HASH SHA256=cf3334b1275071e1da6e8c396ccb72cf1b2388d8c937526f3af26230affb9423
)
+__reportIfWrongStatus("${status}" 0)
message(STATUS "FileDownload:7")
file(DOWNLOAD
${url}
${dir}/file3.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
STATUS status
EXPECTED_HASH SHA384=43a5d13978d97c660db44481aee0604cb4ff6ca0775cd5c2cd68cd8000e107e507c4caf6c228941231041e282ffb8950
)
+__reportIfWrongStatus("${status}" 0)
message(STATUS "FileDownload:8")
file(DOWNLOAD
${url}
${dir}/file3.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
STATUS status
EXPECTED_HASH SHA512=6984e0909a1018030ccaa418e3be1654223cdccff0fe6adc745f9aea7e377f178be53b9fc7d54a6f81c2b62ef9ddcd38ba1978fedf4c5e7139baaf355eefad5b
)
+__reportIfWrongStatus("${status}" 0)
+
message(STATUS "FileDownload:9")
file(DOWNLOAD
${url}
${dir}/file3.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
STATUS status
EXPECTED_HASH MD5=dbd330d52f4dbd60115d4191904ded92
)
+__reportIfWrongStatus("${status}" 0)
message(STATUS "FileDownload:10")
file(DOWNLOAD
${url}
${dir}/file3.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
STATUS status
EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92
)
+__reportIfWrongStatus("${status}" 0)
+# Print status because we check its message too
message(STATUS "${status}")
message(STATUS "FileDownload:11")
file(DOWNLOAD
badhostname.png
${dir}/file11.png
- TIMEOUT 2
+ TIMEOUT ${timeout}
STATUS status
)
message(STATUS "${status}")
-list(GET status 0 status_code)
-if(NOT ${status_code} EQUAL 6)
- message(SEND_ERROR "error: expected status code 6 for bad host name, got: ${status_code}")
+__reportIfWrongStatus("${status}" 6) # 6 corresponds to an unresolvable host name
+
+message(STATUS "FileDownload:12")
+set(absFile "@CMAKE_CURRENT_BINARY_DIR@/file12.png")
+if(EXISTS "${absFile}")
+ file(RENAME ${absFile} "${absFile}_beingRemoved")
+ file(REMOVE "${absFile}_beingRemoved")
+endif()
+file(DOWNLOAD
+ ${url}
+ file12.png
+ TIMEOUT ${timeout}
+ EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92
+ STATUS status
+ )
+__reportIfWrongStatus("${status}" 0)
+if(NOT EXISTS file12.png)
+ message(SEND_ERROR "file12.png not downloaded: ${status}")
endif()
diff --git a/Tests/CMakeTests/FileTestScript.cmake b/Tests/CMakeTests/FileTestScript.cmake
index 9a43569..145f28a 100644
--- a/Tests/CMakeTests/FileTestScript.cmake
+++ b/Tests/CMakeTests/FileTestScript.cmake
@@ -183,7 +183,7 @@ elseif(testname STREQUAL to_native_path) # pass
elseif(testname STREQUAL download_wrong_number_of_args) # fail
file(DOWNLOAD zzzz://bogus/ffff)
-elseif(testname STREQUAL download_file_with_no_path) # fail
+elseif(testname STREQUAL download_file_with_no_path) # pass
file(DOWNLOAD zzzz://bogus/ffff ffff)
elseif(testname STREQUAL download_missing_time) # fail