![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Cmake
idreaming689
提高自己的认知
展开
-
linux平台交叉编译arm64库
1.构建工程时指定工具链cmake -DCMAKE_TOOLCHAIN_FILE=/home/…/gnu_arm64.cmake2.CMAKE_TOOLCHAIN_FILE 交叉编译文件#工具链文件 gnu_arm64.cmakeset( CMAKE_SYSTEM_NAME Linux )set( CMAKE_SYSTEM_PROCESSOR arm )SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")SET(CMAKE_SHARED_LIBRARY_SUFFIX原创 2021-11-30 15:28:44 · 1010 阅读 · 0 评论 -
OpenSSL编译错误+CMake
编译调用出现错误# warning: gethostbyname is obsolescent, use getnameinfo() instead.# undefined reference to `getcontext'# undefined reference to `setcontext'# undefined reference to `makecontext'解决方案#cmake添加如下编译选择ADD_DEFINITIONS (-DOPENSSL_NO_ASYNC)ADD_DE原创 2021-10-18 10:26:46 · 688 阅读 · 0 评论 -
CMake设置使用OpenCV的静态库
#cmake变量BUILD_SHARED_LIB 是一个全局变量set(BUILD_SHARED_LIBS OFF)#例如设置使用opencv的静态库if(NOT DEFINED OpenCV_STATIC) # look for global setting if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) set(OpenCV_STATIC OFF) else() set(OpenCV_STATIC ON)原创 2021-10-11 13:46:32 · 1651 阅读 · 0 评论 -
CMake调用boost库
CMake调用boost的编译脚本cmake_minimum_required(VERSION 3.14)project(boost_python)set(CMAKE_CXX_STANDARD 11)#指定boost根目录set(BOOST_ROOT E:/local/boost_1_61_0)#设置不适用系统的的boost的库set(BOOST_NO_SYSTEM_PATHS ON)#设置使用静态的boost库set(Boost_USE_STATIC_LIBS ON)#查找boost库原创 2021-09-28 13:48:15 · 2273 阅读 · 0 评论 -
Linux下编写CMake
cmake_minimum_required(VERSION 3.10)set(PNAME sdk)option(BuildTest "build test" ON)SET(CMAKE_CXX_COMPILER "g++") #设置编译器(可选的有gcc,g++)set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) #设置输出路径set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOUR原创 2021-09-06 14:27:16 · 151 阅读 · 0 评论 -
cmake使用中出现动态库找不到的问题
link_directories需要在add_executable和add_library之前否则会导致动态库找不到原创 2021-07-06 19:20:54 · 2145 阅读 · 1 评论 -
CMake实际项目使用方式
**## CMakeLists.txt**```bashmake_minimum_required(VERSION 3.18)set(PNAME yourProjectName)project(${PNAME})set(CMAKE_CXX_STANDARD 14)set(JSON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdPart/jsoncpp)include(${CMAKE_CURRENT_SOURCE_DIR}/3rdPart/opencv/OpenC原创 2021-06-04 17:42:49 · 155 阅读 · 0 评论 -
CMake 命令生成vs工程,脚本拷贝可执行程序
如果build文件不存在则创建文件,如果存在则删除其中的内容:pushd %~dp0if not exist build ( mkdir build) else ( del /S /Q /F build rd /S /Q build mkdir build)pushd build@echo offdel /F /Q CMakeCache.txtcmake .. -Tv140_xp -Awin32 popdpopd@echo on...原创 2021-01-28 10:40:07 · 528 阅读 · 0 评论 -
CMake debug与release使用不同的版本库
Debug版本使用的库为depend_d.libRelease版本使用的库为depend.libTARGET_LINK_LIBRARIES(app debug depend_d optimized depend)原创 2021-02-02 15:53:26 · 3261 阅读 · 0 评论 -
CMake自动化生成项目
include(Config.cmake) #引入第三方的cmake文件引入已经写好的cmake文件,Config.make例子。get_filename_component(DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)set(INCLUDE_DIR ${DIR}/include/)set(LIB_DIR ${DIR}/lib/win32)set(relative_dll_path lib/win32/my.dll)#cmake的函数实现.原创 2021-03-31 15:22:44 · 811 阅读 · 0 评论 -
bat脚本之Cmake工程生成
pushd %~dp0if not exist build ( #判断文件夹build是否存在,不存在则就创建 mkdir build) else ( del /S /Q /F build rd /S /Q build mkdir build)pushd build@echo offdel /F /Q CMakeCache.txt #删除以前Cmake生成的文件cmake .. -Tv140_xp -Awin32 #指定工具集popd pop.原创 2021-04-01 16:42:59 · 1203 阅读 · 0 评论 -
CMake+VScode+Linux+远程调试
远程调试linux程序,用cmake生成工程,vscode远程调试,tasks.json配置文件//tasks.json{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "C.原创 2021-05-20 10:12:36 · 570 阅读 · 0 评论 -
CMake生成动态库同,并调试
CMake编写项目生成文件,生成动态库,同时生成调试程序。cmake_minimum_required(VERSION 3.10)set(PNAME yourProject)option(BuildTest "build test" ON)SET(CMAKE_CXX_COMPILER "g++") #设置编译器(可选的有gcc,g++)project(${PNAME})file(GLOB src src/*.cpp src/*.c)file(GLOB head src/*.h.原创 2021-05-17 14:12:58 · 666 阅读 · 0 评论