summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Helsing <helsing72@gmail.com>2014-09-16 20:20:19 (GMT)
committerBrad King <brad.king@kitware.com>2014-09-18 13:06:58 (GMT)
commitb683da3efa4873c4e51339935f7c7ea67c15e246 (patch)
tree72d8b7d8b809cdf62c5c66d21856efc0c2695e07
parent201cc6fe095f1a0abfc34bb6482d933cc12ff055 (diff)
downloadCMake-b683da3efa4873c4e51339935f7c7ea67c15e246.zip
CMake-b683da3efa4873c4e51339935f7c7ea67c15e246.tar.gz
CMake-b683da3efa4873c4e51339935f7c7ea67c15e246.tar.bz2
FindOpenSceneGraph: Do not add unfound OSG libs if not required
-rw-r--r--Modules/FindOpenSceneGraph.cmake7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 7bbd753..68adff7 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -203,8 +203,11 @@ foreach(_osg_module ${_osg_modules_to_process})
find_package(${_osg_module} ${_osg_quiet})
string(TOUPPER ${_osg_module} _osg_module_UC)
- list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
- list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
+ # append to list if module was found OR is required
+ if( ${_osg_module_UC}_FOUND OR OpenSceneGraph_FIND_REQUIRED )
+ list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
+ list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
+ endif()
if(OpenSceneGraph_MARK_AS_ADVANCED)
OSG_MARK_AS_ADVANCED(${_osg_module})