aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2019-10-07 20:27:57 -0400
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-11-27 21:12:55 +0100
commit8efbcb1e80d58fa39501a883968229270c4e4bec (patch)
treecde49dad66069ac861ad45f6c23751a435f7d8aa /test cases
parentf73a1dff0eaa631f9b674ebbafe43376b9675d9d (diff)
downloadmeson-8efbcb1e80d58fa39501a883968229270c4e4bec.zip
meson-8efbcb1e80d58fa39501a883968229270c4e4bec.tar.gz
meson-8efbcb1e80d58fa39501a883968229270c4e4bec.tar.bz2
cmake: Add unit test for add_custom_target() and add_dependency()
Also test commands with args separated by ';'
Diffstat (limited to 'test cases')
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt10
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp17
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp5
3 files changed, 32 insertions, 0 deletions
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
index 259151c..ec56105 100644
--- a/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
@@ -44,3 +44,13 @@ add_custom_command(
add_library(cmModLib SHARED cmMod.cpp genTest.cpp cpyBase.cpp cpyBase.hpp)
include(GenerateExportHeader)
generate_export_header(cmModLib)
+
+set(ARGS_TEST arg1)
+set(ARGS_TEST ${ARGS_TEST} arg2)
+
+add_executable(args_test args_test.cpp)
+add_custom_target(args_test_cmd
+ COMMAND args_test ARGS ${ARGS_TEST}
+)
+
+add_dependencies(cmModLib args_test_cmd)
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp
new file mode 100644
index 0000000..243e597
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp
@@ -0,0 +1,17 @@
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+int main(int argc, const char *argv[]) {
+ if(argc != 3 || string(argv[1]) != "arg1" || string(argv[2]) != "arg2") {
+ cerr << argv[0] << " requires 2 args" << endl;
+ return 1;
+ }
+
+ ofstream out1("cmModLib.hpp");
+ out1 << "#define FOO = \"plop\"";
+
+
+ return 0;
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp
index 0fb6aa7..b7e8200 100644
--- a/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp
@@ -1,6 +1,11 @@
#include "cmMod.hpp"
#include "genTest.hpp"
#include "cpyBase.hpp"
+#include "cmModLib.hpp"
+
+#ifndef FOO
+#error FOO not declared
+#endif
using namespace std;