Hi Robert, As my answer to Olaf seems could not be posted, I quote part of my answer to Olaf for your reference :
[ I have experience in OpenCV that after CMake have created the out-of-source build directory for OpenCV, I could only use "make" to build OpenCV but NO need to use "make install" to install OpenCV into my system. I could then use "FIND_PACKAGE( OpenCV REQUIRED )" and specify the "OpenCV_DIR" CMake variable to create new CMake projects that use the OpenCV library. I have used this approach for some times. I just wonder whether OpenSceneGraph could have a similar approach for CMake projects that use its libraries.] Regards Lawrence On Thu, Apr 19, 2012 at 11:19 PM, Lawrence Tsang <[email protected]> wrote: > Hi Robert, > > Thanks for the answer. Do you mean that using > > ... > SET(OSG_DIR "/home/tkwinfo/OpenSceneGraph-3.0.1-build-eclipse-cdt") > FIND_PACKAGE(OpenSceneGraph) > ... > > in the CMakeLists.txt file or in the bash shell execute > > export OSG_DIR="/home/tkwinfo/OpenSceneGraph-3.0.1-build-eclipse-cdt" > > and then use my original posted CMakeLists.txt to create CMake projects > that use the OpenSceneGraph libraries. > > I suppose that your answer does not need the "sudo make install" step > (i.e. does not actually install OpenSceneGraph) as I have explained my > expectation in my answer to Olaf. Please update me if I have > mis-interpreted your answer. > > Regards > Lawrence > > > On Thu, Apr 19, 2012 at 3:43 PM, Robert Osfield > <[email protected]>wrote: > >> Hi Lawrenece, >> >> The CMake Findosg.cmake etc. scripts use the OSGDIR environmental >> variable as one of the paths it checks for where the OSG libs/headers >> are, so just set this to ~/OpenSceneGraph-3.0.1-build-eclipse-cdt and >> then remove the CMakeCache.txt and then re-run cmake to build the >> makefiles. Alternatively you can set the paths using cmake using >> ccmake. >> >> Robert. >> >> On 19 April 2012 03:54, Lawrence Tsang <[email protected]> wrote: >> > Hi, >> > >> > I have just downloaded the OpenSceneGraph source, unzip it into >> > "~/OpenSceneGraph-3.0.1" directory and use CMake to create an >> out-of-source >> > eclipse make project in "~/OpenSceneGraph-3.0.1-build-eclipse-cdt" >> > directory. When I execute "make" in >> > "~/OpenSceneGraph-3.0.1-build-eclipse-cdt" directory, OpenSceneGraph >> builds >> > successfully. I have not run "sudo make install" as I do not want to >> install >> > OpenSceneGraph tightly into my Ubuntu system. >> > >> > Now I want to use CMake to create a project using the compiled >> > OpenSceneGraph libraries. I use the following codes in CMakeLists.txt : >> > >> > CMAKE_MINIMUM_REQUIRED(VERSION 2.6) >> > PROJECT( test_proj ) >> > FIND_PACKAGE(OpenSceneGraph) >> > ADD_EXECUTABLE( test test.cpp ) >> > INCLUDE_DIRECTORIES(${OPENSCENEGRAPH_INCLUDE_DIRS}) >> > TARGET_LINK_LIBRARIES( test ${OPENSCENEGRAPH_LIBRARIES} ) >> > >> > But it seems that OpenSceneGraph could not be found by CMake. >> > >> > Does anyone know how CMake could find the compiled OpenSceneGraph >> > libraries in the "~/OpenSceneGraph-3.0.1-build-eclipse-cdt" directory >> and >> > use it to create projects as if I have tightly installed OpenSceneGraph >> > using "sudo make install". Thanks for any suggestion. >> > >> > Lawrence >> > >> > _______________________________________________ >> > osg-users mailing list >> > [email protected] >> > >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

