cmake

CMAKE 3.3.2: Set build type in CMakeLists.txt

廉价感情. 提交于 2020-06-26 06:08:13
问题 Is there a way to set the build type from CMakeLists.txt? So that with (or without) generating a new makefile when I compile it should go with the release mode. I try something along the lines of: set(DCMAKE_BUILD_TYPE "Release") But it doesn't work (compiles in debug mode). This is on a linux system. Thanks. 回答1: It's simply: set(CMAKE_BUILD_TYPE "Release") 来源: https://stackoverflow.com/questions/34558795/cmake-3-3-2-set-build-type-in-cmakelists-txt

CMake+Xcode: Archive fails for an app depending on a library in the same solution. Make Archive build in the BUILD_TREE instead of Xcode/DerivedData?

大憨熊 提交于 2020-06-26 05:21:30
问题 We ported our codebase to use CMake for build management some weeks ago. We realize now that there is a major problem when we are trying to Archive an application that depends on one (or several) library built in the same Xcode solution. The linker fails because it cannot find the depended upon library (and the library is indeed not present where it is looking for it). minimal example Here is a minimal example producing the issue: In CMakeLists.txt ## ## The library ## project(library) add

Portable executable for CMake

纵饮孤独 提交于 2020-06-25 09:45:11
问题 I am developing on a Windows machine for which I don't have administrative privileges. I would like to use CMake to compile, and I cannot simply download and install this due to administrative restrictions. I would also like to avoid compiling CMake from source (if possible). Are there portable binaries available for Windows that would allow one to simply use CMake? 回答1: You can download a ZIP file of CMake. You can just uncompress it somewhere you are allowed to copy files and use it from

CMake CPack debian packages

寵の児 提交于 2020-06-25 02:42:44
问题 Has someone worked with a working example of a CPack script for debian packages with Qt and OpenGL dependencies? I've set this one set (CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12), libQtOpenGL (>=4.6.0), libQtCore (>=4.6.0), libQtGui (>=4.6.0), libglut (>=3.0), libICE (>=6.0), libX11 (>=6.0), libXext (>=6.0), libXmu (>=6.0), libXi (>=6.0), libstdc++ (>=6.0), libm (>=6.0), libgcc_s (>=1.0), libc (>=6.0), libGLU, libGL (>=1.0), libpthread" ) I googled around but

How do I iterate over all CMake targets programmatically?

一世执手 提交于 2020-06-24 11:22:29
问题 Is there a way to get all targets of a CMake project from within the top level CMakeLists.txt , i.e. iterate over the targets programmatically? The reason I want to do this is to apply some XCode specific settings to every target . . if (CMAKE_GENERATOR MATCHES "Xcode") include(sanitize_xcode) sanitize_xcode(myTarget) endif() FYI - the sanitization module looks like this . . macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_$

How do I iterate over all CMake targets programmatically?

霸气de小男生 提交于 2020-06-24 11:21:33
问题 Is there a way to get all targets of a CMake project from within the top level CMakeLists.txt , i.e. iterate over the targets programmatically? The reason I want to do this is to apply some XCode specific settings to every target . . if (CMAKE_GENERATOR MATCHES "Xcode") include(sanitize_xcode) sanitize_xcode(myTarget) endif() FYI - the sanitization module looks like this . . macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_$

Run a CMake-generated INSTALL.vcxproj on Windows via command line only?

匆匆过客 提交于 2020-06-24 10:25:13
问题 I have a C++ program that I'm trying to build and deploy on AppVeyor (thus, I have no GUI tools available). The dependencies of my project each use CMake for their build systems, and CMake (by default) generates Visual Studio project files on Windows. One of the generated project files is named INSTALL.vcxproj , which presumably installs the dependency somewhere more or less standard. How can I execute the build process of INSTALL.vcxproj using only the command line? Note: I am not married to

Can Android Studio use the system CMake?

浪尽此生 提交于 2020-06-24 07:17:36
问题 I'm using Android Studio + CMake to build a native library. AS requested installing CMake, even though I already have CMake installed and in my path. Can you tell AS to look for CMake at a certain location, instead of installing another CMake? 回答1: The new Android plugin for gradle 3.0 will support using system CMake, for CMake 3.7+. From that webpage: Download and install CMake 3.7 or higher from the official CMake website. Include the path to the CMake installation in your project's local

CMake: how to change compiler for individual target

你离开我真会死。 提交于 2020-06-24 06:09:04
问题 I have embedded project using cross compiler. I would like to introduce Google test, compiled with native GCC compiler. Additionally build some unit test targets with CTC compiler. Briefly: I have 3 different targets and compile them with 3 different compilers. How to express it in CMakeLists.txt ? I Tried SET_TARGET_PROPERTIES ; but it seems impossible to set CXX variable with this command! 回答1: I just had the same issue right now, but the other answer didn't help me. I'm also cross

Set the number of threads in a CMake build

无人久伴 提交于 2020-06-24 03:47:13
问题 cmake --build . --config Release Is it possible to set the number of cores to be used by the build process? I'm looking for something similar to GNU make's -j option. 回答1: According to the Release Notes, with CMake 3.12 it can be done cross-platform: The cmake(1) Build Tool Mode ( cmake –build ) gained --parallel [<jobs>] and -j [<jobs>] options to specify a parallel build level. They map to corresponding options of the native build tool. 回答2: You can pass arbitrary arguments to the native