Skip to content

Commit 0d7cc5e

Browse files
committed
Changed to use a cmake option and made the define a little more direct about it's role.
1 parent 1581af7 commit 0d7cc5e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ if (VSG_SUPPORTS_Windowing)
9898
endif()
9999
endif()
100100

101-
set(VSG_USE_DYNAMIC_CAST 0 CACHE STRING "Use dynamic_cast in vsg::Object::cast<T>(), 0 for off, 1 for enabled." )
101+
option(VSG_USE_dynamic_cast "Use dynamic_cast in vsg::Object::cast<T>(), 0 for off, 1 for enabled." OFF)
102102

103103
# this line needs to be after the call to setup_build_vars()
104104
configure_file("${VSG_SOURCE_DIR}/src/vsg/core/Version.h.in" "${VSG_VERSION_HEADER}")

include/vsg/core/Object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace vsg
8585
virtual const std::type_info& type_info() const noexcept { return typeid(Object); }
8686
virtual bool is_compatible(const std::type_info& type) const noexcept { return typeid(Object) == type; }
8787

88-
#if VSG_USE_DYNAMIC_CAST == 1
88+
#if VSG_USE_dynamic_cast
8989
template<class T>
9090
T* cast() { return dynamic_cast<T*>(this); }
9191

src/vsg/core/Version.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ extern "C"
4545
/// Native Windowing support provided with vsg::Window::create(windowTraits) enabled when 1, disabled when 0
4646
#cmakedefine01 VSG_SUPPORTS_Windowing
4747

48-
/// Define VSG_USE_DYNAMIC_CAST to avoid typeid(T) comparisons in vsg::Object::cast<T>()
49-
#define VSG_USE_DYNAMIC_CAST @VSG_USE_DYNAMIC_CAST@
48+
/// Define VSG_USE_dynamic_cast to avoid typeid(T) comparisons in vsg::Object::cast<T>()
49+
#cmakedefine01 VSG_USE_dynamic_cast
5050

5151
struct VsgVersion
5252
{

0 commit comments

Comments
 (0)