summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/UnityBuild/f.cxx5
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_anon_ns-build-check.cmake10
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_anon_ns.cmake2
3 files changed, 16 insertions, 1 deletions
diff --git a/Tests/RunCMake/UnityBuild/f.cxx b/Tests/RunCMake/UnityBuild/f.cxx
new file mode 100644
index 0000000..d5813c6
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/f.cxx
@@ -0,0 +1,5 @@
+int f(int x)
+{
+ (void)x;
+ return 0;
+}
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_anon_ns-build-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns-build-check.cmake
new file mode 100644
index 0000000..746be32
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns-build-check.cmake
@@ -0,0 +1,10 @@
+set(unitybuild_0 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_cxx.cxx")
+
+file(STRINGS ${unitybuild_0} src)
+
+foreach(expectedRegex IN ITEMS "SRC_f\\.cxx" "BLD_s1\\.cpp")
+ if(NOT "${src}" MATCHES "${expectedRegex}")
+ set(RunCMake_TEST_FAILED "Generated unity file doesn't have a match for expected unity ID regex ${expectedRegex}")
+ return()
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_anon_ns.cmake b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns.cmake
index 6f4878f..e05863d 100644
--- a/Tests/RunCMake/UnityBuild/unitybuild_anon_ns.cmake
+++ b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns.cmake
@@ -4,7 +4,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/unitybuild_anon_ns_test_files.cmake)
write_unity_build_anon_ns_test_files(srcs)
-add_library(tgt SHARED ${srcs})
+add_library(tgt SHARED f.cxx ${srcs})
set_target_properties(tgt PROPERTIES UNITY_BUILD ON)