cmake

CMake - combine multiple libraries into one

淺唱寂寞╮ 提交于 2021-01-27 09:22:32
问题 Let's say I have executables A, B, C, and I have external libraries X, Y, Z SET(EXTERNAL_LIB X Y Z) TARGET_LINK_LIBRARIES(A, ${EXTERNAL_LIB}) TARGET_LINK_LIBRARIES(B, ${EXTERNAL_LIB}) TARGET_LINK_LIBRARIES(C, ${EXTERNAL_LIB}) However, if I visualize this (using cmake --graphviz option, I get a complex bipartite graph with edges from each of the executables A, B, and C to each of the libraries X, Y, and Z. I was wondering if there's a way to combine all the libraries into one. 回答1: All of this

assimp-vc140-mt.dll ASSIMP was not found

 ̄綄美尐妖づ 提交于 2021-01-27 07:24:46
问题 I have downloaded the Assimp project from http://assimp.sourceforge.net/main_downloads.html Assimp release image assimp zip image And I've also downloaded the cmake x86 version from this link: https://cmake.org/download/ cmake x86 image I have extracted both, and made a build folder next to the assimp's folder. After that I have opened a command promt, changed the directory to the mentioned build folder. I gave the cmake.exe 's path to the command promt and the assimp folder's path as the

assimp-vc140-mt.dll ASSIMP was not found

送分小仙女□ 提交于 2021-01-27 07:23:36
问题 I have downloaded the Assimp project from http://assimp.sourceforge.net/main_downloads.html Assimp release image assimp zip image And I've also downloaded the cmake x86 version from this link: https://cmake.org/download/ cmake x86 image I have extracted both, and made a build folder next to the assimp's folder. After that I have opened a command promt, changed the directory to the mentioned build folder. I gave the cmake.exe 's path to the command promt and the assimp folder's path as the

Compilation errors with M1 MacBook Pro and cmake

不想你离开。 提交于 2021-01-27 07:08:48
问题 I have just got my new M1 MacBook Pro and am trying to compile a code base required for my university work. Here are the steps I have taken: I set Terminal to always open using Rosetta. Installed homebrew using /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Installed cmake using brew install cmake Run cmake <path to source> (this works fine) Run make (this fails) Here is the error I get: /Applications/Xcode.app/Contents/Developer/Toolchains

CMake change color in makefile

拜拜、爱过 提交于 2021-01-27 06:58:02
问题 The make files generated by CMake have a colorful output for improved readability. Is it possible to change the color? I have a green terminal font so I kind of loose the color for the messages indicating that objects are built. 回答1: I assume you are talking about the cmake added messages from the make output (and not the normal make output itself) in which case it looks like those lines are hard-coded into the generated makefiles with arguments to the cmake cmake_echo_color command that

对于opencv全面貌的认识和理解

喜你入骨 提交于 2021-01-27 05:59:27
1、opencv其实最开始只有源码,也就是sources中的代码,sources中有个modules,进入里面是各个我们平常使用的模块,如下图。 进入任意一个模块,比如calib3d,其中有include,头文件,有src,实现头文件定义的类的cpp,src文件夹下面还有一个main函数,从理论上来说我们可以把calib3d中的头文件和cpp放在一个vs的项目中,来生成解决方案,也就是做编译和执行。 但是opencv不像我们这样子做,opencv要在不同的操作系统上编译出适合本系统的静态链接库和动态链接库,之后如果我作为一个程序员,想调用calib3d的头文件中的某一个类,那么就#include <opencv2/calib3d/calib3d.hpp>就可以了。 也就是说,我们没有必要拿calib3d中的所有cpp和头文件都放在解决方案中,一个个来编译,只需要简单的一行#include调用头文件就可以了。 链接库挺方便的,关于为什么要使用链接库而不是一大堆的cpp和头文件,这个链接给出了答案 https://segmentfault.com/a/1190000008634703 ,谢谢作者的分享。 2、下载的源码sources文件夹中必定有cmakelists,这是cmake的根据。在linux系统上,cmake指令根据cmakelists生成makefile

CMake, QtCreator and header files

半城伤御伤魂 提交于 2021-01-27 05:40:13
问题 This is not exactly a compilation related problem, but much more a visual issue ... I have a project, set up with CMake (this is not a Qt project). When I open this project with QtCreator it nicely finds all the related files, and the files in the project browser are in alphabetical order like: Project + abc.cpp + abc.h + def.cpp + def.h However, if I work with QtCreator and a QMake based project, the headers and sources are nicely separated like: Project + Headers | + abc.h | + def.h +

CMake run custom command after target fails to build

浪子不回头ぞ 提交于 2021-01-27 04:41:05
问题 I know how to run a command after (or before) building a target with add_custom_command : add_custom_command(TARGET my_target POST_BUILD COMMAND echo "custom command" ) But I want to ALWAYS run this command, after the target has been build or after it failed to build . Here, when the target fails to build, the command is not launched. Is it possible to achieve this with cmake? 来源: https://stackoverflow.com/questions/39076385/cmake-run-custom-command-after-target-fails-to-build

Unable to find Lua headers with find_package in cmake

有些话、适合烂在心里 提交于 2021-01-27 03:54:55
问题 I'm trying to use CMake to build generate the make file for a project of mine that uses Lua. When I run make I get this error: /path/to/my/project/luaudio/luaudio.c:1:17: fatal error: lua.h: No such file or directory In the CMakeLists.txt file, I have the following lines, which I thought would do it, but apparently they're not enough: find_package(Lua51 REQUIRED) set(Luaudio_INCLUDE_DIRS ${Luaudio_SOURCE_DIR} ${Lua51_INCLUDE_DIRS} PARENT_SCOPE) include_directories(${Luaudio_INCLUDE_DIRS})

Unable to find Lua headers with find_package in cmake

眉间皱痕 提交于 2021-01-27 03:54:13
问题 I'm trying to use CMake to build generate the make file for a project of mine that uses Lua. When I run make I get this error: /path/to/my/project/luaudio/luaudio.c:1:17: fatal error: lua.h: No such file or directory In the CMakeLists.txt file, I have the following lines, which I thought would do it, but apparently they're not enough: find_package(Lua51 REQUIRED) set(Luaudio_INCLUDE_DIRS ${Luaudio_SOURCE_DIR} ${Lua51_INCLUDE_DIRS} PARENT_SCOPE) include_directories(${Luaudio_INCLUDE_DIRS})