From 7a6e5f06e7a32c894313b3a07c3d3c9abad8d2ca Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Sep 2015 14:49:49 -0400 Subject: [PATCH] Tests: Cover find_program when the environment duplicate some HINTS Reported-by: Marc CHEVRIER --- Tests/RunCMake/find_program/A/testAandB | 1 + Tests/RunCMake/find_program/B/testAandB | 1 + Tests/RunCMake/find_program/EnvAndHints-stdout.txt | 1 + Tests/RunCMake/find_program/EnvAndHints.cmake | 8 ++++++++ Tests/RunCMake/find_program/RunCMakeTest.cmake | 1 + 5 files changed, 12 insertions(+) create mode 100755 Tests/RunCMake/find_program/A/testAandB create mode 100755 Tests/RunCMake/find_program/B/testAandB create mode 100644 Tests/RunCMake/find_program/EnvAndHints-stdout.txt create mode 100644 Tests/RunCMake/find_program/EnvAndHints.cmake diff --git a/Tests/RunCMake/find_program/A/testAandB b/Tests/RunCMake/find_program/A/testAandB new file mode 100755 index 000000000..1a2485251 --- /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 000000000..1a2485251 --- /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 000000000..39329b22e --- /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 000000000..14ebd6e2f --- /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 2adec1100..89307c1ae 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)