summaryrefslogtreecommitdiff
path: root/Modules/FindOpenSceneGraph.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-10-16 13:25:59 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2009-10-16 13:25:59 -0400
commitfe8da5a99f44a9d3a822e268f7bd2ef21fd491e6 (patch)
tree9a5e9920f89c0e6361f263587ba67fff9e7179b8 /Modules/FindOpenSceneGraph.cmake
parent847918b38f4557b541c85fec819b90a3e24c6a94 (diff)
downloadcmake-fe8da5a99f44a9d3a822e268f7bd2ef21fd491e6.tar.gz
Try to fix bug#9714, should not crash when version file is not where it should be...
Diffstat (limited to 'Modules/FindOpenSceneGraph.cmake')
-rw-r--r--Modules/FindOpenSceneGraph.cmake11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 9a13ea2ab7..b06cba46c5 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -96,13 +96,16 @@ if(OSG_INCLUDE_DIR)
message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
"Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}")
endif()
-
- file(READ "${OSG_INCLUDE_DIR}/osg/Version" _osg_Version_contents)
+ if(EXISTS "${OSG_INCLUDE_DIR}/osg/Version")
+ file(READ "${OSG_INCLUDE_DIR}/osg/Version" _osg_Version_contents)
+ else()
+ set(_osg_Version_contents "unknown")
+ endif()
string(REGEX MATCH ".*#define OSG_VERSION_MAJOR[ \t]+[0-9]+.*"
- _osg_old_defines ${_osg_Version_contents})
+ _osg_old_defines "${_osg_Version_contents}")
string(REGEX MATCH ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+[0-9]+.*"
- _osg_new_defines ${_osg_Version_contents})
+ _osg_new_defines "${_osg_Version_contents}")
if(_osg_old_defines)
string(REGEX REPLACE ".*#define OSG_VERSION_MAJOR[ \t]+([0-9]+).*"
"\\1" _osg_VERSION_MAJOR ${_osg_Version_contents})