diff options
author | Brad King <brad.king@kitware.com> | 2015-09-16 12:47:25 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-09-16 12:47:25 (GMT) |
commit | 982850a86698d41d6998b4d538c128949570efdf (patch) | |
tree | 820b6fcf2c6e8bfeb67edb97cd331ed766bbc724 | |
parent | 0ec62015471eee37cb99765578e0db8b2f633350 (diff) | |
parent | 7a6e5f06e7a32c894313b3a07c3d3c9abad8d2ca (diff) | |
download | CMake-982850a86698d41d6998b4d538c128949570efdf.zip CMake-982850a86698d41d6998b4d538c128949570efdf.tar.gz CMake-982850a86698d41d6998b4d538c128949570efdf.tar.bz2 |
Merge topic 'test-search-ordering'
7a6e5f06 Tests: Cover find_program when the environment duplicate some HINTS
40122975 Merge branch 'fix-bad-search-ordering' into test-search-ordering
02440154 find_*: Fix search order when the environment duplicates some HINTS
-rw-r--r-- | Source/cmFindBase.cxx | 6 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 5 | ||||
-rwxr-xr-x | Tests/RunCMake/find_program/A/testAandB | 1 | ||||
-rwxr-xr-x | Tests/RunCMake/find_program/B/testAandB | 1 | ||||
-rw-r--r-- | Tests/RunCMake/find_program/EnvAndHints-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/find_program/EnvAndHints.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/find_program/RunCMakeTest.cmake | 1 |
7 files changed, 20 insertions, 3 deletions
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 7959ffe..fa9b381 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -207,6 +207,10 @@ void cmFindBase::ExpandPaths() { this->FillCMakeEnvironmentPath(); } + } + this->FillUserHintsPath(); + if(!this->NoDefaultPath) + { if(!this->NoSystemEnvironmentPath) { this->FillSystemEnvironmentPath(); @@ -216,8 +220,6 @@ void cmFindBase::ExpandPaths() this->FillCMakeSystemVariablePath(); } } - - this->FillUserHintsPath(); this->FillUserGuessPath(); } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 9b9071d..64176e7 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1133,6 +1133,10 @@ void cmFindPackageCommand::ComputePrefixes() { this->FillPrefixesCMakeEnvironment(); } + } + this->FillPrefixesUserHints(); + if(!this->NoDefaultPath) + { if(!this->NoSystemEnvironmentPath) { this->FillPrefixesSystemEnvironment(); @@ -1150,7 +1154,6 @@ void cmFindPackageCommand::ComputePrefixes() this->FillPrefixesSystemRegistry(); } } - this->FillPrefixesUserHints(); this->FillPrefixesUserGuess(); this->ComputeFinalPaths(); diff --git a/Tests/RunCMake/find_program/A/testAandB b/Tests/RunCMake/find_program/A/testAandB new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/Tests/RunCMake/find_program/A/testAandB @@ -0,0 +1 @@ +#!/bin/sh diff --git a/Tests/RunCMake/find_program/B/testAandB b/Tests/RunCMake/find_program/B/testAandB new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/Tests/RunCMake/find_program/B/testAandB @@ -0,0 +1 @@ +#!/bin/sh diff --git a/Tests/RunCMake/find_program/EnvAndHints-stdout.txt b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt new file mode 100644 index 0000000..39329b2 --- /dev/null +++ b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt @@ -0,0 +1 @@ +-- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB' diff --git a/Tests/RunCMake/find_program/EnvAndHints.cmake b/Tests/RunCMake/find_program/EnvAndHints.cmake new file mode 100644 index 0000000..14ebd6e --- /dev/null +++ b/Tests/RunCMake/find_program/EnvAndHints.cmake @@ -0,0 +1,8 @@ +set(ENV_PATH "$ENV{PATH}") +set(ENV{PATH} ${CMAKE_CURRENT_SOURCE_DIR}/A) +find_program(PROG + NAMES testAandB + HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B + ) +message(STATUS "PROG='${PROG}'") +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 2adec11..89307c1 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(EnvAndHints) run_cmake(DirsPerName) run_cmake(NamesPerDir) |