Errors when build example with cmakelist

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


User avatar
Geotyper
Gnoblar
Posts: 23
Joined: Sat Aug 04, 2018 7:46 am
x 3

Errors when build example with cmakelist

Post by Geotyper »

have working example build with qmake.
Now try to recompile it using cmake
but have next problems
part of cmakelist.txt:

#OGRE2

Code: Select all

include_directories(
    /home/geotyper/CPP_lib/Core_math
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/OgreMain/include
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/build/Release/include
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/Components/Hlms/Common/include
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/Components/Hlms/Pbs/include
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/Components/Hlms/Unlit/include
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/Components/Overlay/include
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/Samples/2.0/Common/include
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/Samples/2.0/Common/src/
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogredeps/src/SDL2/include
)

link_directories(
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/build/Release/lib
    /home/geotyper/CPP_lib/OGRE2/Ogre/ogredeps/build/ogredeps/lib
)

set(OGRE_LIBRARIES  OgreMain
                    OgreHlmsPbs
                    OgreHlmsUnlit
                    OgreMeshLodGenerator
                    OgreOverlay
                    SDL2
                    OIS
                                     )

set(OGRE_MeshLodGenerator_LIBRARIES OgreMeshLodGenerator)
set(OGRE_Paging_LIBRARIES OgrePaging)
set(OGRE_Terrain_LIBRARIES OgreTerrain)
set(OGRE_Volume_LIBRARIES OgreVolume)

set(${OGRE_SAMPLES_LIBRARIES} OgreSamplesCommon)

target_link_libraries(${EXECUTABLE_NAME} ${OGRE_LIBRARIES} ${OGRE_SAMPLES_LIBRARIES})
have a error:
error: cannot find -lOgreHlmsPbs
error: cannot find -lOgreHlmsUnlit

this libraries are in folder /home/geotyper/CPP_lib/OGRE2/Ogre/ogre/build/Release/lib

why cmake dont find them?
my youtube channel with some simple Ogre3D experiments https://www.youtube.com/channel/UClzOh1 ... vLw/videos
User avatar
Geotyper
Gnoblar
Posts: 23
Joined: Sat Aug 04, 2018 7:46 am
x 3

Re: Errors when build example with cmakelist

Post by Geotyper »

Shortly there are two Ogre install on Ubuntu : Ogre 1.12 and Ogre 2.2
Change

Code: Select all

target_link_libraries(${EXECUTABLE_NAME}
    OgreMain2
    OgreHlmsPbs2
    OgreHlmsUnlit2
    OgreMeshLodGenerator2
    OgreOverlay2
    SDL2
    OIS)
where OgreMain2 is link libOgreMain2.so to libOgreMain.so.2.2.0 and etc to all libraries files
and cmake find all main libraries

but now compiler can't find:
/home/geotyper/CPP_cellularForms/CellCudaOgre2_cexp01/ogre3d.hpp:139: error: undefined reference to `Demo::GraphicsSystem::GraphicsSystem(Demo::GameState*, Ogre::ColourValue)' and 48 errors to Demo name space used in example
my youtube channel with some simple Ogre3D experiments https://www.youtube.com/channel/UClzOh1 ... vLw/videos
User avatar
Geotyper
Gnoblar
Posts: 23
Joined: Sat Aug 04, 2018 7:46 am
x 3

Re: Errors when build example with cmakelist

Post by Geotyper »

solve but not very good as think, by add libOgreSamplesCommon.a to usr/local/lib and in link libraries

Code: Select all

target_link_libraries(${EXECUTABLE_NAME}
    OgreMain2
    OgreHlmsPbs2
    OgreHlmsUnlit2
    OgreMeshLodGenerator2
    OgreOverlay2
    OgreSceneFormat2

    SDL2
    OIS

    OgreSamplesCommon
    )
my youtube channel with some simple Ogre3D experiments https://www.youtube.com/channel/UClzOh1 ... vLw/videos