summaryrefslogtreecommitdiffstats
path: root/Tests/FindPackageTest/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-05-08 13:48:21 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-12 13:44:28 (GMT)
commitac24a1c031a5ccb01c2a978655757e71c3f9acba (patch)
tree38f2326d20e1a4ef06ecaf70dbffc23c3085e7e3 /Tests/FindPackageTest/CMakeLists.txt
parentc010e7cc806d845f1b048bc8c41d2c1326075beb (diff)
downloadCMake-ac24a1c031a5ccb01c2a978655757e71c3f9acba.zip
CMake-ac24a1c031a5ccb01c2a978655757e71c3f9acba.tar.gz
CMake-ac24a1c031a5ccb01c2a978655757e71c3f9acba.tar.bz2
Tests: Improve FindPackageTest exported package version
Add a random version component so that the test is unlikely to conflict with other tests of the same CMake version on the same machine.
Diffstat (limited to 'Tests/FindPackageTest/CMakeLists.txt')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index a77713f..fc82a1e 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -320,16 +320,23 @@ endif()
#-----------------------------------------------------------------------------
# Test export(PACKAGE) with find_package.
+
+# Choose a unique version.
+string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
+string(RANDOM LENGTH 4 ALPHABET "0123456789" v)
+set(version "${version}.${v}")
+
message(STATUS "Preparing export(PACKAGE) test project")
try_compile(EXPORTER_COMPILED
${FindPackageTest_BINARY_DIR}/Exporter
${FindPackageTest_SOURCE_DIR}/Exporter
CMakeTestExportPackage dummy
+ CMAKE_FLAGS
+ -Dversion=${version}
OUTPUT_VARIABLE output)
message(STATUS "Searching for export(PACKAGE) test project")
set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
"Wipe out find results for testing." FORCE)
-string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
#-----------------------------------------------------------------------------