Skip to content

Commit 0531f7c

Browse files
committed
Add CPPSPEC_SPEC
1 parent 9531f1c commit 0531f7c

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
"xstring": "cpp",
7676
"xtree": "cpp"
7777
},
78+
"cmake.configureArgs": [
79+
"-DCPPSPEC_BUILD_TESTS=YES",
80+
"-DCPPSPEC_BUILD_EXAMPLES=YES"
81+
],
7882
"C_Cpp.intelliSenseEngine": "disabled",
7983
"C_Cpp.autocomplete": "disabled",
8084
"C_Cpp.errorSquiggles": "disabled",
@@ -100,4 +104,4 @@
100104
}
101105
]
102106
},
103-
}
107+
}

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ function(discover_specs spec_folder)
6464
endfunction(discover_specs)
6565

6666
# OPTIONS
67-
option(CPPSPEC_BUILD_TESTS "Build C++Spec tests" OFF)
68-
option(CPPSPEC_BUILD_EXAMPLES "Build C++Spec examples" OFF)
69-
option(CPPSPEC_BUILD_DOCS "Build C++Spec documentation" OFF)
67+
option(CPPSPEC_BUILD_TESTS "Build C++Spec tests")
68+
option(CPPSPEC_BUILD_EXAMPLES "Build C++Spec examples")
69+
option(CPPSPEC_BUILD_DOCS "Build C++Spec documentation")
7070

7171
if(CPPSPEC_BUILD_TESTS)
7272
enable_testing()
@@ -122,4 +122,4 @@ if(CPPSPEC_BUILD_DOCS)
122122
"Doxygen needs to be installed to generate documentation."
123123
"Please install from https://github.com/doxygen/doxygen/releases")
124124
endif(DOXYGEN_FOUND)
125-
endif(CPPSPEC_BUILD_DOCS)
125+
endif(CPPSPEC_BUILD_DOCS)

include/cppspec.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
: EXIT_FAILURE; \
4646
}
4747

48+
#define CPPSPEC_SPEC(spec_name) \
49+
int spec_name_spec(int argc, char **argv) { \
50+
return CppSpec::parse(argc, argv).add_spec(spec_name).exec() \
51+
? EXIT_SUCCESS \
52+
: EXIT_FAILURE; \
53+
}
54+
4855
#endif
4956
/*>>>>>>>>>>>>>>>>>>> TYPEDEFS <<<<<<<<<<<<<<<<<<<<<*/
5057

0 commit comments

Comments
 (0)