cmake

Getting GIT build hash outside the current directory

一笑奈何 提交于 2020-03-19 06:02:36
问题 I'm using CMake to do an out-of-core/out-of-source build of my project, and want to include the result of a "git describe --tags --dirty" as a version number in the project (just for reference on bugs). However, any attempt to try and tell git where the code repo is results in an error like "fatal: Not a git repository (or any of the parent directories): .git". Is there a way to specify where git should look for the repo, other than the current working directory? 回答1: Or you can use the

JetBrains CLion 2019 for Mac(C和C ++ IDE智能代码编辑软件) v2019.3.5

99封情书 提交于 2020-03-18 17:36:47
3 月,跳不动了?>>> CLion 2019 mac版是Macos上一款适用于C和C ++ IDE智能代码编辑软件,通过即时导航和可靠的重构来提升工作效率,强大的智能代码辅助,让你省时省力又省心,拥有只能编辑器来分析上下文,通过导航和搜索功能快速找到你需要的内容,非常实用的是能够实时现实出代码中存在的错误和可能出现风险的地方,方便大家快速修复,避免后期不必要的损失。 新增功能 1.WSL Windows上的Linux工具链如果您的项目在Windows上开发时需要Linux工具链,您现在可以在Windows上运行的CLion中使用 Windows子系统Linux(WSL)。在Preferences | 下配置WSL和相应的工具链 构建,执行,部署| 工具链,然后你准备在CLion中使用它。将使用WSL上的标头搜索路径,并将为您创建Linux二进制文件以在WSL上运行和调试。 关于WSL的Valgrind MemcheckValgrind Memcheck可以检测到数十个内存错误和泄漏,现在可供WSL上的Windows用户使用。打开WSL工具链,确保在设置(Preferences | Build,Execution,Deployment | Valgrind)中检测到Valgrind,然后在Valgrind Memcheck下编译并运行常规和测试目标,以检测可能的错误和泄漏。在“运行

cmake编译动态库和静态库

狂风中的少年 提交于 2020-03-17 07:14:20
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(hello) #添加源文件 aux_source_directory(./ DIR_SRCS) #设置编译参数 set(CMAKE_C_FLAGS "-g -Wall") #添加头文件路径 include_directories( ./include ) #添加库 find_library(RT rt /usr/lib64) find_library(DL dl /usr/lib64) find_library(MATH m /usr/lib64) #link库 link_libraries(${DL} ${RT} ${MATH}) #定义 add_definitions(-g3 -MD -Wall -DOS_LINUX=1 -pthread -lconfig -DPLAT_MODULE_DEVSM) #生成动态库和静态库 add_library(acc_lib_shared SHARED ${DIR_SRCS}) add_library(acc_lib_static STATIC ${DIR_SRCS}) #将动态库和静态库的名字设置 set_target_properties(acc_lib_shared PROPERTIES OUTPUT_NAME "hello") set_target

CMake project compilation error on VisualStudio using external SDK toolchain file

旧巷老猫 提交于 2020-03-16 08:48:52
问题 I am using VisualStudio CMake project on Windows machine. I am using an external SDK in order to cross compile my C++ program for Linux arm architecture . I added the SDK toolchain to cmakeToolchain path which is : /opt/poky-atmel/2.5.3/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake and this is my CMakeLists.txt file : set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR arm) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED OFF) set(Boost_USE_STATIC_RUNTIME

Add target properties to an existing imported library in CMake

[亡魂溺海] 提交于 2020-03-16 06:45:32
问题 External project is built by CMake and installed in a directory visible via CMAKE_PREFIX_PATH . As it's CMake project, it installs proper .cmake files. In those, automatically generated, files an EXPORTED target is created and all required properties are set. What I would like to do, is - without modification of original CMakeLists.txt - add a compile definition, that I need in order to properly include header from this library. So far I've tried two approaches: Re-add library and specify

PHP amqp扩展安装

梦想与她 提交于 2020-03-15 10:21:46
1.安装 rabbitmq-c 下载地址:https://github.com/alanxz/rabbitmq-c > mkdir build > cd build > cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -DCMAKE_INSTALL_PREFIX=/usr/local .. > cmake --build . --target install 出现的问题: CMake Error at /usr/local/Cellar/cmake/3.11.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR) (Required 解决方案: brew install OpenSSL -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl

源码编译搭建LAMP

有些话、适合烂在心里 提交于 2020-03-15 08:58:30
环境版本信息: RHEL 5.3 Apache / 2.4.16 PHP / 5.4.45 mysql-5.5.45 源代码编译 安装方式 1: configure 配置 以及定制我们的软件包 2: make 把源代码包中的源代码 编译成 链接文件 目标文件 .0 Object 3: make install 安装到 我们configure制定的目录中去 一、关闭有可能会影响到访问的一些限制的服务: 1、暂时清空防火墙: iptables -F 2、关闭selinux: vim /etc/selinux/config SELINUX=disabled 或: setenforce 0 3、关闭:NetworkManager service NetworkManager stop 主配置文件, 服务器的启动脚本 记得给+x [apache 安装配置] 1、下载地址 http://apache.fayea.com//httpd/httpd-2.4.16.tar.gz (linux端下载地址) http://httpd.apache.org/download.cgi (官网) httpd-2.4.16.tar.gz 2、配置环境 安装:gcc gcc-c++ openssl 3、上传源码包 一般上传到OPT目录: cd /opt/apache/httpd-2.4.16 rz –aeb

cmake: add “d” suffix for debug build of static library

回眸只為那壹抹淺笑 提交于 2020-03-13 06:38:58
问题 I would like to implement a naming scheme for libraries similar to the one mentioned here: Library name for x32 vs x64 The CMakeLists.txt file is setup to create a static library add_library(test test.h test.cpp) After creating a visual studio solution from the cmake lists the project is set up in such a way that the debug library test.lib is written to /x64/Debug/test.lib and the release version is written to /x64/Release/test.lib . I would prefer to write them both to /lib/ but append a "d"

cmake: add “d” suffix for debug build of static library

本小妞迷上赌 提交于 2020-03-13 06:38:27
问题 I would like to implement a naming scheme for libraries similar to the one mentioned here: Library name for x32 vs x64 The CMakeLists.txt file is setup to create a static library add_library(test test.h test.cpp) After creating a visual studio solution from the cmake lists the project is set up in such a way that the debug library test.lib is written to /x64/Debug/test.lib and the release version is written to /x64/Release/test.lib . I would prefer to write them both to /lib/ but append a "d"

cmake: add “d” suffix for debug build of static library

馋奶兔 提交于 2020-03-13 06:38:22
问题 I would like to implement a naming scheme for libraries similar to the one mentioned here: Library name for x32 vs x64 The CMakeLists.txt file is setup to create a static library add_library(test test.h test.cpp) After creating a visual studio solution from the cmake lists the project is set up in such a way that the debug library test.lib is written to /x64/Debug/test.lib and the release version is written to /x64/Release/test.lib . I would prefer to write them both to /lib/ but append a "d"