[Solved] Linux CMake can't find CEGUI, no matter what I try

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Dugi
Just popping in
Just popping in
Posts: 14
Joined: Fri Apr 17, 2015 20:41

[Solved] Linux CMake can't find CEGUI, no matter what I try

Postby Dugi » Fri Apr 17, 2015 21:04

Hello,

I wanted to use CEGUI with my ogre-based program, but I could not get CMake to find it. I have found several solutions via google on these forums and also elsewhere, but neither of them worked, CMake was still failing to find it (the errors varied).

The one that was closest to success was at axelschumacher.fr/218/link-ogre-with-cegui-ogre-basic-tutorial-7-using-cmake , but it was still throwing the following error:

Code: Select all

CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find CEGUI (version requirements: at least ) (missing:
  CEGUI_LIBRARY_OPTIMIZED)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/lib/cegui-0.8/cmake/FindPackageHandleAdvancedArgs.cmake:44 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  /usr/local/lib/cegui-0.8/cmake/FindCEGUI.cmake:59 (FIND_PACKAGE_HANDLE_ADVANCED_ARGS)
  CMakeLists.txt:111 (find_package)

I don't know why does that happen, I tried to remove CEGUI_LIBRARY_OPTIMIZED from the targets list, but it started complaining about being unable to find CEGUIOGRE and I found no haphazard trick to get over it. I remember that I got some 0.7.something version of CEGUI working about 1.5 years ago using exactly those scripts, but I was doing it just for an Ogre tutorial and lost the files due in an accident. Maybe something changed since then

I am using Linux Ubuntu 14.10, Ogre was compiled from source and has all the CMake files there, compiles correctly, CEGUI was compiled without issues (default installation), the CEGUIOGRE based samples' framework runs. According to cegui.org.uk/forum/viewtopic.php?f=10&t=6693 , the way Ogre installed isn't good. I am quite sure that findCEGUI.cmake and other files were found, the error is different if I remove them.

I have CEGUI installed in /usr/local/lib/cegui-0.8 and /usr/local/include/cegui-0/CEGUI (default location when compiling), to be sure that it's not just misplaced I placed links on these folders into /usr/lib/ and /usr/include but it did not help.

I also tried the script on cegui.org.uk/forum/viewtopic.php?f=3&t=5732 , but it generated a large number of errors and failed to find it anyway (I can post these too if necessary).

Any idea what am I doing wrong? CEGUI looks like a pretty cool library and I would like to be able to use it.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Linux CMake can't find CEGUI, no matter what I try

Postby Ident » Sat Apr 18, 2015 14:36

Can you paste the cmake find file that was closest to success?
CrazyEddie: "I don't like GUIs"

Dugi
Just popping in
Just popping in
Posts: 14
Joined: Fri Apr 17, 2015 20:41

Re: Linux CMake can't find CEGUI, no matter what I try

Postby Dugi » Sat Apr 18, 2015 19:49

Thanks for the reply.

It was in the first link (http://www.axelschumacher.fr/218/link-o ... ing-cmake/), but as I see, it's better to post it all here.

The file is:

Code: Select all

INCLUDE(DetermineVersion)
INCLUDE(FindPackageHandleAdvancedArgs)
INCLUDE(HandleLibraryTypes)

FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
  PATHS $ENV{CEGUIDIR}
  PATH_SUFFIXES /include /cegui/include /include/CEGUI CEGUI.framework/Headers
)

FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
  NAMES CEGUIBase CEGUI
  PATHS $ENV{CEGUIDIR}
  PATH_SUFFIXES lib bin
)
FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
  NAMES
    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
    CEGUId CEGUI_d CEGUID CEGUI_D
  PATHS $ENV{CEGUIDIR}
  PATH_SUFFIXES lib bin
)


# Inspect CEGUIVersion.h for the version number
DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)

# Handle the REQUIRED argument and set CEGUI_FOUND
# Also checks the version requirements if given
FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
  CEGUI_LIBRARY_OPTIMIZED
  CEGUI_INCLUDE_DIR
)

# Collect optimized and debug libraries
HANDLE_LIBRARY_TYPES(CEGUI)

MARK_AS_ADVANCED(
  CEGUI_INCLUDE_DIR
  CEGUI_LIBRARY_OPTIMIZED
  CEGUI_LIBRARY_DEBUG
)


For CEGUIOGRE:

Code: Select all

INCLUDE(DetermineVersion)
INCLUDE(FindPackageHandleAdvancedArgs)
INCLUDE(HandleLibraryTypes)

FIND_PATH(CEGUIOGRE_INCLUDE_DIRS CEGUIOgreRenderer.h
  PATHS $ENV{CEGUIDIR}
  PATH_SUFFIXES include/RendererModules/Ogre cegui/include/RendererModules/Ogre include/CEGUI/RendererModules/Ogre CEGUI.framework/Headers
)
FIND_LIBRARY(CEGUIOGRE_LIBRARY_OPTIMIZED
  NAMES CEGUIOgreRenderer CEGUI
  PATHS $ENV{CEGUIDIR}
  PATH_SUFFIXES lib bin
)
FIND_LIBRARY(CEGUIOGRE_LIBRARY_DEBUG
  NAMES
  CEGUIOgreRendererd CEGUIOgreRenderer_d CEGUIOgreRendererD CEGUIOgreRenderer_D
  PATHS $ENV{CEGUIDIR}
  PATH_SUFFIXES lib bin
)

# Collect optimized and debug libraries
HANDLE_LIBRARY_TYPES(CEGUIOGRE)

FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUIOGRE DEFAULT_MSG
  CEGUIOGRE_LIBRARY_OPTIMIZED
  CEGUIOGRE_INCLUDE_DIRS
)

MESSAGE(STATUS "Found CEGUI include dir: ${CEGUIOGRE_INCLUDE_DIRS}")

MARK_AS_ADVANCED(
  CEGUIOGRE_INCLUDE_DIRS
  CEGUIOGRE_LIBRARY_OPTIMIZED
  CEGUIOGRE_LIBRARY_DEBUG
)


It depends on files CompareVersionStrings.cmake, HandleLibraryTypes.cmake, DetermineVersion.cmake and FindPackageHandleAdvancedArgs.cmake, they are in this repo (https://bitbucket.org/sumwars/sumwars-c ... keModules/).

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Linux CMake can't find CEGUI, no matter what I try

Postby Ident » Sat Apr 18, 2015 20:35

CrazyEddie: "I don't like GUIs"

Dugi
Just popping in
Just popping in
Posts: 14
Joined: Fri Apr 17, 2015 20:41

Re: Linux CMake can't find CEGUI, no matter what I try

Postby Dugi » Sat Apr 18, 2015 21:14

Thanks for the reply. That file seems to do the trick for CEGUI, but not for CEGUIOGRE. I assumed that the file checks for that too and the script parts looking for CEGUIOGRE separately are unneeded, but it results in linker errors without them.

This is the new error:

Code: Select all

By not providing "FindCEGUIOGRE.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "CEGUIOGRE", but CMake did not find one. Could not find a package configuration file provided by "CEGUIOGRE" with any of the following names: CEGUIOGREConfig.cmake ceguiogre-config.cmake Add the installation prefix of "CEGUIOGRE" to CMAKE_PREFIX_PATH or set "CEGUIOGRE_DIR" to a directory containing one of the above files.  If "CEGUIOGRE" provides a separate development package or SDK, be sure it has been installed.


I thought this line cares for it, but if it does, I am using it wrong:

Code: Select all

cegui_register_module(RENDERER OgreRenderer RendererModules/Ogre/Renderer.h "OGRE")


I tried to check that folder for a file like FindCEGUIOGRE.cmake, but I found nothing that looked like what I am looking for. Using the FindOgre.cmake file from the repository did not help.

This is what I am using in my CmakeLists.txt:

Code: Select all

find_package(CEGUI REQUIRED)
if(NOT CEGUI_FOUND)
message(SEND_ERROR "Failed to find CEGUI.")
endif()

find_package(CEGUIOGRE REQUIRED)
if(NOT CEGUIOGRE_FOUND)
message(SEND_ERROR "Failed to find CEGUIOGRE.")
endif()

#...

include_directories( #...
   ${CEGUI_INCLUDE_DIRS}
   ${CEGUIOGRE_INCLUDE_DIRS}
)

# Adding ${CEGUI_LIBRARY} ${CEGUIOGRE_LIBRARY_OPTIMIZED} to the list of linked libraries

I am quite convinced that I am doing something silly somewhere. Any idea what could be the cause of the problem now?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Linux CMake can't find CEGUI, no matter what I try

Postby Kulik » Sat Apr 18, 2015 22:19

Read the docs of the FindCEGUI script Ident posted. You don't need CEGUIOGRE.

Dugi
Just popping in
Just popping in
Posts: 14
Joined: Fri Apr 17, 2015 20:41

Re: Linux CMake can't find CEGUI, no matter what I try

Postby Dugi » Sun Apr 19, 2015 12:39

Good to know that. Thanks.

But what do I use as argument for target_link_libraries without seeing linker errors? I guessed that $(CEGUI_LIBRARIES) should be there, but I could not find anything for ceguiogre. I tried $(CEGUI_OGRE_RENDERER_LIBRARIES), ${CEGUI_RENDERER_OGRE_LIBRARIES}, ${CEGUI_OGRE_LIBRARIES}, ${CEGUI_RENDERER_LIBRARIES}, ${CEGUI_OGRE_RENDERER_LIBNAME}, ${CEGUI_OGRE_RENDERER_LIBS} or just $(CEGUI_LIBRARIES) alone, but it did not help.

I believe that the answer lies somewhere in this section, where TYPE is RENDERER, LIBNAME is OgreRenderer, HEADER is RendererModules/Ogre/Renderer.h and PKGCONGIG is "OGRE":

Code: Select all

macro(cegui_register_module TYPE LIBNAME HEADER PKGCONFIG)
        set(CEGUI_MODULES ${CEGUI_MODULES} ${LIBNAME})
        set(CEGUI_${TYPE}_MODULES ${CEGUI_${TYPE}_MODULES} ${LIBNAME})
        set(CEGUI_${TYPE}_MODULES_${LIBNAME}_HEADER ${HEADER})
        if(NOT "${PKGCONFIG}" STREQUAL "")
            set(CEGUI_${TYPE}_MODULES_${LIBNAME}_PKGCONFIG ${PKGCONFIG})
        endif()
endmacro()

But I found nothing. It was hard to look for definitions of those variables because of the macros. Even the macros in the samples' framework directory are very complicated and it's hard to tell what do I need to get it working with Ogre.

So I am still stuck at linker errors (for testing, I have just this line related to CEGUI in code):

Code: Select all

error: undefined reference to `CEGUI::OgreRenderer::bootstrapSystem(int)'


Maybe there should be some kind of linking documentation for dummies section. Please, what should I add to the target_link_libraries arguments to add OgreRenderer?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Linux CMake can't find CEGUI, no matter what I try

Postby Kulik » Mon Apr 20, 2015 09:44

just run:

Code: Select all

cmake -LA


to list all cmake vars available. Or see the documentation.

Dugi
Just popping in
Just popping in
Posts: 14
Joined: Fri Apr 17, 2015 20:41

Re: Linux CMake can't find CEGUI, no matter what I try

Postby Dugi » Mon Apr 20, 2015 10:41

Ehm, that's quite a dirty solution. Like placing the library into the same folder as the executable and adding links exactly to that file. However, it led me to the solution I was looking for.

I was trying to google how to add that to the CMakeLists.txt file, and I found a way to print all defined variables. Automated search has found that the variable I needed to see is $(CEGUI_OgreRenderer_LIBRARIES). Now it works.

Thanks for all the help.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: [Solved] Linux CMake can't find CEGUI, no matter what I

Postby Kulik » Mon Apr 20, 2015 13:47

I don't understand. What I suggested is a perfectly clean solution. You use cmake -LA to list all variables defined in your project. Your project uses FindCEGUI which means it will contain variables defined by this script as well. cmake -LA lets you see all these variables so that you can choose the right one :-)

This is what you do when the find script does not provide any documentation.

No cmake file editing was necessary.

Dugi
Just popping in
Just popping in
Posts: 14
Joined: Fri Apr 17, 2015 20:41

Re: [Solved] Linux CMake can't find CEGUI, no matter what I

Postby Dugi » Mon Apr 20, 2015 15:16

Ah, I didn't get it. I thought that it will just try to link anything linkable defined. I see it now. That -LA trick will be very handy in the future. Thanks.

syedharoonalam
Just popping in
Just popping in
Posts: 1
Joined: Wed Jan 25, 2017 04:35

Re: [Solved] Linux CMake can't find CEGUI, no matter what I try

Postby syedharoonalam » Wed Jan 25, 2017 04:37

Adding ${CEGUI_OgreRenderer_LIBRARIES} or -lCEGUIOgreRenderer-0 in target_link_libraries worked for me.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 3 guests