summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/UnityBuild/unitybuild_c_relocatable_path-check.cmake
blob: f8e41ceb67a3d7efa8d965375b7dcbf7fda051e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c.c")
if(NOT EXISTS "${unitybuild_c}")
  set(RunCMake_TEST_FAILED "Generated unity source file ${unitybuild_c} does not exist.")
  return()
endif()

string(JOIN ".*" EXPECTED_UNITY_FILE_CONTENT
  [[#include "\.\./\.\./\.\./s1\.c"]]
  [[#include "\.\./\.\./\.\./s2\.c"]]
  [[#include "\.\./\.\./\.\./s3\.c"]]
)

file(STRINGS ${unitybuild_c} unitybuild_c_strings)
if(NOT unitybuild_c_strings MATCHES "${EXPECTED_UNITY_FILE_CONTENT}")
  set(RunCMake_TEST_FAILED "Generated unity file ${unitybuild_c} doesn't contain relative paths")
  return()
endif()