[cmake] expose some standard CMake options
authorStephen Sinclair <radarsat1@gmail.com>
Tue, 16 Apr 2019 20:24:52 +0000 (22:24 +0200)
committerStephen Sinclair <radarsat1@gmail.com>
Tue, 16 Apr 2019 20:29:00 +0000 (22:29 +0200)
- make build type a drop-down if it's not otherwise set.
- default to 'd' suffix for Windows debug builds only.

CMakeLists.txt

index 2cee314ab32d18369375ceb491c4882839052aad..178694720901abaa23da46eec0977ffb2f2d2c08 100644 (file)
@@ -28,6 +28,16 @@ if(MINGW)
   set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
 endif()
 
+# Standard CMake options
+option(BUILD_SHARED_LIBS "Build as shared library" ON)
+
+if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
+  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel")
+endif()
+if(WINDOWS)
+  set(CMAKE_DEBUG_POSTFIX d CACHE STRING "Postfix for debug version of library")
+endif()
+
 # Build Options
 option(RTAUDIO_BUILD_PYTHON "Build PyRtAudio python bindings" OFF)
 set(RTAUDIO_TARGETNAME_UNINSTALL "uninstall" CACHE STRING "Name of 'uninstall' build target")