cmake

How to conditionally add ALL option to add_custom_target()?

本秂侑毒 提交于 2021-01-29 04:20:55
问题 I would like to conditionally include the target docs_html to ALL if user selects ${DO_HTML} switch in cmake-gui . How to do without this ugly code repetition? cmake_minimum_required(VERSION 3.3 FATAL_ERROR) project(docs) set(DO_HTML 1 CACHE BOOL "Whether generate documentation in static HTML") if (${DO_HTML}) #This command doesn't work: # add_dependencies(ALL docs_html) add_custom_target(docs_html ALL #Code repeat 1 DEPENDS ${HTML_DIR}/index.html ) else() add_custom_target(docs_html #Code

Static linking against Qt on Windows using CMake

无人久伴 提交于 2021-01-29 03:24:02
问题 I'm working on a Qt project that is developed on Linux, but also has a statically linked Windows build. I can build it on Linux and Windows using the same CMakeLists.txt file. It strips down to: project(muckturnier) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_REQUIRED TRUE) find_package(Qt5 COMPONENTS Widgets Sql) include_directories(${Qt5Widgets_INCLUDES} ${Qt5Sql_INCLUDES}) set(CMAKE_AUTOMOC ON) set(muckturnier_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/SomeCode.cpp) add_executable(muckturnier $

Static linking against Qt on Windows using CMake

烈酒焚心 提交于 2021-01-29 03:17:29
问题 I'm working on a Qt project that is developed on Linux, but also has a statically linked Windows build. I can build it on Linux and Windows using the same CMakeLists.txt file. It strips down to: project(muckturnier) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_REQUIRED TRUE) find_package(Qt5 COMPONENTS Widgets Sql) include_directories(${Qt5Widgets_INCLUDES} ${Qt5Sql_INCLUDES}) set(CMAKE_AUTOMOC ON) set(muckturnier_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/SomeCode.cpp) add_executable(muckturnier $

How to use CMake to build multiple platforms from one master CMake project without cache problems

别说谁变了你拦得住时间么 提交于 2021-01-28 22:41:15
问题 I have two projects called A and B that have complete working CMakeLists.txt projects, and each project can be built completely without errors. I would like to have a master project defined in CMake that will build both A and B (and maybe a hundred other things eventually). My top level CMakeLists.txt project looks like add_subdirectory(A build-A) add_subdirectory(B build-B) and CMake can parse all the files and make can start building just fine. The problem is that project A is for one

How would I include asio library using CMake?

社会主义新天地 提交于 2021-01-28 22:20:20
问题 I am trying to work on a project for a class and I want to use CMake to build the project. My current project looks like |-bin |-CMakeLists.txt |-include |-asio-1.12.2 |-chat_message.hpp |-chat_message.cpp |-CMakeLists.txt |-src |-Server.cpp although my Server.cpp needs asio.hpp that is in /include/asio-1.12.2/include . The professor has a makefile that compiles it with the flags -DASIO_STANDALONE -Wall -O0 -g -std=c++11 -I./include -I./include/asio-1.12.2/include . My CMakeLists files look

Yocto How to stop cmake to look in a native sysroot path for linking?

落花浮王杯 提交于 2021-01-28 22:05:55
问题 I'm trying to add dlib python module into my image so far this is the recipe i'm working on... # python3-dlib_19.21.1.bb SUMMARY = "A toolkit for making real world machine learning and data analysis applications" HOMEPAGE = "https://pypi.python.org/pypi/dlib" PYPI_PACKAGE = "dlib" LICENSE = "Boost-Software" SRC_URI[md5sum] = "1e7e357d7d54e86267ef60f606cb40e1" LIC_FILES_CHKSUM = "file://dlib/LICENSE.txt;md5=2c7a3fa82e66676005cd4ee2608fd7d2 \ file://dlib/external/libpng/LICENSE;md5

Command line tools not accessible from Eclipse on OSX

冷暖自知 提交于 2021-01-28 21:26:19
问题 I am using Eclipse on a macOS machine. CMake is present on my machine at /usr/local/bin/cmake and has been installed using Homebrew. Eclipse is at the latest version (2018-09). I have the following target in a Makefile, which has been set up and is visible from Eclipse: all: ./configure Rscript -e "Rcpp::compileAttributes()" R CMD INSTALL --no-multiarch --with-keep.source . Inside the configure file, there is this code: cd src/build;cmake .. However, when I double click the all target in

Prebuilding grpc and find_package

混江龙づ霸主 提交于 2021-01-28 18:15:10
问题 I'd like to link my application with a prebuilt gRPC 1.30. The directory structure that I want: - project root - external + gRPC - src ... my source code here ... I've built gRPC: git clone --recurse-submodules -b v1.30.0 https://github.com/grpc/grpc cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX="D:/grpc" -A x64 .. cmake --build . --target install --config Release The final structure of files produced in D:/grpc is weird... the topmost cmake folder contains protobuf

Using cmake for a project with sub/external projects/dependencies

孤者浪人 提交于 2021-01-28 14:02:16
问题 I am actually imroving my c++ skills with a project that uses PocoProject as a framework for supplying a simple rest webserver and json parsing as well as a mongodb driver. I am compiling my project with cmake/make my directory structure is: root - pocoproject - helloworld.cpp - CMakeLists.txt To test cmake, I have a simple cpp file (taken from the poco examples) that starts a http-server. the includes are the following: #include "Poco/Net/HTTPServer.h" #include "Poco/Net/HTTPRequestHandler.h

Creating C# and C++/CLR projects in the same solution using CMake (CMake targeting visual studio)

微笑、不失礼 提交于 2021-01-28 14:00:36
问题 I want to create a solution in MSVC using CMake that has two projects (in CMake vocabulary one C# executive and one C++/CLR library). How can I do this? All examples that I found are about one type of project in a CMake (all C++ or C#). To clarify: If I want to create a C++/CLR project using CMake, I can write code like this: cmake_minimum_required (VERSION 3.5) project (TestCppClr) if (NOT MSVC) message(FATAL_ERROR "This CMake files only wirks with MSVC.") endif(NOT MSVC) ADD_EXECUTABLE