cmake

Using pre-compiled headers with CMake

I have seen a few (old) posts on the 'net about hacking together some support for pre-compiled headers in CMake. They all seem a bit all-over the place and everyone has their own way of doing it. What is the best way of doing it currently? ...

Learning the source code's filename at compile time

I'm using GCC; __FILE__ returns the current source file's entire path and name. Is there a way to get just the file's name and not its whole path too (at compile time)? Is it possible to do this in a portable way? Can template meta programming be applied to strings? I am using this in an error logging macro. I really do not want my sour...

How to automatically add header files to project?

How would I go about having a CMake buildsystem, which scans for source files now using AUX_SOURCE_DIRECTORY, scan for header files too in the same directory, preferably using a similar command? I didn't find an easy way to do this in the documentation yet, so I now have a crappy bash script to post-process my (CodeBlocks) project file....

QAbstractTableModel inheritance vtable problem

Here's another problem with qt: I extend a QAbstractTableModel, but I get a compiling error ( I'm using cmake) // file.h #ifndef TABLEMODEL_H #define TABLEMODEL_H #include <QAbstractTableModel> class TableModel : public QAbstractTableModel { Q_OBJECT public: TableModel(QObject *parent = 0); int rowCount(const QModelIndex &parent = QM...

Using cmake to generate visual studio C++ project files

Hi, I am working on an open source C++ project, for code that compiles on Linux and Windows. I use cmake to build the code on Linux. For ease of dev-setup and political reasons, I must stick to visual studio project files/editor on Windows (I can't switch to Code::Blocks, for example). I see instructions to generate visual studio files...

Call cmake from make to create Makefiles?

I am using cmake to build my project. For UNIX, I would like to type make from my project's root directory, and have cmake invoked to create the proper Makefiles (if they don't exist yet) and then build my project. I would like the cmake "internal" files (object files, cmake internal Makefiles, etc.) to be hidden (e.g. put in a .build ...

Best crossplatform C++/QT4 development environment

Hi! I would like to develop cross-platform applications using C++ and QT4. I code on both Linux and Windows (MinGW). Currently I'm using KDevelop and it's QMake integration. On Windows I'm trying out Eclipse with QT integration plugin. However moving sources and updating profiles/IDE project files on both systems is tedious. I'm looki...

Any way in CMake to require GCC version 4+?

I am using some features that are provided in GCC v4+ and would like CMake to find GCC v4 compiler and if it does not find it, return an error stating GCC v4 is required. Anyone have any modules / ideas on how to do something like this? Thanks. ...

Build System and portability

I'm wondering how i can make a portable build system (step-by-step), i currently use cmake because it was easy to set up in the first place, with only one arch target, but now that i have to package the library I'm developing I'm wondering how is the best way to make it portable for arch I'm testing. I know I need a config.h to define t...

cmake RUNTIME_OUTPUT_DIRECTORY on Windows

I'm using cmake for managing my cross-platform builds, and I have everything worked out except for this problem. I set RUNTIME_OUTPUT_DIRECTORY to a bin/ directory where I have data files stored. On Linux, this works fine. On Windows, the executables get placed in the Debug/Release subdirectory depending on the build type. Is there any w...

Cmake : Build directory in include path

I'm looking for the good way to add the build directory (which is different from my source directory, a git repository) to the include path for gcc, in order to have the classic "config.h" file for portability seen during the compilation. ...

How do I fix an apparently corrupted CMake build?

I am getting the following error from CMakeSetup on our source tree: CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_FIND_LIBRARY_PREFIXES Deleting the cache doesn't help, so something in one of the CMakeLists must be the problem. The weird part is, if I copy...

CMake compilation error..(Unknown CMake command "QT4_WRAP_UI")

Hi, im trying to build grass plugin for qgis .. when i try to use cmake .. i get the following error after configuring.. CMake Error at CMakeLists.txt:78 (QT4_WRAP_UI): Unknown CMake command "QT4_WRAP_UI". I have Qt4 ,PyQt and python2.6 installed already.. can anyone help me how to figure out whats wrong here? Thanks. ...

How to automatically generate C header file using CMake?

I'm looking for a way to automatically generate a header file. This file is the public interface of a library and i want to "fill" some structures and stuff before compilation. For example, in the private header I have a structure with useful fields : typedef struct mystuff_attr_t { int _detachstate; mystuff_sc...

CMake: Check all header files and library functions for existence?

I'm currently converting a small C project (galarm) from autotools to CMake. In the old configure.in I checked every header and library function for existence using the following lines: # Checks for header files AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h time.h math.h sys/stat.h errno.h unistd.h fcntl.h signal.h]) # Checks for library ...

CMake : how to use bash command in CMakeLists.txt

I'm wondering how I can use bash command in CMakeLists.txt. What I want is to get the number of processor retrieved using : export variable=`getconf _NPROCESSORS_ONLN` and set NB_PROCESSOR to variable using something like : SET (NB_PROCESSOR variable) So my question is how can I use the getconf command in CMakeLists.txt and how ca...

Solved: How to retrieve a user environment variable in CMake (Windows)

I know how to retrieve a normal machine wide environment variable in CMAKE using $ENV{EnvironmentVariableName} but I can not retrieve a user specific environment variable. Is it possible and how? ...

[cmake] How to copy directory from source tree to binary tree?

Copying directory from source tree to binary tree. For example: How to copy www to bin folder. work ├─bin └─src ├─doing │ └─www ├─include └─lib Thanks. ...

eclipse indexer problem with cmake project

Hi, I've created the eclipse project with cmake. I use vtk with qt. Dir structure is as follows: parent_dir: source - source.h, source.cpp build - this is where the .project resides I've fired up the eclipse with workspace dir /path/parent . I have followed the instructions described in http://www.cmake.org/Wiki/Eclipse_CDT...

Regular expression for hidden files under unix.

I'm looking for a regex to match every file begining with a "." in a directory. I'm using CMake (from CMake doc : "CMake expects regular expressions, not globs") and want to ignore every file begining with a dot (hidden files) BUT "\..*" or "^\..*" doesn't work :( The strange thing : this works (thanks to rq's answer) and remove every ...