Question

I am working at a C application with ncurses for a CLI that uses autotools for build. Besides the actual application, there is a testing framework (cutter) and there are some preprocessor constants that enable or disable some features (for example, there is a constant WINDOW that borders all ncurses windows - useful for managing the window layout).

Of course, some of these constants can be specified manually at compile time (i.e. make) but I'd like to have 2 build targets: debug and release. Also, there is a problem with cutter (configure checks for it, and this is supposed to happen if it's going to be used, but I cannot require a normal user to install cutter to compile). So, I was thinking at the following setup: to create a configure flag that enables tests (disabled by default) and 2 make targets (make creates the release version and make debug, the debug one). Is this workflow correct or there is a better way to do this?

Was it helpful?

Solution

If it were me, I'd use AC_ARG_WITH to setup where the cutter testing framework resides (e.g. include/library paths) and any related stuff that deals with cutter (e.g. preprocessor flags), and one or more AC_ARG_ENABLE variables (or possibly AC_ARG_WITH) to enable other preprocessor directives. This way you don't have to maintain a debug target.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top