Hi all,
I'm building against OpenScenGraph-3.0.1 AND OpenSceneGraph-3.3.3.
While the latter have osgUI the former does not. My cmake scripts for
the 3.0.1 build fail because the OPENSCENEGRAPH_INCLUDE_DIR gets
populated with OSGUI_INCLUDE_DIR-NOTFOUND.
I can solve this with for loops (remove all item containing NOTFOUND)
but it's awkward. If I'm not requiring osgUI it shouldn't break my
build.


cheers
Mattias
From a7f8010c1ff9925a498f533fb120755beaf5c27e Mon Sep 17 00:00:00 2001
From: Mattias Helsing <helsin...@gmail.com>
Date: Tue, 16 Sep 2014 22:20:19 +0200
Subject: [PATCH] Don't add unfound OSG libs if they weren't required

---
 Modules/FindOpenSceneGraph.cmake |    7 +++++--
 1 file 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})
-- 
1.7.9.5

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to