[Cmake-commits] CMake branch, master, updated. v3.8.1-1264-g73038a8

Kitware Robot kwrobot at kitware.com
Mon May 22 10:45:05 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  73038a85ea5d290bffc40a28ca8fa5a8d74c472c (commit)
       via  8ca236592b9c3b1e6695e3df6f08d067a05b999e (commit)
       via  c9d9a3fb39ff36dd2818238916697f685b6ccea7 (commit)
       via  a152e97e2354a0396ab8f8433d61e8f8da7da7f5 (commit)
       via  a748916f5e14687e31d2bd6d7dab5a8d5b7aa2b3 (commit)
       via  4eb15824b3092866f9c30d7af3221487c60fab07 (commit)
       via  a94ae96e6e1b8ef4e169c7c23cf95e0894e648cb (commit)
       via  c2c2d366198118a807fe6bf1820a32c13a6648ad (commit)
       via  47732280619c188da05ce5fa13527714cbe65b91 (commit)
       via  f74f01fe69a30f0b343c1b80e564cd4518c10f26 (commit)
       via  fe8f08d268e0a7551e82524da8f0e38e2c04a56f (commit)
       via  1558f30cead409181b6950433b6adfa7d64871e2 (commit)
       via  93cadfc2b5ebf6c859df24781bb759b03f1f2b5c (commit)
       via  57744ca9c0119fccbb89d08f5ef34394b4df1a81 (commit)
       via  ef3d360a3de4a290c92c34827a3b68a8ce160840 (commit)
      from  1b7c18a2f36c30182330c0a937760b09a89635c5 (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=73038a85ea5d290bffc40a28ca8fa5a8d74c472c
commit 73038a85ea5d290bffc40a28ca8fa5a8d74c472c
Merge: 8ca2365 1558f30
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon May 22 10:41:19 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon May 22 10:41:19 2017 -0400

    Merge branch 'release'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8ca236592b9c3b1e6695e3df6f08d067a05b999e
commit 8ca236592b9c3b1e6695e3df6f08d067a05b999e
Merge: c9d9a3f fe8f08d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon May 22 14:38:41 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon May 22 10:40:04 2017 -0400

    Merge topic 'add-findpackage-root-prefix'
    
    fe8f08d2 find_*: Add docs for PackageRoot search path group
    57744ca9 find_*: Add tests for PackageRoot search path group
    ef3d360a find_*: Add a new PackageRoot search path group
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !796


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9d9a3fb39ff36dd2818238916697f685b6ccea7
commit c9d9a3fb39ff36dd2818238916697f685b6ccea7
Merge: a152e97 4eb1582
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon May 22 14:37:22 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon May 22 10:37:57 2017 -0400

    Merge topic 'pgi-fix-windows'
    
    4eb15824 Windows-PGI: Add platform definitions
    a94ae96e Windows-PGI: Adapt default compiler flags
    c2c2d366 ImplicitLinkInfo: Add support for PGI on Windows
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !794


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a152e97e2354a0396ab8f8433d61e8f8da7da7f5
commit a152e97e2354a0396ab8f8433d61e8f8da7da7f5
Merge: a748916 4773228
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon May 22 14:35:23 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon May 22 10:35:59 2017 -0400

    Merge topic 'UseEcos-update'
    
    47732280 UseEcos: Fix for separate <DEFINES> and <INCLUDES> placeholders
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !871


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a748916f5e14687e31d2bd6d7dab5a8d5b7aa2b3
commit a748916f5e14687e31d2bd6d7dab5a8d5b7aa2b3
Merge: 1b7c18a f74f01f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon May 22 14:35:08 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon May 22 10:35:30 2017 -0400

    Merge topic 'cxx-features-check-always'
    
    f74f01fe Check C++ features even without CMAKE_CXX_STANDARD for CMake itself
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !870


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4eb15824b3092866f9c30d7af3221487c60fab07
commit 4eb15824b3092866f9c30d7af3221487c60fab07
Author:     Christian Pfeiffer <cpfeiffer at live.de>
AuthorDate: Fri May 12 19:10:21 2017 +0200
Commit:     Christian Pfeiffer <cpfeiffer at live.de>
CommitDate: Sat May 20 20:02:51 2017 +0200

    Windows-PGI: Add platform definitions
    
    PGI on Windows should use the Visual C++ linker and librarian and not
    the ar provided for legacy reasons. The compiler parameters themselves
    are the same as their Linux parameters and not compatible to MSVC
    however.

diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 4c0486e..e4103d0 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -26,6 +26,10 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
    OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC"
    OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
    OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
+   OR (CMAKE_HOST_WIN32 AND (
+        "x${CMAKE_C_COMPILER_ID}" STREQUAL "xPGI"
+         OR "x${CMAKE_Fortran_COMPILER_ID}" STREQUAL "xPGI"
+   ))
    OR (CMAKE_GENERATOR MATCHES "Visual Studio"
        AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
 
diff --git a/Modules/Platform/Windows-PGI-C.cmake b/Modules/Platform/Windows-PGI-C.cmake
new file mode 100644
index 0000000..0495b93
--- /dev/null
+++ b/Modules/Platform/Windows-PGI-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-PGI)
+__windows_compiler_pgi(C)
diff --git a/Modules/Platform/Windows-PGI-Fortran.cmake b/Modules/Platform/Windows-PGI-Fortran.cmake
new file mode 100644
index 0000000..2222e33
--- /dev/null
+++ b/Modules/Platform/Windows-PGI-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-PGI)
+__windows_compiler_pgi(Fortran)
diff --git a/Modules/Platform/Windows-PGI.cmake b/Modules/Platform/Windows-PGI.cmake
new file mode 100644
index 0000000..ad77e8a
--- /dev/null
+++ b/Modules/Platform/Windows-PGI.cmake
@@ -0,0 +1,48 @@
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__WINDOWS_COMPILER_PGI)
+  return()
+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)
+  set(CMAKE_JOB_POOL_LINK PGITaskPool)
+  set(CMAKE_JOB_POOL_COMPILE PGITaskPool)
+  get_property(_pgijp GLOBAL PROPERTY JOB_POOLS)
+  if(NOT _pgijp MATCHES "PGITaskPool=")
+      set_property(GLOBAL APPEND PROPERTY JOB_POOLS PGITaskPool=1)
+  endif()
+  unset(_pgijp)
+endif()
+
+set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1)
+set(CMAKE_LINK_DEF_FILE_FLAG "-def:")
+# The link flags for PGI are the raw filename to add a file
+# and the UNIX -L syntax to link directories.
+set(CMAKE_LINK_LIBRARY_FLAG "")
+set(CMAKE_LINK_STARTFILE "pgimain[mx][xpt]+[.]obj")
+
+# Default to Debug builds, mirroring Windows-MSVC behavior
+set(CMAKE_BUILD_TYPE_INIT Debug)
+
+if(CMAKE_VERBOSE_MAKEFILE)
+  set(CMAKE_CL_NOLOGO)
+else()
+  set(CMAKE_CL_NOLOGO "/nologo")
+endif()
+
+macro(__windows_compiler_pgi lang)
+  # Shared library compile and link rules.
+  set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
+  set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} -Mmakedll -implib:<TARGET_IMPLIB> -Xlinker -pdb:<TARGET_PDB> -Xlinker -version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+  set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}")
+  set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} -implib:<TARGET_IMPLIB> -Xlinker -pdb:<TARGET_PDB> -Xlinker -version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+
+  if("${lang}" MATCHES "C|CXX")
+    set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+  endif()
+endmacro()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a94ae96e6e1b8ef4e169c7c23cf95e0894e648cb
commit a94ae96e6e1b8ef4e169c7c23cf95e0894e648cb
Author:     Christian Pfeiffer <cpfeiffer at live.de>
AuthorDate: Fri May 12 19:07:35 2017 +0200
Commit:     Christian Pfeiffer <cpfeiffer at live.de>
CommitDate: Sat May 20 20:02:51 2017 +0200

    Windows-PGI: Adapt default compiler flags
    
    PGI demands -Bdynamic (/MD equivalent) for linking together dynamic
    libraries, so we should make it our default mirroring the settings of
    e.g. Visual C++ and Intel C++.

diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake
index bdabeba..0cbfd8a 100644
--- a/Modules/Compiler/PGI.cmake
+++ b/Modules/Compiler/PGI.cmake
@@ -18,9 +18,17 @@ macro(__compiler_pgi lang)
   string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
   string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
   string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O2 -s")
-  string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -fast -O3 -Mipa=fast")
+  string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -fast -O3")
+  # -Mipa was dropped with PGI 16.3 from Windows versions
+  if(NOT CMAKE_HOST_WIN32 OR CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 16.3)
+    string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -Mipa=fast")
+  endif()
   string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -gopt")
 
+  if(CMAKE_HOST_WIN32)
+    string(APPEND CMAKE_${lang}_FLAGS_INIT " -Bdynamic")
+  endif()
+
   # Preprocessing and assembly rules.
   set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
   set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2c2d366198118a807fe6bf1820a32c13a6648ad
commit c2c2d366198118a807fe6bf1820a32c13a6648ad
Author:     Christian Pfeiffer <cpfeiffer at live.de>
AuthorDate: Fri May 12 19:03:16 2017 +0200
Commit:     Christian Pfeiffer <cpfeiffer at live.de>
CommitDate: Sat May 20 20:02:43 2017 +0200

    ImplicitLinkInfo: Add support for PGI on Windows
    
    Since PGI does not write linker directives into objects, the necessary
    libraries have to be parsed from commandline. PGI does however link the
    Visual C++ runtime libraries, so they have to be filtered out to ensure
    no collision with settings of other languages can occur.

diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 1d0030c..3b77278 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -18,9 +18,13 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
     get_filename_component(linker ${CMAKE_LINKER} NAME)
     string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" linker "${linker}")
   endif()
+  set(startfile "CMAKE_LINK_STARTFILE-NOTFOUND")
+  if(CMAKE_LINK_STARTFILE)
+    set(startfile "${CMAKE_LINK_STARTFILE}")
+  endif()
   # Construct a regex to match linker lines.  It must match both the
   # whole line and just the command (argv[0]).
-  set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
+  set(linker_regex "^( *|.*[/\\])(${linker}|${startfile}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
   set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ")
   string(APPEND log "  link line regex: [${linker_regex}]\n")
   string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
@@ -55,9 +59,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
           string(REGEX REPLACE "^-L" "" dir "${arg}")
           list(APPEND implicit_dirs_tmp ${dir})
           string(APPEND log "    arg [${arg}] ==> dir [${dir}]\n")
-        elseif("${arg}" MATCHES "^[-/]LIBPATH:(.+)")
+        elseif("${arg}" MATCHES "^[-/](LIBPATH|libpath):(.+)")
           # MSVC search path.
-          set(dir "${CMAKE_MATCH_1}")
+          set(dir "${CMAKE_MATCH_2}")
           list(APPEND implicit_dirs_tmp ${dir})
           string(APPEND log "    arg [${arg}] ==> dir [${dir}]\n")
         elseif(is_msvc AND "${arg}" STREQUAL "-link")
@@ -79,6 +83,11 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
           # Unix library full path.
           list(APPEND implicit_libs_tmp ${arg})
           string(APPEND log "    arg [${arg}] ==> lib [${arg}]\n")
+        elseif("${arg}" MATCHES "^[-/](DEFAULTLIB|defaultlib):(.+)")
+          # Windows library.
+          set(lib "${CMAKE_MATCH_2}")
+          list(APPEND implicit_libs_tmp ${lib})
+          string(APPEND log "    arg [${arg}] ==> lib [${lib}]\n")
         elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$"
             AND obj_regex AND "${arg}" MATCHES "${obj_regex}")
           # Object file full path.
@@ -133,7 +142,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
   # We remove items that are not language-specific.
   set(implicit_libs "")
   foreach(lib IN LISTS implicit_libs_tmp)
-    if("x${lib}" MATCHES "^x(crt.*\\.o|System.*|.*libclang_rt.*)$")
+    if("x${lib}" MATCHES "^x(crt.*\\.o|System.*|.*libclang_rt.*|msvcrt.*|libvcruntime.*|libucrt.*|libcmt.*)$")
       string(APPEND log "  remove lib [${lib}]\n")
     elseif(IS_ABSOLUTE "${lib}")
       get_filename_component(abs "${lib}" ABSOLUTE)
diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
index 6aa23a3..d7d881e 100644
--- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
+++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
@@ -508,19 +508,19 @@ list(APPEND platforms cygwin_gfortran)
 
 # gcc dummy.c -v
 set(msys_gcc_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/cckQmvRt.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o")
-set(msys_gcc_libs "mingw32;gcc;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex;msvcrt")
+set(msys_gcc_libs "mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex")
 set(msys_gcc_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
 list(APPEND platforms msys_gcc)
 
 # g++ dummy.cxx -v
 set(msys_g++_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/cci5hYPk.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o")
-set(msys_g++_libs "stdc++;mingw32;gcc;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex;msvcrt")
+set(msys_g++_libs "stdc++;mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex")
 set(msys_g++_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
 list(APPEND platforms msys_g++)
 
 # g77 dummy.f -v
 set(msys_g77_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/ccabRxQ1.o -lfrtbegin -lg2c -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o")
-set(msys_g77_libs "frtbegin;g2c;mingw32;gcc;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex;msvcrt")
+set(msys_g77_libs "frtbegin;g2c;mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex")
 set(msys_g77_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
 list(APPEND platforms msys_g77)
 
@@ -532,11 +532,56 @@ set(nvcc_msvc_libs "cudadevrt.lib;cudart_static.lib")
 set(nvcc_msvc_dirs "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64")
 list(APPEND platforms nvcc_msvc)
 
+
+#-----------------------------------------------------------------------------
+# PGI on Windows
+
+# Due to the different behavior of separate_arguments on non-Windows platforms,
+# the following tests can only be performed on Windows
+if(CMAKE_HOST_WIN32)
+
+# pgf95 dummy.f90 -v
+set(windows_pgf95_text [[Writing to file C:\temp\pgf9510ipeUbTwN2V4pn.lnk
+X:\NOT-PROGRAM-FILES\PGICE/win64/17.4/lib\pgimainmx.obj C:\Program Files\PGICE/win64/17.4/lib\f90main.obj -incremental:no -debug -merge:__nv_module_id=.data -merge:.nvFatBinSegment=.data "-libpath:X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64" "-libpath:X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64" "-libpath:X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64" -libpath:X:\NOT-PROGRAM-FILES\PGICE/win64/17.4/lib C:\temp\pgf959hxeUbfMYOLjUz.obj -out:dummy.exe -pdb:./dummy.pdb /DYNAMICBASE:NO -defaultlib:libpgmp -defaultlib:pg -defaultlib:libpgf90rtl -defaultlib:libpgf90 -defaultlib:libpgf90_rpm1 -defaultlib:libpgf902 -defaultlib:libpgf90rtl -defaultlib:libpgftnrtl -nodefaultlib:msvcrt -defaultlib:libvcruntime -defaultlib:libucrt -defaultlib:libcmt -defaultlib:libpgc14 -defaultlib:libnspgc -defaultlib:legacy_stdio_definitions -defaultlib:oldnames
+
+"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64\link.exe" /NOLOGO @C:\temp\pgf9510ipeUbTwN2V4pn.lnk]])
+set(windows_pgf95_startfile "pgimain[mx][xpt]+[.]obj")
+set(windows_pgf95_libs "libpgmp;pg;libpgf90rtl;libpgf90;libpgf90_rpm1;libpgf902;libpgf90rtl;libpgftnrtl;libpgc14;libnspgc;legacy_stdio_definitions;oldnames")
+set(windows_pgf95_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib")
+list(APPEND platforms windows_pgf95)
+
+# pgf77 dummy.f77 -v
+set(windows_pgf77_text [[Writing to file C:\temp\pgf776eC42buYRoCNJk.lnk
+X:\NOT-PROGRAM-FILES\PGICE/win64/17.4/lib\pgimainmx.obj C:\Program Files\PGICE/win64/17.4/lib\pgfmain.obj -incremental:no -debug -merge:__nv_module_id=.data -merge:.nvFatBinSegment=.data "-libpath:X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64" "-libpath:X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64" "-libpath:X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64" -libpath:X:\NOT-PROGRAM-FILES\PGICE/win64/17.4/lib C:\temp\pgf775d842b0tH8AkdP.obj -out:dummy.exe -pdb:./dummy.pdb /DYNAMICBASE:NO -defaultlib:libpgmp -defaultlib:libpgftnrtl -nodefaultlib:msvcrt -defaultlib:libvcruntime -defaultlib:libucrt -defaultlib:libcmt -defaultlib:libpgc14 -defaultlib:libnspgc -defaultlib:legacy_stdio_definitions -defaultlib:oldnames
+
+"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64\link.exe" /NOLOGO @C:\temp\pgf776eC42buYRoCNJk.lnk]])
+set(windows_pgf77_startfile "pgimain[mx][xpt]+[.]obj")
+set(windows_pgf77_libs "libpgmp;libpgftnrtl;libpgc14;libnspgc;legacy_stdio_definitions;oldnames")
+set(windows_pgf77_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib")
+list(APPEND platforms windows_pgf77)
+
+# pgcc dummy.c -v
+set(windows_pgcc_text [[Writing to file C:\temp\pgcc6esqW26_ZNKyL.lnk
+X:\NOT-PROGRAM-FILES\PGICE/win64/17.4/lib\pgimainmx.obj -incremental:no -debug -merge:__nv_module_id=.data -merge:.nvFatBinSegment=.data "-libpath:X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64" "-libpath:X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64" "-libpath:X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64" -libpath:X:\NOT-PROGRAM-FILES\PGICE/win64/17.4/lib C:\temp\pgcc5dcqWgQXeXPWd.obj -out:dummy.exe -pdb:./dummy.pdb /DYNAMICBASE:NO -defaultlib:libpgmp -nodefaultlib:msvcrt -defaultlib:libvcruntime -defaultlib:libucrt -defaultlib:libcmt -defaultlib:libpgc14 -defaultlib:libnspgc -defaultlib:legacy_stdio_definitions -defaultlib:oldnames
+
+"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64\link.exe" /NOLOGO @C:\temp\pgcc6esqW26_ZNKyL.lnk]])
+set(windows_pgcc_startfile "pgimain[mx][xpt]+[.]obj")
+set(windows_pgcc_libs "libpgmp;libpgc14;libnspgc;legacy_stdio_definitions;oldnames")
+set(windows_pgcc_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib")
+list(APPEND platforms windows_pgcc)
+
+endif()
+
 #-----------------------------------------------------------------------------
 # Test parsing for all above examples.
 set(CMAKE_LINKER "not-a-linker[]().*+^$?")
 
 foreach(p IN LISTS platforms)
+  if(DEFINED ${p}_startfile)
+    set(CMAKE_LINK_STARTFILE "${${p}_startfile}")
+  else()
+    unset(CMAKE_LINK_STARTFILE)
+  endif()
   cmake_parse_implicit_link_info("${${p}_text}" libs dirs fwks log "${${p}_obj_regex}")
 
   foreach(v libs dirs fwks)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=47732280619c188da05ce5fa13527714cbe65b91
commit 47732280619c188da05ce5fa13527714cbe65b91
Author:     Florian Schmaus <flo at geekplace.eu>
AuthorDate: Fri May 19 10:59:12 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri May 19 10:51:09 2017 -0400

    UseEcos: Fix for separate <DEFINES> and <INCLUDES> placeholders
    
    Update the module to account for commit v3.4.0-rc1~342^2 (Factor an
    <INCLUDES> placeholder out of <FLAGS> in rule variables, 2015-07-13)
    and v2.6.0~537 (Create COMPILE_DEFINITIONS property for targets and
    source files, 2008-01-14).
    
    Fixes: #16904

diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
index be1dfd1..942bc38 100644
--- a/Modules/UseEcos.cmake
+++ b/Modules/UseEcos.cmake
@@ -184,8 +184,8 @@ macro(ECOS_ADD_EXECUTABLE _exe_NAME )
 # when using nmake makefiles, the custom buildtype supresses the default cl.exe flags
 # and the rules for creating objects are adjusted for gcc
    set(CMAKE_BUILD_TYPE CUSTOM_ECOS_BUILD)
-   set(CMAKE_C_COMPILE_OBJECT     "<CMAKE_C_COMPILER>   <FLAGS> -o <OBJECT> -c <SOURCE>")
-   set(CMAKE_CXX_COMPILE_OBJECT   "<CMAKE_CXX_COMPILER> <FLAGS> -o <OBJECT> -c <SOURCE>")
+   set(CMAKE_C_COMPILE_OBJECT     "<CMAKE_C_COMPILER>   <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+   set(CMAKE_CXX_COMPILE_OBJECT   "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
 # special link commands for ecos-executables
    set(CMAKE_CXX_LINK_EXECUTABLE  "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS>  -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib  -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}")
    set(CMAKE_C_LINK_EXECUTABLE    "<CMAKE_C_COMPILER>   <CMAKE_C_LINK_FLAGS>   <OBJECTS>  -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib  -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f74f01fe69a30f0b343c1b80e564cd4518c10f26
commit f74f01fe69a30f0b343c1b80e564cd4518c10f26
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu May 18 10:49:54 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri May 19 09:22:38 2017 -0400

    Check C++ features even without CMAKE_CXX_STANDARD for CMake itself
    
    When using `CMake_NO_CXX_STANDARD` a user may still provide `-std=c++11`
    or similar flags in `CMAKE_CXX_FLAGS`, so we should still check for the
    available C++ features.

diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index cd58539..458901e 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -3,10 +3,15 @@ function(cm_check_cxx_feature name)
   string(TOUPPER ${name} FEATURE)
   if(NOT DEFINED CMake_HAVE_CXX_${FEATURE})
     message(STATUS "Checking if compiler supports C++ ${name}")
+    if(CMAKE_CXX_STANDARD)
+      set(maybe_cxx_standard -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD})
+    else()
+      set(maybe_cxx_standard "")
+    endif()
     try_compile(CMake_HAVE_CXX_${FEATURE}
       ${CMAKE_CURRENT_BINARY_DIR}
       ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx
-      CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
+      CMAKE_FLAGS ${maybe_cxx_standard}
       OUTPUT_VARIABLE OUTPUT
       )
     # If using the feature causes warnings, treat it as broken/unavailable.
@@ -31,16 +36,14 @@ function(cm_check_cxx_feature name)
   endif()
 endfunction()
 
-if(CMAKE_CXX_STANDARD)
-  cm_check_cxx_feature(auto_ptr)
-  cm_check_cxx_feature(eq_delete)
-  cm_check_cxx_feature(make_unique)
-  if(CMake_HAVE_CXX_MAKE_UNIQUE)
-    set(CMake_HAVE_CXX_UNIQUE_PTR 1)
-  endif()
-  cm_check_cxx_feature(nullptr)
-  cm_check_cxx_feature(override)
-  cm_check_cxx_feature(unique_ptr)
-  cm_check_cxx_feature(unordered_map)
-  cm_check_cxx_feature(unordered_set)
+cm_check_cxx_feature(auto_ptr)
+cm_check_cxx_feature(eq_delete)
+cm_check_cxx_feature(make_unique)
+if(CMake_HAVE_CXX_MAKE_UNIQUE)
+  set(CMake_HAVE_CXX_UNIQUE_PTR 1)
 endif()
+cm_check_cxx_feature(nullptr)
+cm_check_cxx_feature(override)
+cm_check_cxx_feature(unique_ptr)
+cm_check_cxx_feature(unordered_map)
+cm_check_cxx_feature(unordered_set)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe8f08d268e0a7551e82524da8f0e38e2c04a56f
commit fe8f08d268e0a7551e82524da8f0e38e2c04a56f
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Wed May 3 13:57:02 2017 -0400
Commit:     Chuck Atkins <chuck.atkins at kitware.com>
CommitDate: Fri May 19 08:46:02 2017 -0400

    find_*: Add docs for PackageRoot search path group

diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index 2f27764..8a0fc8d 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -16,8 +16,9 @@ The general signature is:
              [PATH_SUFFIXES suffix1 [suffix2 ...]]
              [DOC "cache documentation string"]
              [NO_DEFAULT_PATH]
-             [NO_CMAKE_ENVIRONMENT_PATH]
+             [NO_PACKAGE_ROOT_PATH]
              [NO_CMAKE_PATH]
+             [NO_CMAKE_ENVIRONMENT_PATH]
              [NO_SYSTEM_ENVIRONMENT_PATH]
              [NO_CMAKE_SYSTEM_PATH]
              [CMAKE_FIND_ROOT_PATH_BOTH |
@@ -60,6 +61,10 @@ If ``NO_DEFAULT_PATH`` is specified, then no additional paths are
 added to the search.
 If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
 
+.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| replace::
+   |prefix_XXX_SUBDIR| for each ``<prefix>`` in ``PackageName_ROOT`` if called
+   from within a find module
+
 .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace::
    |prefix_XXX_SUBDIR| for each ``<prefix>`` in :variable:`CMAKE_PREFIX_PATH`
 
@@ -71,7 +76,18 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
    |prefix_XXX_SUBDIR| for each ``<prefix>`` in
    :variable:`CMAKE_SYSTEM_PREFIX_PATH`
 
-1. Search paths specified in cmake-specific cache variables.
+1. If called from within a find module, search prefix paths unique to the
+   current package being found.  Specifically look in the ``PackageName_ROOT``
+   CMake and environment variables.  The package root variables are maintained
+   as a stack so if called from nested find modules, root paths from the
+   parent's find module will be searchd after paths from the current module,
+   i.e. ``CurrentPackage_ROOT``, ``ENV{CurrentPackage_ROOT}``,
+   ``ParentPackage_ROOT``, ``ENV{ParentPacakge_ROOT}``, etc.
+   This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed.
+
+   * |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX|
+
+2. Search paths specified in cmake-specific cache variables.
    These are intended to be used on the command line with a ``-DVAR=value``.
    The values are interpreted as :ref:`;-lists <CMake Language Lists>`.
    This can be skipped if ``NO_CMAKE_PATH`` is passed.
@@ -80,7 +96,7 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
    * |CMAKE_XXX_PATH|
    * |CMAKE_XXX_MAC_PATH|
 
-2. Search paths specified in cmake-specific environment variables.
+3. Search paths specified in cmake-specific environment variables.
    These are intended to be set in the user's shell configuration,
    and therefore use the host's native path separator
    (``;`` on Windows and ``:`` on UNIX).
@@ -90,17 +106,17 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
    * |CMAKE_XXX_PATH|
    * |CMAKE_XXX_MAC_PATH|
 
-3. Search the paths specified by the ``HINTS`` option.
+4. Search the paths specified by the ``HINTS`` option.
    These should be paths computed by system introspection, such as a
    hint provided by the location of another item already found.
    Hard-coded guesses should be specified with the ``PATHS`` option.
 
-4. Search the standard system environment variables.
+5. Search the standard system environment variables.
    This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument.
 
    * |SYSTEM_ENVIRONMENT_PATH_XXX|
 
-5. Search cmake variables defined in the Platform files
+6. Search cmake variables defined in the Platform files
    for the current system.  This can be skipped if ``NO_CMAKE_SYSTEM_PATH``
    is passed.
 
@@ -108,7 +124,7 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
    * |CMAKE_SYSTEM_XXX_PATH|
    * |CMAKE_SYSTEM_XXX_MAC_PATH|
 
-6. Search the paths specified by the PATHS option
+7. Search the paths specified by the PATHS option
    or in the short-hand version of the command.
    These are typically hard-coded guesses.
 
diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst
index e56097b..2a14ad7 100644
--- a/Help/command/find_file.rst
+++ b/Help/command/find_file.rst
@@ -8,6 +8,9 @@ find_file
 .. |prefix_XXX_SUBDIR| replace:: ``<prefix>/include``
 .. |entry_XXX_SUBDIR| replace:: ``<entry>/include``
 
+.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace::
+   ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+   is set, and |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR|
 .. |CMAKE_PREFIX_PATH_XXX| replace::
    ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
    is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR|
diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst
index f774f17..0861d67 100644
--- a/Help/command/find_library.rst
+++ b/Help/command/find_library.rst
@@ -8,6 +8,9 @@ find_library
 .. |prefix_XXX_SUBDIR| replace:: ``<prefix>/lib``
 .. |entry_XXX_SUBDIR| replace:: ``<entry>/lib``
 
+.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace::
+   ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set,
+   and |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR|
 .. |CMAKE_PREFIX_PATH_XXX| replace::
    ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set,
    and |CMAKE_PREFIX_PATH_XXX_SUBDIR|
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 60a77b8..08c6ccd 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -64,8 +64,9 @@ The complete Config mode command signature is::
                [PATHS path1 [path2 ... ]]
                [PATH_SUFFIXES suffix1 [suffix2 ...]]
                [NO_DEFAULT_PATH]
-               [NO_CMAKE_ENVIRONMENT_PATH]
+               [NO_PACAKGE_ROOT_PATH]
                [NO_CMAKE_PATH]
+               [NO_CMAKE_ENVIRONMENT_PATH]
                [NO_SYSTEM_ENVIRONMENT_PATH]
                [NO_CMAKE_PACKAGE_REGISTRY]
                [NO_CMAKE_BUILDS_PATH] # Deprecated; does nothing.
@@ -249,7 +250,13 @@ The set of installation prefixes is constructed using the following
 steps.  If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are
 enabled.
 
-1. Search paths specified in cmake-specific cache variables.  These
+1. Search paths specified in the ``PackageName_ROOT`` CMake and environment
+   variables.  The package root variables are maintained as a stack so if
+   called from within a find module, root paths from the parent's find
+   module will also be searched after paths for the current package.  This can
+   be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed.
+
+2. Search paths specified in cmake-specific cache variables.  These
    are intended to be used on the command line with a ``-DVAR=value``.
    The values are interpreted as :ref:`;-lists <CMake Language Lists>`.
    This can be skipped if ``NO_CMAKE_PATH`` is passed::
@@ -258,7 +265,7 @@ enabled.
      CMAKE_FRAMEWORK_PATH
      CMAKE_APPBUNDLE_PATH
 
-2. Search paths specified in cmake-specific environment variables.
+3. Search paths specified in cmake-specific environment variables.
    These are intended to be set in the user's shell configuration,
    and therefore use the host's native path separator
    (``;`` on Windows and ``:`` on UNIX).
@@ -269,26 +276,26 @@ enabled.
      CMAKE_FRAMEWORK_PATH
      CMAKE_APPBUNDLE_PATH
 
-3. Search paths specified by the ``HINTS`` option.  These should be paths
+4. Search paths specified by the ``HINTS`` option.  These should be paths
    computed by system introspection, such as a hint provided by the
    location of another item already found.  Hard-coded guesses should
    be specified with the ``PATHS`` option.
 
-4. Search the standard system environment variables.  This can be
+5. Search the standard system environment variables.  This can be
    skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed.  Path entries
    ending in ``/bin`` or ``/sbin`` are automatically converted to their
    parent directories::
 
      PATH
 
-5. Search paths stored in the CMake :ref:`User Package Registry`.
+6. Search paths stored in the CMake :ref:`User Package Registry`.
    This can be skipped if ``NO_CMAKE_PACKAGE_REGISTRY`` is passed or by
    setting the :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY`
    to ``TRUE``.
    See the :manual:`cmake-packages(7)` manual for details on the user
    package registry.
 
-6. Search cmake variables defined in the Platform files for the
+7. Search cmake variables defined in the Platform files for the
    current system.  This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is
    passed::
 
@@ -296,14 +303,14 @@ enabled.
      CMAKE_SYSTEM_FRAMEWORK_PATH
      CMAKE_SYSTEM_APPBUNDLE_PATH
 
-7. Search paths stored in the CMake :ref:`System Package Registry`.
+8. Search paths stored in the CMake :ref:`System Package Registry`.
    This can be skipped if ``NO_CMAKE_SYSTEM_PACKAGE_REGISTRY`` is passed
    or by setting the
    :variable:`CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY` to ``TRUE``.
    See the :manual:`cmake-packages(7)` manual for details on the system
    package registry.
 
-8. Search paths specified by the ``PATHS`` option.  These are typically
+9. Search paths specified by the ``PATHS`` option.  These are typically
    hard-coded guesses.
 
 .. |FIND_XXX| replace:: find_package
diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst
index 76342d0..988a3fa 100644
--- a/Help/command/find_path.rst
+++ b/Help/command/find_path.rst
@@ -8,6 +8,9 @@ find_path
 .. |prefix_XXX_SUBDIR| replace:: ``<prefix>/include``
 .. |entry_XXX_SUBDIR| replace:: ``<entry>/include``
 
+.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace::
+   ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+   is set, and |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR|
 .. |CMAKE_PREFIX_PATH_XXX| replace::
    ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
    is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR|
diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst
index d3430c0..4f00773 100644
--- a/Help/command/find_program.rst
+++ b/Help/command/find_program.rst
@@ -8,6 +8,8 @@ find_program
 .. |prefix_XXX_SUBDIR| replace:: ``<prefix>/[s]bin``
 .. |entry_XXX_SUBDIR| replace:: ``<entry>/[s]bin``
 
+.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace::
+   |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR|
 .. |CMAKE_PREFIX_PATH_XXX| replace::
    |CMAKE_PREFIX_PATH_XXX_SUBDIR|
 .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_PROGRAM_PATH`
diff --git a/Help/release/dev/PackageRoot-search-path-group.rst b/Help/release/dev/PackageRoot-search-path-group.rst
new file mode 100644
index 0000000..4fb8237
--- /dev/null
+++ b/Help/release/dev/PackageRoot-search-path-group.rst
@@ -0,0 +1,8 @@
+PackageRoot search path group
+-----------------------------
+
+* All ``find_`` commands now have a `PACKAGE_ROOT` search path group that is
+  first in the search heuristics.  If the ``find_`` command is called from
+  inside a find module, then the CMake and environment variables
+  ``<PackageName>_ROOT`` are used as prefixes and are the first set of paths
+  that are searched.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57744ca9c0119fccbb89d08f5ef34394b4df1a81
commit 57744ca9c0119fccbb89d08f5ef34394b4df1a81
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Thu May 11 15:59:30 2017 -0400
Commit:     Chuck Atkins <chuck.atkins at kitware.com>
CommitDate: Tue May 16 15:19:45 2017 -0400

    find_*: Add tests for PackageRoot search path group

diff --git a/Tests/RunCMake/find_package/PackageRoot-stderr.txt b/Tests/RunCMake/find_package/PackageRoot-stderr.txt
new file mode 100644
index 0000000..07b27bd
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot-stderr.txt
@@ -0,0 +1,319 @@
+Foo_ROOT      :
+ENV{Foo_ROOT} :
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :
+Bar_ROOT      :
+ENV{Bar_ROOT} :
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
+BAR_TEST_FILE_BAR :BAR_TEST_FILE_BAR-NOTFOUND
+BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
+BAR_TEST_PATH_BAR :BAR_TEST_PATH_BAR-NOTFOUND
+BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_PROG_BAR :BAR_TEST_PROG_BAR-NOTFOUND
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_ROOT      :
+ENV{Bar_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+Bar_ROOT      :
+ENV{Bar_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/foo/env_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/foo/env_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/foo/env_root/bin/bar.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+Bar_ROOT      :
+ENV{Bar_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :
+Bar_ROOT      :.*/PackageRoot/bar/cmake_root
+ENV{Bar_ROOT} :
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :
+Bar_ROOT      :
+ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
+BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
+BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :
+Bar_ROOT      :.*/PackageRoot/bar/cmake_root
+ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_ROOT      :.*/PackageRoot/bar/cmake_root
+ENV{Bar_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+Bar_ROOT      :.*/PackageRoot/bar/cmake_root
+ENV{Bar_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+Bar_ROOT      :.*/PackageRoot/bar/cmake_root
+ENV{Bar_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_ROOT      :
+ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+Bar_ROOT      :
+ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+Bar_ROOT      :
+ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_ROOT      :.*/PackageRoot/bar/cmake_root
+ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+
+Foo_ROOT      :
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+Bar_ROOT      :.*/PackageRoot/bar/cmake_root
+ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+
+Foo_ROOT      :.*/PackageRoot/foo/cmake_root
+ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
+Bar_ROOT      :.*/PackageRoot/bar/cmake_root
+ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
+FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/PackageRoot.cmake
new file mode 100644
index 0000000..d9f41f8
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot.cmake
@@ -0,0 +1,143 @@
+cmake_policy(SET CMP0057 NEW)
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+
+macro(CleanUpPackageRootTest)
+  unset(Foo_ROOT)
+  unset(ENV{Foo_ROOT})
+  unset(Bar_ROOT)
+  unset(ENV{Bar_ROOT})
+  unset(FOO_TEST_FILE_FOO)
+  unset(FOO_TEST_PATH_FOO)
+  unset(FOO_TEST_PROG_FOO)
+  unset(BAR_TEST_FILE_FOO)
+  unset(BAR_TEST_FILE_BAR)
+  unset(BAR_TEST_PATH_FOO)
+  unset(BAR_TEST_PATH_BAR)
+  unset(BAR_TEST_PROG_FOO)
+  unset(BAR_TEST_PROG_BAR)
+  unset(FOO_TEST_FILE_FOO CACHE)
+  unset(FOO_TEST_PATH_FOO CACHE)
+  unset(FOO_TEST_PROG_FOO CACHE)
+  unset(BAR_TEST_FILE_FOO CACHE)
+  unset(BAR_TEST_FILE_BAR CACHE)
+  unset(BAR_TEST_PATH_FOO CACHE)
+  unset(BAR_TEST_PATH_BAR CACHE)
+  unset(BAR_TEST_PROG_FOO CACHE)
+  unset(BAR_TEST_PROG_BAR CACHE)
+endmacro()
+
+macro(RunPackageRootTest)
+  set(orig_foo_cmake_root ${Foo_ROOT})
+  set(orig_foo_env_root   $ENV{Foo_ROOT})
+  set(orig_bar_cmake_root ${Bar_ROOT})
+  set(orig_bar_env_root   $ENV{Bar_ROOT})
+
+  find_package(Foo)
+  message("Foo_ROOT      :${Foo_ROOT}")
+  message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
+  message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
+  message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
+  message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
+  CleanUpPackageRootTest()
+  message("")
+
+  set(Foo_ROOT      ${orig_foo_cmake_root})
+  set(ENV{Foo_ROOT} ${orig_foo_env_root})
+  set(Bar_ROOT      ${orig_bar_cmake_root})
+  set(ENV{Bar_ROOT} ${orig_bar_env_root})
+
+  find_package(Foo COMPONENTS Bar)
+  message("Foo_ROOT      :${Foo_ROOT}")
+  message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
+  message("Bar_ROOT      :${Bar_ROOT}")
+  message("ENV{Bar_ROOT} :$ENV{Bar_ROOT}")
+  message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
+  message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
+  message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
+  message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}")
+  message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}")
+  message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}")
+  message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}")
+  message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}")
+  message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}")
+  CleanUpPackageRootTest()
+  message("")
+
+  unset(orig_foo_cmake_root)
+  unset(orig_foo_env_root)
+  unset(orig_bar_cmake_root)
+  unset(orig_bar_env_root)
+endmacro()
+
+RunPackageRootTest()
+
+set(Foo_ROOT      ${PackageRoot_BASE}/foo/cmake_root)
+RunPackageRootTest()
+
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT      ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+RunPackageRootTest()
+
+##
+
+set(Bar_ROOT      ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Bar_ROOT      ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+##
+
+set(Foo_ROOT      ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT      ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+set(Bar_ROOT      ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT      ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+set(Bar_ROOT      ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+##
+
+set(Foo_ROOT      ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT      ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+##
+
+set(Foo_ROOT      ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT      ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+set(Bar_ROOT      ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT      ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+set(Bar_ROOT      ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
diff --git a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake
new file mode 100644
index 0000000..eefa49c
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake
@@ -0,0 +1,6 @@
+find_file(BAR_TEST_FILE_FOO foo.h)
+find_file(BAR_TEST_FILE_BAR bar.h)
+find_path(BAR_TEST_PATH_FOO foo.h)
+find_path(BAR_TEST_PATH_BAR bar.h)
+find_program(BAR_TEST_PROG_FOO foo.exe)
+find_program(BAR_TEST_PROG_BAR bar.exe)
diff --git a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake
new file mode 100644
index 0000000..cb62390
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake
@@ -0,0 +1,7 @@
+find_file(FOO_TEST_FILE_FOO foo.h)
+find_path(FOO_TEST_PATH_FOO foo.h)
+find_program(FOO_TEST_PROG_FOO foo.exe)
+
+if ("Bar" IN_LIST Foo_FIND_COMPONENTS)
+  find_package(Bar)
+endif ()
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe
new file mode 100755
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe
new file mode 100755
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe
new file mode 100755
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe
new file mode 100755
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe
new file mode 100755
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe
new file mode 100755
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 81b2906..72f9c4d 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -13,6 +13,7 @@ run_cmake(MissingConfigOneName)
 run_cmake(MissingConfigRequired)
 run_cmake(MissingConfigVersion)
 run_cmake(MixedModeOptions)
+run_cmake(PackageRoot)
 run_cmake(PolicyPush)
 run_cmake(PolicyPop)
 run_cmake(SetFoundFALSE)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef3d360a3de4a290c92c34827a3b68a8ce160840
commit ef3d360a3de4a290c92c34827a3b68a8ce160840
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Wed May 3 13:56:03 2017 -0400
Commit:     Chuck Atkins <chuck.atkins at kitware.com>
CommitDate: Tue May 16 15:19:40 2017 -0400

    find_*: Add a new PackageRoot search path group
    
    The new PackageRoot search path group allows the PackageName_ROOT cmake
    and environment variables to be used as search prefixes for all find_*
    commands called from within a find module

diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 068dcfc..581c401 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -3,7 +3,9 @@
 #include "cmFindBase.h"
 
 #include "cmConfigure.h"
+#include <deque>
 #include <iostream>
+#include <iterator>
 #include <map>
 #include <stddef.h>
 
@@ -158,6 +160,9 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
 void cmFindBase::ExpandPaths()
 {
   if (!this->NoDefaultPath) {
+    if (!this->NoPackageRootPath) {
+      this->FillPackageRootPath();
+    }
     if (!this->NoCMakePath) {
       this->FillCMakeVariablePath();
     }
@@ -196,6 +201,23 @@ void cmFindBase::FillCMakeEnvironmentPath()
   paths.AddSuffixes(this->SearchPathSuffixes);
 }
 
+void cmFindBase::FillPackageRootPath()
+{
+  cmSearchPath& paths = this->LabeledPaths[PathLabel::PackageRoot];
+
+  // Add package specific search prefixes
+  // NOTE: This should be using const_reverse_iterator but HP aCC and
+  //       Oracle sunCC both currently have standard library issues
+  //       with the reverse iterator APIs.
+  for (std::deque<std::string>::reverse_iterator pkg =
+         this->Makefile->FindPackageModuleStack.rbegin();
+       pkg != this->Makefile->FindPackageModuleStack.rend(); ++pkg) {
+    std::string varName = *pkg + "_ROOT";
+    paths.AddCMakePrefixPath(varName);
+    paths.AddEnvPrefixPath(varName);
+  }
+}
+
 void cmFindBase::FillCMakeVariablePath()
 {
   cmSearchPath& paths = this->LabeledPaths[PathLabel::CMake];
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 81494f1..88b5b6c 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -50,6 +50,7 @@ protected:
 
 private:
   // Add pieces of the search.
+  void FillPackageRootPath();
   void FillCMakeVariablePath();
   void FillCMakeEnvironmentPath();
   void FillUserHintsPath();
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index df57a1b..e8ae20f 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -10,6 +10,8 @@
 #include "cmSystemTools.h"
 
 cmFindCommon::PathGroup cmFindCommon::PathGroup::All("ALL");
+cmFindCommon::PathLabel cmFindCommon::PathLabel::PackageRoot(
+  "PacakgeName_ROOT");
 cmFindCommon::PathLabel cmFindCommon::PathLabel::CMake("CMAKE");
 cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeEnvironment(
   "CMAKE_ENVIRONMENT");
@@ -23,6 +25,7 @@ cmFindCommon::cmFindCommon()
 {
   this->FindRootPathMode = RootPathModeBoth;
   this->NoDefaultPath = false;
+  this->NoPackageRootPath = false;
   this->NoCMakePath = false;
   this->NoCMakeEnvironmentPath = false;
   this->NoSystemEnvironmentPath = false;
@@ -57,6 +60,7 @@ void cmFindCommon::InitializeSearchPathGroups()
 
   // All search paths
   labels = &this->PathGroupLabelMap[PathGroup::All];
+  labels->push_back(PathLabel::PackageRoot);
   labels->push_back(PathLabel::CMake);
   labels->push_back(PathLabel::CMakeEnvironment);
   labels->push_back(PathLabel::Hints);
@@ -69,6 +73,8 @@ void cmFindCommon::InitializeSearchPathGroups()
 
   // Create the idividual labeld search paths
   this->LabeledPaths.insert(
+    std::make_pair(PathLabel::PackageRoot, cmSearchPath(this)));
+  this->LabeledPaths.insert(
     std::make_pair(PathLabel::CMake, cmSearchPath(this)));
   this->LabeledPaths.insert(
     std::make_pair(PathLabel::CMakeEnvironment, cmSearchPath(this)));
@@ -271,10 +277,12 @@ bool cmFindCommon::CheckCommonArgument(std::string const& arg)
 {
   if (arg == "NO_DEFAULT_PATH") {
     this->NoDefaultPath = true;
-  } else if (arg == "NO_CMAKE_ENVIRONMENT_PATH") {
-    this->NoCMakeEnvironmentPath = true;
+  } else if (arg == "NO_PACKAGE_ROOT_PATH") {
+    this->NoPackageRootPath = true;
   } else if (arg == "NO_CMAKE_PATH") {
     this->NoCMakePath = true;
+  } else if (arg == "NO_CMAKE_ENVIRONMENT_PATH") {
+    this->NoCMakeEnvironmentPath = true;
   } else if (arg == "NO_SYSTEM_ENVIRONMENT_PATH") {
     this->NoSystemEnvironmentPath = true;
   } else if (arg == "NO_CMAKE_SYSTEM_PATH") {
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index bbb7a38..2eed47b 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -55,6 +55,7 @@ protected:
       : cmPathLabel(label)
     {
     }
+    static PathLabel PackageRoot;
     static PathLabel CMake;
     static PathLabel CMakeEnvironment;
     static PathLabel Hints;
@@ -105,6 +106,7 @@ protected:
   void AddPathSuffix(std::string const& arg);
 
   bool NoDefaultPath;
+  bool NoPackageRootPath;
   bool NoCMakePath;
   bool NoCMakeEnvironmentPath;
   bool NoSystemEnvironmentPath;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 17fa92c..6f6a3f6 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -10,6 +10,7 @@
 #include "cmsys/String.h"
 #include <algorithm>
 #include <assert.h>
+#include <deque>
 #include <functional>
 #include <iterator>
 #include <sstream>
@@ -585,6 +586,9 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components)
     exact += "_FIND_VERSION_EXACT";
     this->AddFindDefinition(exact, this->VersionExact ? "1" : "0");
   }
+
+  // Push on to the pacakge stack
+  this->Makefile->FindPackageModuleStack.push_back(this->Name);
 }
 
 void cmFindPackageCommand::AddFindDefinition(const std::string& var,
@@ -1059,6 +1063,9 @@ void cmFindPackageCommand::AppendSuccessInformation()
 
   // Restore original state of "_FIND_" variables we set.
   this->RestoreFindDefinitions();
+
+  // Pop the package stack
+  this->Makefile->FindPackageModuleStack.pop_back();
 }
 
 void cmFindPackageCommand::ComputePrefixes()
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 52a6498..6dc30ce 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -6,6 +6,7 @@
 #include "cmConfigure.h"
 
 #include "cmsys/RegularExpression.hxx"
+#include <deque>
 #include <map>
 #include <set>
 #include <stack>
@@ -786,6 +787,10 @@ public:
   void RemoveExportBuildFileGeneratorCMP0024(cmExportBuildFileGenerator* gen);
   void AddExportBuildFileGenerator(cmExportBuildFileGenerator* gen);
 
+  // Maintain a stack of pacakge names to determine the depth of find modules
+  // we are currently being called with
+  std::deque<std::string> FindPackageModuleStack;
+
 protected:
   // add link libraries and directories to the target
   void AddGlobalLinkInformation(cmTarget& target);

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

Summary of changes:
 Help/command/FIND_XXX.txt                          |   30 +-
 Help/command/find_file.rst                         |    3 +
 Help/command/find_library.rst                      |    3 +
 Help/command/find_package.rst                      |   25 +-
 Help/command/find_path.rst                         |    3 +
 Help/command/find_program.rst                      |    2 +
 Help/release/dev/PackageRoot-search-path-group.rst |    8 +
 Modules/CMakeFindBinUtils.cmake                    |    4 +
 Modules/CMakeParseImplicitLinkInfo.cmake           |   17 +-
 Modules/Compiler/PGI.cmake                         |   10 +-
 Modules/Platform/Windows-PGI-C.cmake               |    2 +
 Modules/Platform/Windows-PGI-Fortran.cmake         |    2 +
 Modules/Platform/Windows-PGI.cmake                 |   48 +++
 Modules/UseEcos.cmake                              |    4 +-
 Source/Checks/cm_cxx_features.cmake                |   29 +-
 Source/cmFindBase.cxx                              |   22 ++
 Source/cmFindBase.h                                |    1 +
 Source/cmFindCommon.cxx                            |   12 +-
 Source/cmFindCommon.h                              |    2 +
 Source/cmFindPackageCommand.cxx                    |    7 +
 Source/cmMakefile.h                                |    5 +
 Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in     |   51 +++-
 Tests/RunCMake/find_package/PackageRoot-stderr.txt |  319 ++++++++++++++++++++
 Tests/RunCMake/find_package/PackageRoot.cmake      |  143 +++++++++
 .../find_package/PackageRoot/FindBar.cmake         |    6 +
 .../find_package/PackageRoot/FindFoo.cmake         |    7 +
 .../PackageRoot/bar/cmake_root/bin/bar.exe         |    0
 .../PackageRoot/bar/cmake_root/include/bar.h       |    0
 .../PackageRoot/bar/env_root/bin/bar.exe           |    0
 .../PackageRoot/bar/env_root/include/bar.h         |    0
 .../PackageRoot/foo/cmake_root/bin/bar.exe         |    0
 .../PackageRoot/foo/cmake_root/bin/foo.exe         |    0
 .../PackageRoot/foo/cmake_root/include/bar.h       |    0
 .../PackageRoot/foo/cmake_root/include/foo.h       |    0
 .../PackageRoot/foo/env_root/bin/bar.exe           |    0
 .../PackageRoot/foo/env_root/bin/foo.exe           |    0
 .../PackageRoot/foo/env_root/include/bar.h         |    0
 .../PackageRoot/foo/env_root/include/foo.h         |    0
 Tests/RunCMake/find_package/RunCMakeTest.cmake     |    1 +
 39 files changed, 725 insertions(+), 41 deletions(-)
 create mode 100644 Help/release/dev/PackageRoot-search-path-group.rst
 create mode 100644 Modules/Platform/Windows-PGI-C.cmake
 create mode 100644 Modules/Platform/Windows-PGI-Fortran.cmake
 create mode 100644 Modules/Platform/Windows-PGI.cmake
 create mode 100644 Tests/RunCMake/find_package/PackageRoot-stderr.txt
 create mode 100644 Tests/RunCMake/find_package/PackageRoot.cmake
 create mode 100644 Tests/RunCMake/find_package/PackageRoot/FindBar.cmake
 create mode 100644 Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe (100%)
 mode change 100644 => 100755
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h (100%)
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe (100%)
 mode change 100644 => 100755
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h (100%)
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe (100%)
 mode change 100644 => 100755
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe (100%)
 mode change 100644 => 100755
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h (100%)
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h (100%)
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe (100%)
 mode change 100644 => 100755
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe (100%)
 mode change 100644 => 100755
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h (100%)
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list