Skip to content

Commit

Permalink
Add CPPSPEC_SPEC
Browse files Browse the repository at this point in the history
  • Loading branch information
toroidal-code committed Feb 25, 2024
1 parent 9531f1c commit 0531f7c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
"xstring": "cpp",
"xtree": "cpp"
},
"cmake.configureArgs": [
"-DCPPSPEC_BUILD_TESTS=YES",
"-DCPPSPEC_BUILD_EXAMPLES=YES"
],
"C_Cpp.intelliSenseEngine": "disabled",
"C_Cpp.autocomplete": "disabled",
"C_Cpp.errorSquiggles": "disabled",
Expand All @@ -100,4 +104,4 @@
}
]
},
}
}
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ function(discover_specs spec_folder)
endfunction(discover_specs)

# OPTIONS
option(CPPSPEC_BUILD_TESTS "Build C++Spec tests" OFF)
option(CPPSPEC_BUILD_EXAMPLES "Build C++Spec examples" OFF)
option(CPPSPEC_BUILD_DOCS "Build C++Spec documentation" OFF)
option(CPPSPEC_BUILD_TESTS "Build C++Spec tests")
option(CPPSPEC_BUILD_EXAMPLES "Build C++Spec examples")
option(CPPSPEC_BUILD_DOCS "Build C++Spec documentation")

if(CPPSPEC_BUILD_TESTS)
enable_testing()
Expand Down Expand Up @@ -122,4 +122,4 @@ if(CPPSPEC_BUILD_DOCS)
"Doxygen needs to be installed to generate documentation."
"Please install from https://github.com/doxygen/doxygen/releases")
endif(DOXYGEN_FOUND)
endif(CPPSPEC_BUILD_DOCS)
endif(CPPSPEC_BUILD_DOCS)
7 changes: 7 additions & 0 deletions include/cppspec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
: EXIT_FAILURE; \
}

#define CPPSPEC_SPEC(spec_name) \
int spec_name_spec(int argc, char **argv) { \
return CppSpec::parse(argc, argv).add_spec(spec_name).exec() \
? EXIT_SUCCESS \
: EXIT_FAILURE; \
}

#endif
/*>>>>>>>>>>>>>>>>>>> TYPEDEFS <<<<<<<<<<<<<<<<<<<<<*/

Expand Down

0 comments on commit 0531f7c

Please sign in to comment.