0

I am trying to create an eclipse project from a cmake project . I used the following command

cmake -G "Eclipse CDT4 - Unix Makefiles" ./`

it gives the following error

CMake Error at CMakeLists.txt:119 (find_package):
  By not providing "FindGlib.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Glib", but
  CMake did not find one.

  Could not find a package configuration file provided by "Glib" (requested
  version 2.28) with any of the following names:

    GlibConfig.cmake
    glib-config.cmake

  Add the installation prefix of "Glib" to CMAKE_PREFIX_PATH or set
  "Glib_DIR" to a directory containing one of the above files.  If "Glib"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

I have glib installed . actually it couldn't resolve the path i guess. wherever find is there in cmake file , it is giving the smiler errors. please i suggest a way out, i badly need to load this project in cmake. Thanks.

Here is line 119 where error message is pointing

    find_package(Glib 2.28 REQUIRED)
include_directories(${Glib_INCLUDE_DIRS})
list(APPEND LIBS ${Glib_LIBRARIES})
add_definitions(${Glib_DEFINITIONS})
Cœur
  • 37,241
  • 25
  • 195
  • 267
rwik
  • 775
  • 2
  • 12
  • 27

1 Answers1

0

When you call find_package(MyPackage) in a CMake file, it tries to find a FindMyPackage.cmake configuration in its system path (/usr/share/cmake-2.8/Modules on my Ubuntu box), or in the directory you did specify as CMAKE_MODULE_PATH).

The solution to your problem is to create a directory for modules in your source tree (e.g. CMakeModules), put in it a FindGlib.cmake file that you can find using Google, and add

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)

in your CMakeLists.txt before the actual call to find_package.

(your problem is not related to the Eclipse generator, you could remove that from the title of the question).

rcomblen
  • 4,579
  • 1
  • 27
  • 32