cmake

Cross-platform build under Windows targeting Linux using CMake

淺唱寂寞╮ 提交于 2021-02-18 10:50:29
问题 I am developing a software in C++ on windows 32-bit (using MSVC++), but since I want to be able to use my software on every platform, I have decided to use CMake as my build generator. Therefore, I am still just a beginner in CMake. From the CMake tutorials, I understand that in order to cross compile codes, first a toolchain simulating the target platform should be installed on the host platform. Then using the appropriate target-platform C and C++ compilers provided by this toolchain, CMake

CMake source_group() not working correctly with hierarchical project setup

假装没事ソ 提交于 2021-02-18 06:28:30
问题 After a change to make a CMake project have hierarchical folder management, source_group() no longer seems to be working correctly. CMake just dumps everything into the default filters. I've tried various regexes to get the relative file path from the parent for every source file and even hard coding the source files in the parent CMakeLists.txt just to see if that was the issue. I've also tried regenerating the VS project a couple times after these changes. Here's sample files for your

CMake source_group() not working correctly with hierarchical project setup

北战南征 提交于 2021-02-18 06:26:50
问题 After a change to make a CMake project have hierarchical folder management, source_group() no longer seems to be working correctly. CMake just dumps everything into the default filters. I've tried various regexes to get the relative file path from the parent for every source file and even hard coding the source files in the parent CMakeLists.txt just to see if that was the issue. I've also tried regenerating the VS project a couple times after these changes. Here's sample files for your

CMake学习笔记一:初识cmake

时光总嘲笑我的痴心妄想 提交于 2021-02-18 01:56:59
1 cmake简介 1.1 背景知识 cmake 是 kitware 公司以及一些开源开发者在开发几个工具套件(VTK)的过程中衍生品,最终形成体系,成为一个独立的开放源代码项目。项目的诞生时间是 2001 年。其官方网站是 www.cmake.org,可以通过访问官方网站获得更多关于 cmake 的信息。cmake的流行其实要归功于 KDE4 的开发,在 KDE 开发者使用了近 10 年 autotools之后,他们终于决定为 KDE4 选择一个新的工程构建工具,其根本原因用 KDE 开发者的话来说就是:只有少数几个“编译专家”能够掌握 KDE 现在的构建体系。在经历了 unsermake,scons 以及 cmake 的选型和尝试之后,KDE4 决定使用 cmake 作为自己的构建系统。在迁移过程中,进展异常的顺利,并获得了 cmake 开发者的支持。所以,目前的 KDE4 开发版本已经完全使用 cmake 来进行构建。像 kdesvn,rosegarden 等项目也开始使用 cmake,这也注定了 cmake 必然会成为一个主流的构建体系。 1.2 特点   a. 开放源代码 ,使用类 BSD 许可发布。 http://cmake.org/HTML/Copyright.html   b. 跨平台 ,并可生成 native 编译配置文件,在 Linux/Unix 平台,生成

cmake cannot find libraries installed with vcpkg

核能气质少年 提交于 2021-02-17 22:54:19
问题 I want to use vcpkg in a CMake project in Windows, because I need boost and xerces that are both handled by this package manager. I've the following CMakeLists.txt : cmake_minimum_required (VERSION 3.12.0) project (myproj) set (CMAKE_PREFIX_PATH ${XERCES_ROOT}) set (Boost_USE_STATIC_LIBS ON) set (Boost_USE_MULTITHREADED ON) unset (Boost_INCLUDE_DIR CACHE) unset (Boost_LIBRARY_DIRS CACHE) # set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules) find_package (Boost COMPONENTS

Having CMake put generated binaries in a specific directory structure with assets

六眼飞鱼酱① 提交于 2021-02-17 15:07:29
问题 My project's directory structure is basically as follows: root/src root/assets root/library I currently have CMake set up to compile the source, compile the library, and then link them, by calling make from the root directory. I then have to manually move the executable into the original assets directory to get it to run, since that's where it expects to be (and we want to test with our directory structure in assets as close to what we expect it to be when it's done). So, is there any way to

Having CMake put generated binaries in a specific directory structure with assets

岁酱吖の 提交于 2021-02-17 15:02:09
问题 My project's directory structure is basically as follows: root/src root/assets root/library I currently have CMake set up to compile the source, compile the library, and then link them, by calling make from the root directory. I then have to manually move the executable into the original assets directory to get it to run, since that's where it expects to be (and we want to test with our directory structure in assets as close to what we expect it to be when it's done). So, is there any way to

LightGBM windows installation issue - cmake - does not support platform specification

北城以北 提交于 2021-02-17 07:01:26
问题 I am trying to install LightGBM in windows 10 using cmake. I am following the process given on this link on this command cmake -DCMAKE_GENERATOR_PLATFORM=x64 .. it gives the error saying CMake Error at CMakeLists.txt:7 (PROJECT): Generator NMake Makefiles does not support platform specification, but platform x64 was specified. CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred!

Conditional Clause of add_custom_command

為{幸葍}努か 提交于 2021-02-17 05:37:05
问题 I want to take advantage of Ninja's "job pools" in my custom commands; something finally directly supported in cmake 3.15.0. Many/most people won't have this version, so I would like to simply ADD this support without requiring that anyone update their cmake version. A more general question is... "What's the best way to specify a conditional clause of a custom command …?" add_custom_command( OUTPUT foo COMMAND ${CMAKE_COMMAND} -E touch foo if("${CMAKE_VERSION}" STRGREATER_EQUAL "3.15.0") # <-

CMake cannot find freeglut on windows in Clion

心已入冬 提交于 2021-02-17 01:54:12
问题 I've been stuck for a while now and I can't figure out how to get freeglut working. I thought I knew what it was asking me to do, so I added that set(prefix_path) line but it didn't do anything. Am I supposed to write my own freeglut-config.cmake or what? Note: I am using the freeglut for MinGW package from this website CMake File: cmake_minimum_required(VERSION 3.7) project(HW1) set(CMAKE_CXX_STANDARD 11) set(SOURCE_FILES Triangle.cpp) set(CMAKE_PREFIX_PATH "C:/freeglut") find_package(GLEW