FAQ Database Discussion Community


How to ask Cmake output googletest detailed result

c++,cmake,googletest
Normally, if I type make test with the cmake generated makefile, it will show something like this: Start 1: UnitTest 1/2 Test #1: UnitTest .........................***Failed 0.01 sec Start 2: PerfTest 2/2 Test #2: PerfTest ......................... Passed 0.01 sec 50% tests passed, 1 tests failed out of 2 Total Test time...

Unable to build GLFW with CMake errors

c,cmake,glfw
I downloaded the latest GLFW source (3.1.1) from its site, uncompressed it to the desktop, and tried to build it with cmake. Some dependency errors popped up, but was quickly fixed. Until I got stuck on this one: [email protected]:~/Desktop/glfw-3.1.1$ cmake . -- The C compiler identification is Clang 3.6.0 --...

Glew undefined reference linking error

c++,cmake,glew
I'm running into a linking error from cmake when I attempt to build my project in CLion. I've tried what the other threads said: Putting opengl last and glu first, changing the order of my includes and setting the cmake option GLEW_STATIC but none of them have fixed it or...

cmake — let a subdirectory use its own Makefile

c++,linux,makefile,cmake
I have a project that primarily uses CMake. However, there is a subdirectory from a 3rd party / legacy library. It has a Makefile that will compile itself into a 3rd_party.a library file. Can my own CMakeLists.txt manage to call that Makefile, generate its 3rd_party.a library, and let my code...

Clang linker says symbols undefined [duplicate]

c++,cmake
This question already has an answer here: Why can templates only be implemented in the header file? 9 answers Clang has been giving me the following output when I try to compile my custom linked list test in clion... Scanning dependencies of target C__DataStructures [ 33%] [ 66%] Building...

Converting Makefiles to CMAKEList (compilation successful but the program behave differently) [closed]

c++,makefile,cmake
I would like to ask how to convert Makefile to CMAKEList. Currently I can compile CMAKEList. However, the program doesn’t behave like the program generated out of Makefile program. details: 1. This is my Makefile #=========================================================================== # Makefile for behavior_program #--------------------------------------------------------------------------- # [Update log] #=========================================================================== TARGET = PFforAEV0.2.2 CC =...

CMake does not find OpenCV libraries

c++,opencv,linker,cmake,make
Similarly to this question, I have troubles using OpenCV and CMake on OS X 10.10.3. After much hassle, I finally managed to build the OpenCV 3.0 beta on my system; the headers now reside in /usr/local/include and the libs – as they should – are in /usr/local/lib. I have small...

cmake disable optimization with /Od

cmake
The CMAKE_BUILD_TYPE is Release, I tried this to disable the optimization: set(CMAKE_CXX_FLAGS "-Od ${CMAKE_CXX_FLAGS}") but it doesn't work, it displays: cl : Command line warning D9025 : overriding '/Od' with '/O2' How to set the optimization level in cmake? Thanks....

Can I use CMAKE_SYSTEM_PROCESSOR, defined in a toolchain file, in CMakeLists?

c++,cmake,arm,raspberry-pi,cross-compiling
I'd like to add Raspberry Pi as a cross compilation target to a C++ project which uses CMake. Following the accepted answer to this question, I've set up the environment successfully. The project has many build targets already, all of them defined in the main CMakeLists.txt in a quite ugly...

How to use different tool chains

cmake,cross-platform
In a project where some targets are to be build and run on the build platform and other targets are to be build for a cross platform; what options do we have, when using cmake? Currently I use CMAKE_BUILD_TYPE to define tool chain, build type and platform (for example -D...

How do I list the defined make targets from the command line?

cmake
I feel almost silly for asking this but I couldn't find anything on this... Suppose I have a cmake project containing a number of targets: libraries, executables, external targets, ... . How do I list them using the cmake command line interface. I want a list of things that are...

CMake and CTest: automatically run test's dependencies

c++,c,testing,cmake,ctest
In my CMakeLists.txt I have something like this: set_property(TEST testX APPEND PROPERTY DEPENDS testY) set_property(TEST testX APPEND PROPERTY DEPENDS testZ) And I want some way to run testX and all its dependencies automatically. Something like: ctest <options> testX and as a result, CTest will run textY, testZ and testX. Is...

Configuring CMake to re-compile source when unit testing

unit-testing,cmake
I have a project structure defined below with both src and test directories. ├── CMakeLists.txt ├── src │   ├── CMakeLists.txt │   ├── table.c │   └── table.h ├── test │ ├── CMakeLists.txt │ └── test_table.c ├── build ├── src [src build] └── test [src + test build with UNIT_TESTING defined] I'd...

CMake - How to create executable, but not add to “all” target?

cmake,target,ctest
Using CMake, I have a series of executables that are built, then added as tests, like this: set(TestID 1) add_executable (Test${TestID} Test${TestID}.cpp) # Create test configure_file(${TestID}.endf ${TestID}.endf COPYONLY) add_test( NAME ${TestID} COMMAND Test${TestID} ) This works fine—the executables are created and the tests are correctly added. However, I don't want...

How can I use CMake to link vtk library to multiple source file?

c++,cmake,vtk
Here is a typical Cmakelist file with only one source file: cmake_minimum_required(VERSION 2.8) PROJECT(test) find_package(VTK REQUIRED) include(${VTK_USE_FILE}) add_executable(test MACOSX_BUNDLE test) if(VTK_LIBRARIES) target_link_libraries(test ${VTK_LIBRARIES}) else() target_link_libraries(test vtkHybrid vtkWidgets) endif() The above example is if I have test.cxx and CMakeLists.txt only. What do I do if I also have a test2.cxx source...

What is the location to install .cmake extension files in Ubuntu?

ubuntu,installation,cmake
I am working on various projects, some of which offer a .cmake extension which I want to install whenever the development package of the project is installed on your Ubuntu system. The modules of cmake 2.8 are saved under /usr/share/cmake-2.8/Modules/... and I thought that was were I would want to...

c++: Undefined reference to ERROR

c++,cmake,ros,cpd
I want to add new c++ library of cpd (https://github.com/gadomski/cpd) to one project in ROS. I have already successfully installed the cpd library in my Ubuntu OS. Now I want to use it under ROS environment. In the CMakeList.txt file, I already added the line of find_package(CPD REQUIRED) include_directories(include ${catkin_INCLUDE_DIRS}...

CMake error while running tar

cmake
I am trying to copy a directory using a CMake script. execute_process(COMMAND ${CMAKE_COMMAND} -E tar czf "${name}.orig.tar.gz" "${folder}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Debian) but it is throwing an error. CMake Error: archive_write_header: Can't translate pathname 'files/osgModels/textures/índice.jpeg' to UTF-8 Now I end up with an archive which doesn't contain all the files. However I...

How to get IDE setup running for CustusX for plugin development?

cmake
I downloaded CustusX from the homepage and tried to follow the build instructions. (with ./cxInstaller.py --full --all -t RelWithDebInfo as last command. That went smoothly on Kubuntu 14.04. Now with everything checked out and available on the harddisk I tried to set up a project that such that I can...

CMake link library from subdirectory

c++,gcc,linker,cmake,sfml
I am trying to include SFML sources in my project. My directories are laid out like this: main SFML (subtree synced with the official git repo) src <various modules> General (here lies the binary) From the main level I am adding SFML subdirectory first and then src. As I've seen...

Qt Creator does not find Boost via CMake, CMake itself does

boost,cmake,qt-creator
I have a project which uses Boost and Qt and is compiled using CMake. When I build it using cmake … -DCMAKE_RELEASE_TYPE=Release -G ninja and build it using ninja, it works just fine. To to UI and debugging, I would like to use Qt Creator. When I open the CMake...

How to set target library dynamically in cmake?

c++,boost,cmake
I use the boost_thread library. However, the name of this library in Linux is "boost_thread" but in Mac OSX is "boost_thread-mt". Now I have to change this name repeatedly and manually in different platform. I want to know how to solve this problem.

Clion and CMake messages

cmake,clion
I just started using the Clion IDE. Maybe this is written somewhere but I haven't seen it in a Google search. If I put a message() call in my CMake script, where in Clion can I see the output? These message calls are the only way that I know how...

SFML not linking statically to openal32 (links statically to all other dependencies)

c++,cmake,sfml
I compiled SFML using CMake for MinGW. After running "mingw32-make install" everything is built and installed with no errors. But when running the examples - pong.exe, sound.exe, sound-capture.exe and voip.exe all depend upon openal32.dll. I specified SFML_USE_STATIC_LIBS = true when configuring CMake and all other dependencies of the example executables...

CMake cannot find a static library using relative file paths

c++,linker,cmake,allegro
I'd like to play around with the Allegro library, but I can't seem to get my test project to link properly. To be exact, I'm getting cannot find -l<...> errors, where <...> is a file I specified using target_link_libraries. (See below for details.) For the record, I'm not all that...

How to write CMakeFile when the code use C++, but called python

python,c++,linux,makefile,cmake
I have a C++ project with a CMakeFile which works ok before. Now i write a new class in C++ but calling python to run. I kown how to write a MakeFile to build the single C++ with python, but what makes me confused is how to write the CMakeFile...

Linker error while building from source code

c++,cmake,linuxmint
I am trying to build an application from source. I am able to configure it using 'cmake .'. However, when I run 'make' it gives me this: Linking CXX executable ../../bin/lux64/Release/od_batch_launcher ../../bin/lux64/Release/libBasic.so: undefined reference to `dlopen' ../../bin/lux64/Release/libBasic.so: undefined reference to `dlclose' ../../bin/lux64/Release/libBasic.so: undefined reference to `dlerror' ../../bin/lux64/Release/libBasic.so: undefined reference to...

Protobuf cannot be linked on ubuntu

c++,ubuntu,linker,cmake,protocol-buffers
I try to use protobuf but somehow the linking fails (here just snippet): Linking CXX executable app CMakeFiles/app.dir/msg.pb.cc.o: In function `evoswarm::protobuf_AssignDesc_a_5fto_5fb_2eproto()': msg.pb.cc:(.text+0x133): undefined reference to `google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(google::protobuf::Descriptor const*, google::protobuf::Message const*, int const*, int, int, int, int, int, int)' msg.pb.cc:(.text+0x190): undefined reference to...

Building libobjc2 with CMake + Clang + MinGW on Linux

cmake,clang,cross-compiling,mingw-w64,libobjc2
I'm trying to cross compile libobjc2 from Arch to Windows. I use the following command to configure with CMake: cmake .. -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS=$CLANG_WINDOWS_XFLAGS -DCMAKE_CXX_FLAGS=$CLANG_WINDOWS_XFLAGS -DCMAKE_INSTALL_PREFIX:PATH=/opt/cross/windows/gnustep CLANG_WINDOWS_XFLAGS is defined as: export CLANG_WINDOWS_XFLAGS="-target x86_64-w64-mingw32 -nostdinc -isystem /usr/lib/clang/3.6.0/include -isystem...

CMake to find path to a file which its name contains a certain string

cmake
So I am writing a CMake module to find some libraries which is being used a lot in our company. These libraries all have different versions and are such a mess here. In a certain library, even the name of header files and binary files don't match. So I am...

Building Poco C++ libraries on Windows from commandline

visual-studio,cmake,poco-libraries
I've developed a python script for building a bunch of dependencies that I need for my project. Among them is Poco. On OS X and Linux I'm using cmake to build Poco and my first thought was to do the same for Windows. It seems, however, that the cmake pipeline...

GoogleTest CMake doesn't recognize TEST_F: Like it's not recognizing GTest something

linux,cmake,make,googletest
OK, I admit it, this is a unique case. When we build our application we are using make, so I've included my tests in a test folder under src. Then at the same level as our release folder we have created a unit-test folder that includes all of our source...

How do I create a project in Visual Studio to use OpenMesh after I've built using CMake?

c++,visual-studio,cmake
I followed the directions for compiling OpenMesh on Compiling OpenMesh Using CMake for Windows. I've went so far as to Configure and Generate. So I now have the OpenMesh.sln file. However, I don't know what the directions mean by "build OpenMesh from within Visual Studio using the newly created project...

How to install shared library and include files manually in linux?

linux,opencv,cmake,raspberry-pi
I am trying to build and install TBB library from source so that it can be used for OpenCV to take advantages of multiple cores on my raspberry pi. I was able to build TBB from source without any problems using this steps. (Source : How do I build OpenCV...

Build libfreenect on ubuntu

build,header,cmake,make,openkinect
I built the libfreenect (Open Kinect) library from sorce, but the libraries and headers are nowhere to be found. I have checked the paths specified in the configuration step, i.e., /usr/local, /usr/local/lib, usr/local/include. Has anyone faced this problem with libfreenect or any other library? ~/libfreenect/build\ $ cmake -L .. -DBUILD_AUDIO=ON...

How to avoid name clashes in cmake subprojects?

cmake
So I have setup a metaproject, which means I have one directory (the root directory) containing multiple subdirectories, each of which is a cmake project (with a valid cmakelists). The cmakelists in the root directory imports the subprojects using the cmake add_subdirectory command. Each subproject defines it's own targets (libraries...

cmake target_link_libraries() launching error Cannot specify link libraries for target “debug”

c++,api,cmake,sfml
I'm trying to link CLion and SFML (using windows, mingw w64, SFML 64, CMake) and i triied to configure the CMakeLists.txt properly. here's the cmakelist : cmake_minimum_required(VERSION 3.2) project(Test_Utilisation_SFML) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(SOURCE_FILES main.cpp) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") message(WARNING "CMake runtime output Directory : ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") add_executable(Test_Utilisation_SFML.exe ${SOURCE_FILES}) # Detect and add SFML...

Statically Linking Lua in Cmake

c++,lua,cmake
I have a project that uses GLFW, GLEW, GLM, and Lua. Previously I was using a Makefile on my Linux environment which linked the libraries, some static, some dynamic. Based on this boilerplate project I can compile and link GLFW, GLEW, and GLM to my project with Cmake. However I...

How to install SDL dev library so CMake can find it

cmake,sdl
I'm running Windows and I want to install the SDL development files in a place so that find_package(SDL) works. Should I include part of it in the PATH or what? EDITS: I created the environment variable SDLDIR and set it to the directory containing lib/ and include/ Cmake output: cmake...

Cmake to generate solution file machine independent

cmake,gsl
I tried to generate a solution file of GSL library for visual studio 2012 using cmake gui. I did that successfully and I build the library for my own computer. But when I tried to build the same solution file in my different computer, it gives me errors saying "C:/my...

Valgrind changes working directory with CTest in KDevelop

c++,cmake,valgrind,ctest
I am starting a test with Helgrind using Ctest: find_program(VALGRIND_EXECUTABLE valgrind) message(STATUS "Valgrind in ${VALGRIND_EXECUTABLE}") configure_file(project.supp project.supp) set(BOOST_TEST_ARGS --catch_system_errors=no) set(VALGRIND_HELGRIND_OPTIONS --tool=helgrind --suppressions=${CMAKE_CURRENT_BINARY_DIR}/project.supp --xml=yes --read-var-info=yes) add_test(NAME TestHelgrind COMMAND ${VALGRIND_EXECUTABLE} ${VALGRIND_HELGRIND_OPTIONS} --xml-file=${CMAKE_CURRENT_BINARY_DIR}/test.xml...

make error during building webkitgtk

linux,makefile,cmake,make
I use UBuntu 14.04 LTS. I need to build webkitgtk 2.8.3 Here is an example instruction which I have used: linuxfromscratch When I run sudo make -j8 I get following log: Scanning dependencies of target JavaScriptCore-4-gir Scanning dependencies of target fake-generated-webkitdom-headers [ 0%] Scanning dependencies of target WebKit2-fake-api-headers Scanning dependencies...

Adding headers to Cmake

compilation,cmake
I am trying to run the examples from VTK and modify them to get to what I want to render on screen. I am currently trying to add a server application running in parallel to the VTK rendering. I already have my code written for the server but I was...

CMake does not find CxxTest package

cmake,cxxtest
I wrote the following CMakeLists.txt in order to build a tester using CxxTest (it's almost the standard example provided by FindCxxTest): cmake_minimum_required(VERSION 2.8) project(tester) set(CMAKE_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") find_package(CxxTest REQUIRED) if(CXXTEST_FOUND) include_directories(${CXXTEST_INCLUDE_DIR}) enable_testing() CXXTEST_ADD_TEST(tester_executable runner.cpp ${CMAKE_CURRENT_SOURCE_DIR}/myTestsuite.h) endif() The problem is that CxxTest is not found although I have the folder cxxtest and...

Google Test separate project - How to get tests running against the C++ project

c++,cmake,googletest,clion
I am trying to figure out how to run Google Test against my C++ project using CMake. So far I have created a project called Simple and a Google Test project called SimpleTest. For the Simple Project Here's my CMakeLists.txt file: cmake_minimum_required(VERSION 2.8.4) project(Simple) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(SOURCE_FILES main.cpp NewCppClass.cpp...

CTest not detecting tests

cmake,make,ctest
I have a project with a structure ├── CMakeLists.txt ├── mzl.c ├── mzl.h └── tests ├── CMakeLists.txt ├── mzl-communication-test.c ├── mzl-setup-test.c ├── mzl-test-errors.c └── mzl-test-errors.h Where the top directory CMakeLists.txt file is project(mzl) cmake_minimum_required(VERSION 2.8) add_subdirectory(tests) # Enable testing for the project enable_testing() # Find zmq find_library(ZMQ_LIB zmq REQUIRED) message(STATUS...

Using Cmake's RelWithDebugInfo as Default Build Type

c++,c++11,build,cmake
Are there any drawbacks to using RelWithDebInfo as the default build type when developing an application and for distributing it? I thought about this after having a problem that occur in release mode but not in debug mode. And since then, I'm using RelWithDebugInfo build type as default. I still...

CMake fails to find boost libraries (CGAL, Windows)

c++,boost,build,cmake,cgal
I saw dozens of identical questions about this issue. None of their answers worked for me I'm afraid. I'm trying to install CGAL. I'm following the following tutorial describing the process step-by-step. The only difference is that I'm using CodeBlocks and I've selected "Specify native compilers" and pointed them to...

Cross compile stunnel

linux,makefile,cmake,arm,cross-compiling
I am having difficulties with cross compiling stunnel for an ARM device. Cross compiling OpenSSL was done via this CMake project: http://www.valvers.com/open-software/projects/openssl-cmake/ and it runs successfully on the target device. The CMake toolchain file I use when compiling OpenSSL: SET(CMAKE_SYSTEM_NAME Linux) SET(CMAKE_C_COMPILER /home/elias/toolchains/axotec/3.4.1/bin/arm-linux-gcc) SET(CMAKE_CXX_COMPILER /home/elias/toolchains/axotec/3.4.1/bin/arm-linux-g++) SET(CMAKE_FIND_ROOT_PATH /home/elias/toolchains/axotec/3.4.1/arm-linux...

Link target to libraries

makefile,cmake,mingw,cmake-gui
I have a "CMakified" version of CryptoPP and I am using CMake-GUI to create a MakeFile which ming-make could process as shown in the image below. The "MakeFile" creation was successful but when I executed mingw32-make.exe I got below errors at the very end. Linking CXX executable cryptest.exe CMakeFiles\cryptest.dir/objects.a(test.cpp.obj):test.cpp:(.text+0x8e82): undefined...

Cant include /usr/include/linux files

c++,linux,cmake
This may come as a newbie question, but I am having a very porous knowledge of C++/CMake and only a slightly better understanding of linux itself. The situation: I am sitting at an Debian 8 operated machine as a normal user (no root available) and I am trying to compile...

CMake simple MVC structure

c++,model-view-controller,cmake
I have a simple question about how to organize my simple MVC application in C++. I'm new to CMake and I'm just learning how to use it. Imagine a simple folder organization like the following: -Can someone please tell me if this structure is correct? -If so what is the...

Having issues with using libraries and CMake

c++,cmake
C:\Program Files (x86)\JetBrains\CLion 1.0.1\bin\cmake\bin\cmake.exe" --build C:\Users\Anthony\.clion10\system\cmake\generated\d04e461a\d04e461a\Debug --target all -- -j 8 -- Configuring incomplete, errors occurred! CMake Error at CMakeLists.txt:19 (add_library): See also "C:/Users/Anthony/.clion10/system/cmake/generated/d04e461a/d04e461a/Debug/CMakeFiles/CMakeOutput.log". add_library cannot create target "Majick" because another target with the same name already exists. The existing target is an executable created in source directory...

Building vtk with QT5 windows 8

windows,cmake,qt5,vtk
I'm facing a rather weird error. I can see on the wiki that we can build vtk with support for qt5. However, when trying to do so and first configuring with cmake I get the following output: CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/FindQt4.cmake:1326 (message): Found unsuitable Qt version "5.4.2" from...

Strip filename (shortest) extension by CMake (get filename removing the last extension)

cmake
get_filename_component can be used to remove/extract the longest extension. EXT = File name longest extension (.b.c from d/a.b.c) NAME_WE = File name without directory or longest extension I have a file with a dot in its name, so I need the shortest extension: set(MYFILE "a.b.c.d") get_filename_component(MYFILE_WITHOUT_EXT ${MYFILE} NAME_WE) message(STATUS "${MYFILE_WITHOUT_EXT}")...

Cmake errors: The CXX Compiler identification is unknown, The C compiler identification is unknown

c++,opencv,cmake,arm,cmake-gui
I'm trying to install OpenCV on Fedora 21 with a cross compiler for ARM processor. However, when i try to configure using Cmake 3.03, it gives the error: *The CXX compiler identification is unknown The C compiler identification is unknown Check for working CXX compiler: /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ Check for working CXX...

Clion: How to properly add images, xml, resources… to cmake

c++,cmake,clion
I can use copy but it doesn't update on each build and symlinks its not a good way to do that. Thanks

Add LLVM to project using cmake

c++,cmake,llvm,llvm-c++-api,llvm-3.0
I'm trying to add LLVM to a cmake project, using cygwin as a compiler. I downloaded LLVM from cygwin's installer (just installed all of the llvm related packages). The files are there, however I cannot include LLVM in my project. I tried using the official guide for 3.5.2 (the version...

Creating one binary for multiple unit tests in Google's C++ Testing Framework

c++,unit-testing,cmake,googletest
Currently I have a test folder with multiple source files for each test. On CMake, I previously defined a binary for each source file but decided that I should now combine all of them into a single binary and make use of the filters in GTest to select which tests...

Excluding lines containing a specific string from REGEX REPLACE in CMake

regex,replace,cmake,exclude,ogre
This is my first post but I have been using StackOverflow for years. Thanks for helping me every time. I am writing a script in CMake that is supposed to rewrite a portion of a .cfg file (it is the resources.cfg file from Ogre 3D engine) so that: when running...

Include QtMultimedia (or whatever is needed for QSound) module using CMake

qt,cmake
My question probably boils down to "what is the module called". I'd like to use the QSound class in Qt 5.4 and apparently the "Qt5Multimedia" module is not pulled in alongside QtGui and QtCore when calling find_package(Qt5Widgets REQUIRED) So I browse my Qt 5.4 installation (locally on Debian) and in...

Cmake test : was a library compiled/linked against libc++ or libstd++?

c++,cmake,libstdc++,libc++
I am using cmake to manage my project that uses a third party library. This library could have been compiled/linked against libc++ or libstd++ (Depending on the version). I know how to tell cmake to compile/link my project against libc++ or libstdc++, but I don't know how to check if...

How can LD_LIBRARY_PATH be changed within CMake?

cmake,shared-libraries,dynamic-linking
I have a local shared library which is not in $LD_LIBRARY_PATH. I want to run my executable, but since it cannot find the shared library in the system folders, it outputs "error while loading shared libraries". A possible fix for this is to export a new LD_LIBRARY_PATH containing the local...

Install a CMake macro script from within a python package install script (using setup.py)

python,cmake,setuptools,distutils,setup.py
So I have a Python package – it’s all set up on PyPI, and on GitHub, no problem. This is something I’m relatively familiar with. What is unknown to me is: the notion of installing a CMake script as part of the python package install process. The python package in...

Cmake and Qt5 linking error

c++,qt,cmake,qt5
I'm trying to build a Qt5 project with Cmake in order to add some new librairies. The cmake goes well but I have a linking issue when building : Linking CXX executable bin/qGo CMakeFiles/qGo.dir/src/main.cpp.o: dans la fonction « main »: main.cpp:(.text+0x102b): undefined reference to « qInitResources_application() » collect2: error: ld...

How do I make cmake output fortran .mod files into a mod dir?

cmake,fortran
Is there a cmake_mod_output_directory variable I can set? Right now cmake trows all *.mod files at the root of the CMAKE_BINARY_DIR.

CMake creating shared and static library with different defines

cmake
I want to create a static and a shared library using CMake to create the build environment. Furthermore it should create an ANSI and a UNICODE version. I found this posting: Is it possible to get CMake to build both a static and shared version of the same library? which...

Clion, cMake and POCO

cmake,poco-libraries
new guy to c++ and cmake here. I decided to test out cLion and cMake. Im trying to write a simple email client for the command line. Other sources told me that the best way to implement a POP3 and SMTP functions would be to use POCO. Unfortunately, cMake is...

How to determine static lib path for boost?

c++,linux,boost,cmake
I use this for static-compiling with libboost-system and libboost-filesystem: add_library(boost_system STATIC IMPORTED) SET_TARGET_PROPERTIES(boost_system PROPERTIES IMPORTED_LOCATION /usr/lib/libboost_system.a) add_library(boost_filesystem STATIC IMPORTED) SET_TARGET_PROPERTIES(boost_filesystem PROPERTIES IMPORTED_LOCATION /usr/lib/libboost_filesystem.a) target_link_libraries(mysuperprogram ${LIBS} boost_system boost_filesystem) Problem is that on my development machine (Linux Mint 17.1) libboost_*.a files installed in...

CMAKE, SDL2 and OPENGL: Program binary is too big

c++,cmake,shared-libraries,static-libraries,sdl-2
I use CMAKE to link a program to SDL2, OpenGL and I compile tinyxml2 as a shared library. The resulting program binary is 1.4 mb but there's barely 1k lines of code in the program. I suspect some library is statically linked. I'd prefer they are linked as shared libraries....

Error : Cmake can't generate openCV

opencv,cmake,codeblocks
I am trying to instal opencv C++ with codeBlocks in Windows 8 by following this http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/ but I am blocked in step 4.when I try to generate Cmake I have this Error : CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not...

Static linking DCMTK library

c++,linux,linker,cmake,dcmtk
I use DCMTK in my application and for compilation use cmake file. cmake finds all libraries (at least headers, because in compiles source files to .o files) the only problem is that during linking it tries to find dynamic libraries for DCMTK. I compiled one as static, so I do...

Cannot link to sublibrary/internal library/embedded library with CMake's Visual Studio generator

c++,visual-studio,visual-c++,cmake
The full error is available at AppVeyor. I create a library using CMake's add_library command, but when I try to compile another target to this library, I get silly errors like LINK : fatal error LNK1104: cannot open file '..\Debug\boost_http.lib' [C:\projects\boost-http\build\test\algorithm.vcxproj]. Other CMake generators do fine. How to properly handle...

cmake command to verify libraries?

c++,linker,cmake
Is there a cmake command that is equivalent to "otool -L" ? I would like to have this information for a third party library before I add it as a target to my project....

CMake issues with trying to include my source files

c++,cmake,sfml,clion
I am trying to use the CLion IDE on Linux and I am migrating my SFML application over. It insists I use CMake which I am currently having problems with. cmake_minimum_required(VERSION 2.6) project(SFML2) include_directories("${PROJECT_BINARY_DIR} src/") include_directories("${YOUR_DIRECTORY} src") # Define sources and executable set(EXECUTABLE_NAME "SFML") add_executable(${EXECUTABLE_NAME} src/SFML.cpp) # Detect and add...

How do I set a variable to point to more than one file

cmake,glew
I need to set GLEW_LIBRARIES to point to the absolute path of glew32s.lib and glew32.lib. I can run CMake with -DGLEW_LIBRARIES=%GLEWDIR%\lib\Release\x64\glew32.lib but it only includes one lib, I need both. I figured I could do something like this: -DGLEW_LIBRARIES=%GLEWDIR%\lib\Release\x64\glew32.lib,%GLEWDIR%\lib\Release\x64\glew32s.lib but that syntax doesn't work....

Templated linkage does not work on -O2, but does on -O0

c++,cmake
I have written a C++ program which is bound using cmake and runs on a Debian machine. I am happy to say all known major bugs are corrected and I feel ready to bust it from add_definitions(-Wall) set(CMAKE_BUILD_TYPE Debug) add_definitions("-O0 -std=c++0x") all the way up to add_definitions("-O2 -std=c++0x") I did...

Cannot link Boost to CMake-based project on VS2015 RC

c++,visual-studio,visual-c++,boost,cmake
It gives the error: LINK : fatal error LNK1104: cannot open file 'boost_unit_test_framework-vc140-mt-gd-1_58.lib' [C:\projects\boost-http\build\algorithm.vcxproj] You can see the full error at AppVeyor. The build script (CMakeLists.txt and how cmake is invoked) can be found on the project repository. I've tried a lot, but nothing seems to help. Documentation doesn't help...

How to use cmakedefine preprocessor directive properly?

c++,cmake
Following this instructions, I create a headerconfig.h.in file which contains #cmakedefine USE_MYLIB. On my main.cpp file i add #include headerconfig.h.in. And, I've set too the CMakeLists.txt file for this. But, I got this: error: invalid preprocessing directive #cmakedefine What did I do wrong? Is for some reason cmake can't reade...

Cmake - not creating the dynamic links

cmake,make
The project that I am compiling is not linking my shared object file to the main program. This can be confirmed by doing the ldd command on my executable and seeing it say libba.so => not found. Inside my CMakeLists.txt file I have: add_library(ba SHARED "/usr/local/include/libba.cpp" "/usr/local/include/libba.h") target_link_libraries(ba (list of...

How can I cmake/make a CGAL binary that correctly links against a libassimp dylib on OSX?

c++,osx,cmake
I think this is very simple for someone who knows about this stuff; please over-explain because I'm not used to cmake or command line development on OSX. I am getting started with CGAL and have one of the examples correctly buildings and running from Terminal (http://doc.cgal.org/latest/AABB_tree/ section 3.2). I copy...

CMake custom builds issues

build,cmake,emscripten
I am trying to use CMake to build a custom project, which involves using emscripten to provide javascript binding for my C++ library. This is what I want my CMakeLists.txt file to achieve Specify source locations for my files (DONE) Set up relevant COMPILERS to use as well as compiler...

How to compile LLVM against a custom glibc?

vim,cmake,clang,llvm,glibc
I'm using YouCompleteMe Vim plugin for text completion (installed through Vundle). YouCompleteMe uses Clang for text completion for C-family languages (C, C++, Objective-C, Objective-C++). However, after YouCompleteMe update (via :VundleUpdate in Vim) YouCompleteMe ceased to work. In short, the question is: How can I compile Clang against a custom glibc...

CMake: Adding command line arugments to project

cmake,command-line-arguments
My question is somewhat similar to this SO but not the same. I created a HelloWorld program with the following: add_executable( HelloWorld ${SRC} ) When I generate a project file (for example a Visual Studio .sln file, or a XCode .xcodeproj file). I want to hit the run button and...

how to make sure that cmake codes will run after subdirs

c++,cmake
Just give a small example to illustrate my problem: project(Test) set(TestLibName mytest) subdirs(src) # will generate mytest.dll dynamic library set_property(TARGET ${TestLibName} PROPERTY FOLDER "test") In this small script, I want to generate the dynamic library with the CMakeLists.txt file in src foler, and after that I will set the library's...

Do you only need to build the googletest library once?

c++,cmake,make,static-libraries,googletest
So firstly I'm new to testing frameworks and relatively new to C++ but am trying to wrap my head around GoogleTest. I'm working on a Windows machine, running "Git for Windows" (MSYS) and MinGW whilst using Sublime Text as my code editor. I am using make as my build tool,...

Use shell command as INSTALL_COMMAND to ExternalProject_Add

shell,cmake
Is it possible to use any shell command for the INSTALL_COMMAND phase of cmake's ExternalProject_Add? e.g. ExternalProject_Add(leveldb GIT_REPOSITORY [email protected]:google/leveldb.git GIT_TAG v1.18 CONFIGURE_COMMAND ./build_detect_platform build.settings . BUILD_COMMAND make -j 8 BUILD_IN_SOURCE 1 INSTALL_COMMAND "") # INSTALL_COMMAND "mkdir -p ${CMAKE_BINARY_DIR}/lib/ \ # && find . \( -name \"*${CMAKE_SHARED_LIBRARY_SUFFIX}\" -or -name \"*${CMAKE_STATIC_LIBRARY_SUFFIX}\" \...

How to change the name of the output binary to not be a.out with CMake?

cmake
Where would I go within CMakeLists.txt in order to change the name of the generated file?

Expected build-failure tests in CMake

c++,cmake,automated-tests,ctest
Sometimes it's good to check that certain things fail to build, e.g.: // Next line should fail to compile: can't convert const iterator to iterator. my_new_container_type::iterator it = my_new_container_type::const_iterator(); Is it possible to incorporate these types of things into CMake/CTest? I'm looking for something like this in CMakeLists.txt: add_build_failure_executable( test_iterator_conversion_build_failure...

How to include a cmake Makefile after a target has been executed?

cmake
Given the following minimal example. cmake_minimum_required(VERSION 2.8) project(include_test) add_custom_command(OUTPUT OtherCMakeLists.txt COMMAND "${CMAKE_CURRENT_BINARY_DIR}/create_other_cmakelists") add_custom_target(do_something DEPENDS OtherCMakeLists.txt) What do_something should do here is first create OtherCMakeLists.txt. Now, let's assume that do_something has to do something else afterwards, e.g. compiling some code. I'd like that when the targets from something else are executed,...

GoogleTest CMake and Make tests not running

c++,linux,makefile,cmake,googletest
I admit I have a unique situation. We build our application using Make. But my IDE, CLion, uses CMake. So I have tried to set up GoogleTest to run on both (kind of). I can compile my code both ways (using make at the command line and build from my...

Two different CMake difinitions

cmake
With CMake when some definitions are defined they are defined in this way: add_definitions(-DMY_DEFINITION) Sometimes I see people make the definitions in a different way: add_definitions(-DMY_DEFINITION=1) Then my question is what's the difference between them in the generated C++ project. Thanks. ...

Static linking usign cmake

c++,cmake,static-linking
I tried to static linking libstdc++-6 and libgcc_s_seh-1.I'm using Clion who use cmake. I'm using SFML but it's not necessary that it's dynamically linked. Thanks cmake_minimum_required(VERSION 2.8.4) project(Game_Project) set(EXECUTABLE_NAME "Game_Project") # Enable debug symbols by default if(CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE Debug) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") endif() # (you can also...

CMake link shared library

cmake
I am trying to link shared library using cmake. The library is located at known location /home/username/lib. I have added find_library to CMakeLists.txt to find the library. By running ccmake I verified that the library was correctly localized. But when I generate makefile and call make I get error: /user/bin/ld:...

How can I configure CMake generated Eclipse project's Build Command and Project Paths?

cmake,eclipse-cdt
Our project uses CMake to configure our code. We use Ninja along with a distributed build system. A number of people on our team use Eclipse CDT. We run CMake with the "Eclipse CDT4 - Ninja" generator and the result is generally pretty good. The issues is that any time...

What is the name of CMake's default build target?

c++,c,build,cmake
I have a custom target, and I want it to depend on the default target (the one that is built with make). add_custom_target(foo ....) add_dependency(foo default_target_name_goes_here) What is the name of the default target? I've tried ALL, ALL_BUILD, MyProjectsName, DEFAULT,... Finding anything in the CMake documentation is always an unsuccessful...

cmake add_custom_command and DEPENDS/TARGET

cmake,add-custom-command
I have this in my toplevel CMakeLists.txt: add_subdirectory (src) # add_executable (${PROJECT_NAME} ${_SOURCES}) add_subdirectory (data) In data subdirectory I want to create a file, when ${PROJECT_NAME} is build. The following doesn't work, returns target "foo" does not exist: add_custom_command( OUTPUT "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.desktop" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" COMMAND ${INTLTOOLMERGE} -d -u ../po ${PROJECT_NAME}.desktop.in "${PROJECT_NAME}.desktop"...

Why does CMake FILE(READ) ignore commas in my file?

cmake
I have a css file (which I want to parse and adapt for Qt, but that's not the problem). Let's say this one: QLineEdit:hover:not(focus), QWidget QPlainTextEdit:not(hover):not(focus) { border-color: #5575b0; } I made a CMake script to replace not(...) by !... : that part of the script works correctly. The problem...

How to deal with libraries like Boost when cross compiling for arm?

ubuntu,cmake,g++,cross-compiling,beagleboneblack
I'd like to cross compile from my AMD64 desktop to ARM7 for Beagleboard Black. So I started with this to get the cross compilers installed: sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf I also created a cmake toolchain file: set (CMAKE_SYSTEM_NAME Linux) set (CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) set (CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) When I run cmake,...

cmake - Is it possible to link executable to shared library with relative path at runtime?

c++,cmake,shared-libraries
Lets say I have this: ../project_dir main.cpp mylib.cpp mylib.h Building steps will be: g++ -c mylib.cpp -o mylib.o g++ -shared -o libmylib.so mylib.o g++ -L$(pwd) -Wl,-rpath='$ORIGIN' -o exec main.cpp -lmylib exec will be my binary executable output. When I testing with: ldd exec the output line is: libmylib.so => /full/path/to/build/directory/libmylib.so...