rpavlik / vrjuggler

My VR Juggler changes, including a cmake-based build
http://academic.cleardefinition.com
GNU Lesser General Public License v2.1
4 stars 6 forks source link

Enables JUGGLER_DEBUG when cmake build type is Debug #3

Closed godbyk closed 12 years ago

godbyk commented 12 years ago

This bit of code defines the JUGGLER_DEBUG (and _DEBUG) flags when the CMAKE_BUILD_TYPE is set to Debug. If the CMAKE_BUILD_TYPE is anything else, we define JUGGLER_OPT.

Defining JUGGLER_DEBUG (and/or _DEBUG) has the side effect of enabling execution of the vprASSERT macro, additional verbose logging, and probably other crazy stuff that I haven't noticed yet. Each module's xxxConfig.h file defines an XXX_DEBUG flag if JUGGLER_DEBUG has been defined (where xxx is vpr, snx, etc.).

rpavlik commented 12 years ago

Good catch, except I thought I was already doing this - hmm. The trick here is that on MS Visual Studio, XCode, and other multi-config generators, CMAKE_BUILD_TYPE isn't set. Instead, target properties get this done - here's a snippet I've used in another project:

# Define PRODUCTION in release-like builds.
foreach(CONFIG RELEASE RELWITHDEBINFO MINSIZEREL)
    set_property(TARGET
        vps
        PROPERTY
        COMPILE_DEFINITIONS_${CONFIG}
        PRODUCTION)
endforeach()