Suprisingly "new-style" tests support generater expressions
also within all test properties. Add a test for that.

Signed-off-by: Gregor Jasny <gja...@googlemail.com>
---
 Tests/Environment/CMakeLists.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Tests/Environment/CMakeLists.txt b/Tests/Environment/CMakeLists.txt
index 2b18d24..1cccc3d 100644
--- a/Tests/Environment/CMakeLists.txt
+++ b/Tests/Environment/CMakeLists.txt
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6)
 project(EnvironmentProj)
 
 add_executable(Environment main.cxx)
+set_property(TARGET Environment PROPERTY FOO Bar)
 
 enable_testing()
 
@@ -24,3 +25,14 @@ set_tests_properties(Environment1 EchoEnvironment1 PROPERTIES
 set_tests_properties(Environment2 EchoEnvironment2 PROPERTIES
   FAIL_REGULAR_EXPRESSION "CMAKE_ENV.*Happy Thanksgiving"
 )
+
+# Test with generator expression
+# Note: this requires a "new-style" add_test signature
+#
+add_test(NAME Environment3 COMMAND Environment)
+add_test(NAME EchoEnvironment3 COMMAND ${CMAKE_COMMAND} -E environment)
+
+set_tests_properties(Environment3 EchoEnvironment3 PROPERTIES
+  ENVIRONMENT "CMAKE_ENVIRONMENT_TEST_VAR=$<TARGET_PROPERTY:Environment,FOO>"
+  PASS_REGULAR_EXPRESSION "CMAKE_ENV.*Bar"
+)
-- 
2.3.0

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to