Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
CMake: add CHECKERRORS option
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Jul 22, 2021
1 parent abd6889 commit 6eddb9f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ if(DEBUGMESSAGES)
target_compile_definitions(PortMidi PRIVATE DEBUG)
endif()

option(CHECKERRORS
"Insert a check for error return values at the end of each PortMidi function.
If an error is encountered, a text message is printed using printf(), the user
is asked to type ENTER, and then exit(-1) is called to clean up and terminate
the program.
You should not use PM_CHECK_ERRORS if printf() does not work (e.g. this is not
a console application under Windows, or there is no visible console on some
other OS), and you should not use CHECKERRORS if you intend to recover from
errors rather than abruptly terminate the program." OFF)
if(CHECKERRORS)
target_compile_definitions(PortMidi PRIVATE PM_CHECK_ERRORS)
endif()

# FreeBSD has a reimplementation of alsalib, so don't restrict the ALSA backend strictly to Linux.
if(UNIX AND NOT APPLE)
find_package(ALSA REQUIRED)
Expand Down

0 comments on commit 6eddb9f

Please sign in to comment.