How to show the configuration of my CMake? - configuration

I'm looking for a command like cmake --features or cmake --config which shows me how my CMake executable was built. For example, I want to know weather the flags like --system-bzip2 really did get used and check the paths to the libraries CMake uses.
I am not interested in knowing what features are available on which CMake version, but which options were actually used in the build.

To find out, which libraries are used for the compiling of your CMake executable, I see three ways, as there is no --feature or --config provided by CMake.
Check the output of CMake's configure run. For most libraries, it indicates the path to the library.
Check the CMakeCache.txt within the build directory. You can find out the library paths
When you build CMake, call make VERBOSE=ON and check the output.

As far as I know, there's no such a feature in the CMake executable.
You should check your CMake version toward the official documentation to check whether a given feature is included in that version.
There's a nice tool, written in CMake language, that automates this work, you can find more info here.

Related

How do I make Octave see installed Shogun libraries in Ubuntu 16.04?

I copied the commands (from these instructions: http://www.shogun-toolbox.org/install#ubuntu) into the terminal and they seem to have worked, but there is no documentation on how to make Octave find the libraries. I have tried modshogun and init_shogun but Octave cannot find them. I do have the libraries in usr/lib, and I have put that directory on PATH. I have even set usr/lib as my working directory in Octave and that did not help. As far as I have found, there is no Shogun documentation on what to do at this point.
I have also tried compiling Shogun from source, but configure couldn't find GCC. Apparently, this is a known problem with newer versions of GCC. I decided to ask for help with the former method because at least I have the libraries with that.
Edit: I am following the instructions here http://www.shogun-toolbox.org/install#manual-basics
When i do cd build and then "cmake -DINTERFACE_OCTAVE=ON" it tells me there is no cmakelists.txt. There is one in in the above folder, but when I go to that directory and do "cmake -DINTERFACE_OCTAVE=ON" again, it tells me "Shogun can only be built with GPL codes if the source files are in /home/derose/shogun/src/shogun/src/gpl. Please download or disable with LICENSE_GPL_SHOGUN=OFF."
However, when I add -LICENSE_GPL_SHOGUN=OFF as an option, i get the error "CMake Error: The source directory "/home/derose/shogun/src/shogun/-LICENSE_GPL_SHOGUN=OFF" does not exist."
You've linked to the Ubuntu install instructions. From there
These currently do contain the C++ library and Python bindings..
No word that this would include the GNU Octave binding. See below on the same page:
The native C++ interface is always included. The cmake options for building interfaces are -DINTERFACE_PYTHON=ON -DINTERFACE_R .. etc. For example, replace the cmake step above by cmake -DINTERFACE_PYTHON=ON...
So you have to grab the source and fire up cmake with something like -DINTERFACE_OCTAVE=ON
Steps to build the bleeding edge of shogun (the github repo) and the Octave interface:
git clone https://github.com/shogun-toolbox/shogun && cd shogun
git submodule update --init
mkdir build && cd build
cmake .. -DINTERFACE_OCTAVE=ON
make -j4

should I recompile all clang project when I want to add a new checker in Clang StaticAnalyzer?

I follow the steps in the section Checker Registration
in the manual page of clang static analyzer one by one and can not find my checker from the output of the command
clang -cc1 -help | grep "analyzer"
So, I wonder if I should recompile the whole project? That is a burdensome job which I need almost several hours to compile it.
You should be using a build system like ninja or make when compiling llvm/clang. The build system automatically decides which parts need to be recompiled and which parts do not.
As an example, if you follow the steps to build clang here, step number 7 says to run the following commands:
mkdir build (in-tree build is not supported)
cd build
cmake -G "Unix Makefiles" ../llvm
make
From that point forward every time you make changes you only need to re-run the make command from your build folder and make will automatically compile anything that needs to be recompiled.
If you want slightly faster recompile times you can install the ninja build system and use cmake -G "Ninja" ../llvm when first building the project and use the ninja command instead of make from that point forward.

As a project user, what do I need to do to make a project with Cmake?

I'm working with a project that [used to] support both Autotools and Cmake. In the past, I would:
cd project/build
...
../llvm/configure --enable-optimized --enable-cxx11 $OTHER_OPTIONS --prefix=/usr/local
make -j2
sudo make install
The project has kind of abandoned it support for Autotools, so I have to use Cmake now. Using Cmake to configure seems like it should be relatively easy.
Unfortunately, Mac OS X lacks man pages for Cmake, so I can't RTFM. And the search hits I am finding discuss how to build Cmake packages (and other stuff package maintainers would do), and not how to use it as a dumb project user.
I tried to simply use Cmake in place of Configure, but it did not work:
$ cd project/build
$ OTHER_OPTIONS=" --enable-libcpp"; cmake ../llvm --enable-optimized --enable-cxx11 "$OTHER_OPTIONS" --prefix=/usr/local
CMake Error: The source directory ".../clang-3.6/build/--prefix=/usr/local" does not exist.
Why is Cmake treating a configuration option like a directory (--prefix=/usr/local)?
How do I configure and build a project that uses Cmake as a dumb project user?
You're trying to configure a CMake project like it was autotools. The syntax of the command is;
cmake -Doptions -Dmore_options src_dir
src directory is the last argument, which is why it treats --prefix that way. You will need to know the name of the parameters available to you though. If you're new to CMake, your best bet is to run, either the Qt gui or the curses gui ( ccmake /path/to/src while your in the build directory ). Those gui tools will let you pick your options, configure then generate. Then all you need is to type make ....
Note
cmake --help
does provide info even if your man pages aren't installed. Also, if you have access to google and the internet, searching "cmake man page" should give you access the your missing man pages.

MonoDevelop ValaBinding install failed

I installed monodevelop in ubuntu 13.04 from git with the help of README.md, but I received an error
checking for LIBVALA... no
configure: error: Package requirements (libvala-0.12 >= 0.12) were not met:
No package 'libvala-0.12' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBVALA_CFLAGS
and LIBVALA_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I have installed libvala-0.20-0 and libvala-0.20-dev by apt-get.
I have googled for this question and found some links,but helpless.
my mono was at version 3.6.1.
THX FOR HELP.
update 2014-06-19
I found the config.log file and see the error
configure:4075: checking for LIBVALA
configure:4084: $PKG_CONFIG --exists --print-errors "libvala-0.12 >= $LIBVALA_REQUIRED_VERSION"
Package libvala-0.12 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libvala-0.12.pc'
to the PKG_CONFIG_PATH environment variable
Although I have installed libvala-0.20-0 and libvala-0.20-dev, I doesn't own a libvala-0.**.pc file.
What can I do the next?
I have resolved thest problem by finding a libvala-0.12.pc file :)
While the Vala language, valac, and most of the bindings distributed with Vala are meant to be API stable, libvala is not. libvala-0.20 provides a very different API/ABI from libvala-0.12, and apparently MonoDevelop's Vala plugin hasn't been updated since Vala 0.12.
If you don't want the Vala plugin, I'm sure MonoDevelop provides a way to disable it (probably passing --disable-vala or something similar to ./configure). If you need the Vala plugin, though, you'll have to install libvala-0.12 or update the plugin to use a newer version of libvala.
now the problem is solved.
I used cn.archive.ubuntu.com/ubuntu for my apt-get.
These's no libvala-**.pc file in the package.
So whatever version I installed by apt-get, I can not get a libvala-*.pc file.
I searched in google for libvala-12.0.pc and changed my source to cz.archive.ubuntu.com/ubuntu, then I got that file.
Now I can run my monodevelop with valabinding.
Thx for #nemequ , I didn't use a higher libvala, so I don't know if it will be different when using a libvala-hight-than-12.0.pc file.
Hope these is usefull for others.
If you don't want to install vavabind after configure once ,just use ./configure --select, it's written in README. My bad :(

MySQL include files from Cygwin gcc

How can I set up MySQL so that i can have header-files and libraries in my Cygwin gcc C++ builds?
I have seen descriptions on the web, but it seems to refer to stuff I don't have, Like "configure.
(I suspect MySQL has changed their build system).
Using an older version could be an option, but I would prefer to have the same versions as on Linux.
I have a full Cygwin install.
First, what's wrong with just using the Windows version? It works fine.
Then, I've wanted to do the same thing as you, and it can be done. Note that I haven't attempted to build the server; all I was interested in was the MySQL client library so I could do some simple client development in the Cygwin environment.
So what do you have to do in order to build the client library on Cygwin?
First, get the tarball. I used mysql-5.5.13.tar.gz. Unpack it in a suitable location, like /usr/local/src.
Then, install the CMake build system via the Cygwin installer. MySQL has switched from GNU Autotools to CMake. CMake is a meta-build system. It generates Makefiles and other build scripts for specific build environments.
Of course, you also need make and gcc.
I had to apply an innocuous little patch posted on the MySQL forum by one Hiroaki Kawai in order to get the stuff to compile:
Finally, I renamed all dtoa() to _dtoa() in mysql/strings/dtoa.c.
The function is static, and should be safe to be renamed.
You can patch using Perl:
perl -pi.orig -e 's/\bdtoa\b/_dtoa/g' strings/dtoa.c
Then, in the top source directory, type:
cmake .
make mysqlclient
You'll get two static libraries in libmysql/, libclientlib.a and libmysqlclient.a. I don't know that the former is (possibly just a build artefact), but the latter is the real thing.
cp /usr/local/src/mysql-5.5/libmysql/libmysqlclient.a /usr/local/lib/
But it's static, and you likely want a dynamic library. This is where the Cygwin docs come in handy. So:
module=mysqlclient
gcc -shared -o cyg${module}.dll \
-Wl,--out-implib=lib${module}.dll.a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import \
-Wl,--whole-archive lib${module}.a \
-Wl,--no-whole-archive -lz
That'll create the shared library cygmysqlclient.dll and the import library libmysqlclient.dll.a. Copy both to /usr/local/bin. And that's it.
Here's another question on building the MySQL client library on Cygwin.