changeset 659:b52774f02cdc

cmake: pass an extra #define to test files built to process input files This will let us combine test.c and test-file.c. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sun, 10 Feb 2019 21:40:59 -0500
parents 27606cab9971
children eb3d260023b8
files cmake/test.cmake
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cmake/test.cmake	Sun Feb 10 21:26:23 2019 -0500
+++ b/cmake/test.cmake	Sun Feb 10 21:40:59 2019 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+# Copyright (c) 2016-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -40,6 +40,14 @@
 	)
 endmacro()
 
+macro(build_test_bin_files name)
+	build_test_bin(${name})
+
+	set_source_files_properties("test_${name}.c" PROPERTIES
+		COMPILE_FLAGS "-DUSE_FILENAME_ARGS"
+	)
+endmacro()
+
 macro(build_test_bin_and_run name)
 	build_test_bin(${name})
 	add_test(NAME "${name}"
@@ -51,7 +59,7 @@
 endmacro()
 
 macro(build_test_bin_and_run_files name files)
-	build_test_bin(${name})
+	build_test_bin_files(${name})
 	file(GLOB TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${files})
 	foreach(TEST ${TESTS})
 		add_test(NAME "${name}:${TEST}"