]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Add test for CXXFLAGS
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 16 Oct 2012 02:11:10 +0000 (04:11 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 16 Oct 2012 02:27:17 +0000 (04:27 +0200)
tests/Makefile
tests/programs-cxxflags [new file with mode: 0755]

index f27030604703394d01f7b9c03dc07a8a265e8944..0656290fc658469803cbf615ab3043727582066a 100644 (file)
@@ -4,7 +4,7 @@ default-config extra_rules_subdirs header-files headers-generated       \
 headers-generated-default-cflags headers-nonexisting hooks             \
 idl ignore_errors includes invocation_dir libraries no-print-directory \
 no_vpath omk_config override-config parallel_make programs             \
-programs-cflags programs-cflags-cmdline programs-defs                  \
+programs-cflags programs-cxxflags programs-cflags-cmdline programs-defs        \
 programs-test_PROGRAMS qt qt-qmake shlibs sources_dir                  \
 sources_in_subdirectory sources_list subdirs_first                     \
 subdirs_first-force-subdir use_leaf_makefiles vxworks whole_tree
diff --git a/tests/programs-cxxflags b/tests/programs-cxxflags
new file mode 100755 (executable)
index 0000000..6f3b0ea
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+. ./functions.sh
+
+cat > 'test.cc' <<'EOF'
+#include <stdio.h>
+
+int main()
+{
+#if NUMBER == 123
+        printf("NUMBER is %d\n", NUMBER);
+#else
+#  error No NUMBER defined
+#endif
+        return 0;
+}
+EOF
+
+cat > 'Makefile.omk' <<'EOF'
+bin_PROGRAMS = test
+
+test_SOURCES = test.cc
+EOF
+
+needs_valid_CC
+WVPASS make CXXFLAGS=-DNUMBER=123
+
+if [ $OMK_RULES = linux ]; then
+    # The following should work only with Linux rules
+    _compiled/bin/test|grep 123 || error "Custom CXXFLAGS didn't influence the output"
+fi