Clion使用MinGW编译好的boost库
MinGW编译Boost库可以参考我之前写的编译Boost的文章。
以下是cmake链接boost静态库的配置:
cmake_minimum_required(VERSION 3.8) project(clions) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/Install CACHE PATH "Install here" FORCE) set (Boost_USE_STATIC_LIBS ON) # enable dynamic linking
set (Boost_USE_MULTITHREAD ON) # enable multithreading # windows 下设置这两个路径,find_package才能找到Boost
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "D:/MathxH/3rd-party/boost_1_67_0/bin/static/include/boost-1_67")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "D:/MathxH/3rd-party/boost_1_67_0/bin/static/lib") find_package(Boost) if(NOT Boost_FOUND)
message("not found boost package")
else()
message("found boost package")
include_directories(${Boost_INCLUDE_DIR})
LINK_DIRECTORIES(${CMAKE_LIBRARY_PATH})
## ADD_DEFINITIONS("-DHAS_BOOST") message("includes: ${Boost_INCLUDE_DIRS}") # 这个可以打印出值来
message("libs: ${Boost_LIBRARIES}") #这个变量在windows下找不到,为空
endif() if(USE_32BITS)
message("build x86 target")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
else()
message("build x64 target")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
endif(USE_32BITS) add_executable(clions main.cpp) if(Boost_FOUND) if(CMAKE_BUILD_TYPE MATCHES "Debug")
message("linking debug lib")
target_link_libraries(clions libboost_filesystem-mgw81-mt-sd-x64-1_67.a libboost_system-mgw81-mt-sd-x64-1_67.a)
endif() if(CMAKE_BUILD_TYPE MATCHES "Release")
message("linking release lib")
target_link_libraries(clions libboost_filesystem-mgw81-mt-s-x64-1_67.a libboost_system-mgw81-mt-s-x64-1_67.a)
endif() endif() install(TARGETS clions DESTINATION debug CONFIGURATIONS Debug)
install(TARGETS clions DESTINATION release CONFIGURATIONS Release)
如果配置好Clion的ToolChain,它会自动运行以下cmake命令行,生成makefile:
cmake.exe -DCMAKE_BUILD_TYPE=Release -DUSE_32BITS=0 -DBOOST_ROOT=D:\MathxH\3rd-party\boost_1_67_0\bin\static -DBOOST_LIBRARYDIR=D:\MathxH\3rd-party\boost_1_67_0\bin\static\lib -G "CodeBlocks - MinGW Makefiles" D:\clions references:
https://www.cnblogs.com/magic-428/p/9144492.html
https://www.jetbrains.com/help/clion/2018.1/quick-cmake-tutorial.html?utm_campaign=CL&utm_content=2018.1&utm_medium=link&utm_source=product#d323175e256
https://cmake.org/cmake/help/v3.10/command/find_package.html
https://cmake.org/cmake/help/v3.0/module/FindBoost.html
https://stackoverflow.com/questions/6646405/how-do-you-add-boost-libraries-in-cmakelists-txt
Clion使用MinGW编译好的boost库的更多相关文章
- windows下编译和安装boost库
boost是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库. 获取方式 boost提供源码形式的安装包,可以从boost官方网站下载,目前最新版本是1.59.0. 本机上正好有boos ...
- Qt编译和使用boost库(附QT5.51的Boost下载)good
配置gcc可以在cmd中使用 添加MinGW到环境变量 安装过Qt的都已经默认安装过MinGw的环境了,只需要找到配置一下环境变量就行 我的在D:\Qt5.5.1\Tools\mingw492_32\ ...
- [转]Linux编译和安装boost库
1. 下载boost安装包并解压缩 到http://www.boost.org/下载boost的安装包,以boost_1_58_0.tar.gz为例 下载完成后进行解压缩: tar zxvf boos ...
- 编译并使用boost库(win7+boost1.63+vs2015+32位or 64位),超详细,boost于vs2017下编译(64/32bit)
首先下载得到boost的最新版(目前最新版是1.63) 下载地址: http://www.boost.org 也可以从这里直接下载 http://download.csdn.net/detail/ ...
- vs2012 MinGW 编译ffmeg 引用外部库libx264,librtmp
VS2012如何编译ffmpeg前面已经有文章讲过,本来主要讲述如何引用外部库libx264,librtmp, ffmpeg版本是3.0.2. 1. 下载x264源文件并编译 源码地址是http:// ...
- boost::VS2017下编译和配置boost库
环境: win10 vs2017 v141 1.下载 boost_1_70_0.zip. 2.以管理员方式打开 3. bootstrap.bat 4.编译64位库 b2.exe stage -- ...
- Windows 7 编译64位boost库
1. 官网下载boost 2. 解压boost到D:\Library\boost_1_64_0 3. 打开 VS2015 x64 本机工具命令提示符,输入 "d:" 回车,再输入 ...
- linux下编译安装boost库
linux下编译安装boost库 linux下编译安装boost库 1.下载并解压boost 1.58 源代码 下载 解压 2.运行bootstrap.sh 3.使用b2进行构建 构建成功的提示 4. ...
- windows下编译Boost库
下载源码 boost_1_66_0.7z 生成编译工具 D:\Project\boost_1_66_0> bootstrap.bat 配置Python环境变量(使用VS2017自带的32位pyt ...
随机推荐
- Maya cmds pymel 单位和轴向设置
Maya cmds pymel 单位和轴向设置 import maya.cmds as cmds # 1. to make the Y-axis of the world to be the up a ...
- Linux git 在自己的服务器上建立 git 仓库(repository)
Linux git 在自己的服务器上建立 git 仓库(repository) 服务器端: 在这里使用 ssh 方式登陆: ssh [username]@server_address(建议用超级用户登 ...
- vim 命令图解
vim 命令,vim是一个很好的编辑工具,下面为大家介绍一下vim入门基本命令. 方法/步骤 1 [vim 命令-启动vimtutor]:执行命令:vimtutor.vimtutor是vim使用入 ...
- 1e9个兵临城下
https://ac.nowcoder.com/acm/contest/321#question 代码写得蛮丑的..真的很丑 像是高中教的veen图,并涉及到容斥原理. #include<cst ...
- Web API之indexedDB和Web SQL
Web SQL已经被W3C废弃了,下面主要学下indexedDB. 一.参考链接 https://w3c.github.io/IndexedDB/
- linux上如何自动获取ip及连接互联网
1.讲与虚拟机连接网卡设置为net连接 2.BOOTPROTO=dhcp 3.注释原来的ip 4.最后一句网关注释 5.重启网卡 service network restart
- Redis自学笔记:3.3入门-散列类型
3.3散列类型 3.3.1介绍 散列类型不能嵌套其他数据类型,一个散列类型可以包含至多232-1个字段 散列类型适合存储对象:使用对象类别和ID构成键名,使用字段表示对象的数据, 而字段值则存储属性值 ...
- Your ApplicationContext is unlikely to start due to a @ComponentScan of the default
问题:** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the defau ...
- Python3之弹性力学——应力张量2
问题 已知某应力张量的分量为 \[ \sigma_{11}=3,\quad\sigma_{12} = \sigma_{13} = 1, \quad \sigma_{22} = \sigma_{33} ...
- git上传本地项目到github,方法2
第一步:去github上创建自己的Repository,创建页面如下图所示: 填写相应信息后点击create即可 Repository name: 仓库名称 Description(可选): 仓库描述 ...