summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeTests/StringTestScript.cmake
diff options
context:
space:
mode:
authorArtur Ryt <artur.ryt@gmail.com>2018-11-30 22:50:37 (GMT)
committerBrad King <brad.king@kitware.com>2018-12-12 13:29:01 (GMT)
commitdda4755b467db297b04cc1678e0d7c6035ad4c2f (patch)
treebc35dcc0b1c7aff6381862d2028daf71b16a94ae /Tests/CMakeTests/StringTestScript.cmake
parent654fdd8374a4447dc65589eb55b39323384fbc60 (diff)
downloadCMake-dda4755b467db297b04cc1678e0d7c6035ad4c2f.zip
CMake-dda4755b467db297b04cc1678e0d7c6035ad4c2f.tar.gz
CMake-dda4755b467db297b04cc1678e0d7c6035ad4c2f.tar.bz2
cmMakefile: Fix ConfigureString not passing filename and line
It enables to use CMAKE_CURRENT_LIST_LINE in string(CONFIGURE) Added tests for it for ${} and @@ notattion for old CMP0053 and ${} for new
Diffstat (limited to 'Tests/CMakeTests/StringTestScript.cmake')
-rw-r--r--Tests/CMakeTests/StringTestScript.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake
index 44d5653..d8f31dd 100644
--- a/Tests/CMakeTests/StringTestScript.cmake
+++ b/Tests/CMakeTests/StringTestScript.cmake
@@ -1,5 +1,18 @@
message(STATUS "testname='${testname}'")
+function(test_configure_line_number EXPRESSION POLICY)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0053 ${POLICY})
+ string(CONFIGURE
+ "${EXPRESSION}" v) # line should indicate string() call
+ math(EXPR vplus3 "${v} + 3")
+ if(NOT ${CMAKE_CURRENT_LIST_LINE} EQUAL ${vplus3})
+ message(SEND_ERROR "Couldn't configure CMAKE_CURRENT_LIST_LINE, evaluated into '${v}'")
+ endif()
+ message(STATUS "v='${v}'")
+ cmake_policy(POP)
+endfunction()
+
if(testname STREQUAL empty) # fail
string()
@@ -32,6 +45,15 @@ elseif(testname STREQUAL configure_escape_quotes) # pass
string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES)
message(STATUS "v='${v}'")
+elseif(testname STREQUAL configure_line_number_CMP0053_old) # pass
+ test_configure_line_number("\${CMAKE_CURRENT_LIST_LINE}" OLD)
+
+elseif(testname STREQUAL configure_line_number_CMP0053_new) # pass
+ test_configure_line_number("\${CMAKE_CURRENT_LIST_LINE}" NEW)
+
+elseif(testname STREQUAL configure_line_number_CMP0053_old_use_at) # pass
+ test_configure_line_number("\@CMAKE_CURRENT_LIST_LINE\@" OLD)
+
elseif(testname STREQUAL configure_bogus) # fail
string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES BOGUS)