cmake

Issue on using CMAKE with MSYS/MinGW linking dll files using DevIL image library

Hi, actually i create a CMake script to localize the DevIL library using MSYS/MinGW on win32 platform. I've extend the origin FindDevIL CMake script to regard the MinGW root when try to find DevIL: project (DevILTest) cmake_minimum_required(VERSION 2.6) FIND_PACKAGE(OpenGL) IF(OPENGL_FOUND) MESSAGE(STATUS "OpenGL render API found.")...

Turning on linker flags with CMake

When generating VS2010 targets with CMake, I would like the /LTCG flag turned on (only for release + releasewithdebinfo if possible, but its okay if its on for debug builds). How do I modify the linker flags? add_definitions() doesn't work because that only modifies compiler flags. And yes, I have wrapped it in if(MSVC). How do I modify...

Using CMake with CTest and CDash

Hi , I am going to use CDash with CMake/CTest on my C++ project. In order to enable CDash and customize settings, like "MEMORYCHECK_SUPPRESSIONS_FILE", "DART_TESTING_TIMEOUT", I added the following lines in the root CMakeLists.txt set(MEMORYCHECK_SUPPRESSIONS_FILE "${CMAKE_SOURCE_DIR}/valgrind.supp") set(DART_TESTING_TIMEOUT "120"...

install(TARGETS ...) and add_subdirectory

Is it possible to use install(TARGETS ...) with targets that are defined in directories added with add_subdirectory? My use case is, that I want to build e.gg an rpm for gtest. the gtest project happens to have a CMakeLists.txt without any install statements. I want to build the package without adding those statements to the CMakeLists....

Only run C preprocessor in cmake?

I'm trying to use cmake to simplify distributing my OpenCL program. I have a kernel file which includes several headers and other source files, and I want to have a single self contained executable. My plan is to have cmake run the C preprocessor on the kernel source, turning the cl file and its includes into a single unit which is easi...

CMAKE building for cygwin

I used CMAKE to create the Visual Studios C++ project for a library that I needed to build, and then I used VC++ to build the library. However, the time has come to rebuild the same library for cygwin so that I can link to it with the GNU tool chain (g++ make gdb). I've been trying to figure out how to configure CMAKE to build for cygw...

C++ MinGW shared libraries problem (Windows only,works on Linux)?

Greetings all, I use MinGW,QT and CMake for my project. As shown in the figure, my project has two modules. libRinzoCore.DLL - a shared library which define some abstract classes and interfaces and some core functionality of the application.This module is used to implement dynamic Plugins (which are also shared libraries which auto...

How to use CPACK_RPM_POST_INSTALL_SCRIPT_FILE ?

Here is the setup I tried using CMake 2.8.2 to reproduce the problem: /test.sh: /CMakeLists.txt: cmake_minimum_required(VERSION 2.8) SET(CPACK_PACKAGE_NAME test) SET(CPACK_PACKAGE_VERSION 1.0) LIST(APPEND CPACK_GENERATOR RPM) SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "test.sh") INCLUDE(CPack) then: mkdir build && cd build && cmake...

QT Plugin with CMake

Greetings all, I am trying to implement a QT Plugin with CMake. But this "Q_EXPORT_PLUGIN2" directive stops my class from compiling. I can compile the plugin if I commented this out,but it won't work as a plugin if I do so. QT doc says: Q_EXPORT_PLUGIN2 ( PluginName, ClassName ) The value of PluginName should correspond to the...

Cmake: how to force including more than one header

Hi, I try to force including header with CMake(2.8.2) and this first solution: SET_TARGET_PROPERTIES(${MyTarget} PROPERTIES COMPILE_FLAGS "/FI\"${ForcedHeader_A}\"/FI\"${ForcedHeader_B}\"") Somehow CMake ignores (or overwrites) the first compiler flag. This happens only if the two compiler flags are the same as in this case . I ...

Qt, CMake, Visual Studio and Q_OBJECT in cpp files

Hi, I'm developing a large project using Qt 4.6, CMake 2.8 and Visual Studio 2008 for the Windows platform. As far the build system goes, it's all standard stuff: I'm using CMake's QT4_WRAP_CPP macro to generate moc files from header files, which are then linked into the final executable in the add_executable command. Everything is wor...

CMake Eclipse Build Configurations

I want to generate a Eclipse CDT project with CMake where the resulting Eclipse project contains the defined build types as selectable build configurations from within the IDE. For example: if(CMAKE_CONFIGURATION_TYPES) set(CMAKE_CONFIGURATION_TYPES PRODUCT_A PRODUCT_B) set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}"...

CMake subdirectory

Hi, I'm using CMake and I want to try and make it so I have a subdirectory for it rather than files scattered through my project or the root of it. I have a directory layout of 'project/cmake/CMakeLists.txt' and 'project/bin' and 'project/source', so people can easily remove the CMake stuff if they want to. My only problem is that there...

Problem executing custom build rules in parallel inside the VS 2010 IDE

I have a solution with several projects in it that executes many custom build steps. Some projects depend on other projects, but most of the build steps are independent of each other. When building inside the VS 2010 IDE, I am getting errors like this: error MSB6003: The specified task executable "cmd.exe" could not be run. The proc...

CMake + Link error + Whitespace in path

I'm trying to compile my CUDA project with CMake 2.8.2. My SDK is located in "/Developed/GPU Computing/" (OSX). The problem is the whitespace in the path, thus CMake doesn't find the libs. I tried: link_libraries("-L${CUDA_SDK_ROOT_DIR}/lib -lcutil") Result: i686-apple-darwin10-g++-4.2.1: Computing/C/lib: No such file or directory Doe...

Creating a directory in CMake

In CMake, I want to create a directory if it doesn't already exist. How can I do this? ...

Linking error LNK2019 in MSVC, unresolved symbols with __imp__ prefix, but should be from static lib.

Hi all, I'm running into linking problems in MSVC for a project that I wrote for g++. Here's the problem: I build libssh as a static library as part of my application, adding the target in cmake with add_library(ssh_static STATIC $libssh_SRCS) Libssh is in C, so I have 'extern "C" {...}' wrapping the includes in my c++ sources. I then...

cmake - How to set different variables for Intel compiler

Hey there, I do have a simple cmake project (on linux) that loads some libraries from custom places. I now would like to use the Intel compiler instead of the gnu compiler and add some if statement to my CMakeLists.txt that loads different libraries based on the type of compiler used. So I would specify the usage of the Intel compiler ...

Work around for maximum argument length when linking on win32

I've run into a bug on windows CMake/MinGW builds where the number of object files sent to the linker causes the arguments list to exceed the maximum 32k characters the windows API allows. This manifests itself as an amazingly unhelpful "Error running link command: The parameter is incorrect" error. Has anyone run into this before and f...

cmake best practice

When working with cmake, is it better to work with one large CMakeLists.txt in the root of the project, or as seems to be seen in some places, having one in each subdirectory too? I would assume something along the lines of for large projects, having one in each directory is better. If so, where should the threshold be? ...