CMake config does not work

Bug #1357072 reported by Tuur Dutoit
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Writer
In Progress
High
Anthony Huben

Bug Description

When using 'cmake -DCMAKE_INSTALL_PREFIX=/usr .." in the build direcory, it fails with following message:

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

  Could not find a package configuration file provided by "Vala" with any of
  the following names:

    ValaConfig.cmake
    vala-config.cmake

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

#### END

I have no idea how CMake works, so could anybody who does have some experience with it look into this?
Currently, I use the run.sh file, which compiles and runs Writer. (Actually, I find this way easier. What are the benefits of using CMake?)

Tags: packaging
Revision history for this message
Anthony Huben (harp37) wrote :

I am willing to help you with this bug, but I want to check out other parts of the UI and work on specific items. Taking over the world. Haha.

Here are the pros of using CMake:
  -has a fully working configure-like framework, that is easy to use
  -has no other dependencies except for a C++ compiler
  -supports basically every UNIX, MS Windows (MSVC, Borland, cygwin, mingw) and Mac OS X
  -has a simple syntax
  -features a testing framework

Revision history for this message
Tuur Dutoit (tuur-dutoit-f) wrote :

That's quite some pros! So you could get this working? That would be awesome.

PS: I would be happy with some help. I have never used Vala or Gtk, so I have to do much research, slowing down the whole process, and probably still doing some things wrong :). I'd be happy with your contributions!

Changed in writer:
status: New → Confirmed
importance: Undecided → High
Anthony Huben (harp37)
Changed in writer:
status: Confirmed → Fix Released
status: Fix Released → In Progress
Changed in writer:
assignee: nobody → Anthony Huben (harp37)
tags: added: packaging
Revision history for this message
Afonso Silva (afonsojoao96) wrote :

It was happening to me too, in order to make it work you just need to do:

sudo apt-get build-dep scratch-text-editor

Revision history for this message
tommy (erickstm) wrote :

I had this same problem. It came from the instructions on the getting started page https://elementary.io/docs/code/getting-started#bazaar, where it says to copy the folder cmake over to hello-again. It actually meant copy cmake's contents over to hello-again. I did this and got it to run

Revision history for this message
Yuri Witte (witte) wrote :

I was also following https://elementary.io/docs/code/getting-started#bazaar and had the same problem. What's happening is that the compiler needs a folder where it can find the Vala files it needs. The message says:

By not providing "FindVala.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Vala", but
  CMake did not find one.

The "FindVala.cmake" file was in cmake-modules/src (in my case, you'd need to find out how that works for you), so I opened up my CMakeLists.txt in my app's root folder and added this to it's fourth line:

list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake-modules/src)

After that I could configure and build everything.

Revision history for this message
Yuri Witte (witte) wrote :

Just to make it clear, the first lines of my hello-world's CMakeLists.txt now look like this:

project (hello-again)
cmake_minimum_required (VERSION 2.6)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake-modules)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake-modules/src)
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")

Tommy's suggestion also worked for me, but then the cmake and my app files got all mixed up... if that was confusing for a hello world app I wonder what would happen in an actual project. lol

Revision history for this message
Anthony Huben (harp37) wrote : Re: [Bug 1357072] Re: CMake config does not work

If you want to push a branch, I would be more than happy to accept any
improvements.

Revision history for this message
Leo (sagar-hingal) wrote :

Thanks Yuri Witte and all the guys! it worked finally!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.