cmake 多次编译_CMake,多个目标(asan tsan ..),无需重新编译所有内容 (CMake, multiple targets (asan tsan..) without having...

2015-11-19 09:27:59

0

Goal

I want to define several targets:

make msan: compiles the code with clang with memory sanitizer

make tsan: compiles the code with clang with thread sanitizer

make : compiles the code with gcc

And be able to easily switch between them.

For example I don't want each time I switch rebuild all my objects, (I will have to do it the first time of course, but later if I modify a file and I do make and then make asan it should recompile only this file for each target)

What I have done so far

I have managed to create these targets and from the root directory, but each time I have to do a make clean and recompile.

option(CLANG_MSAN "Enable Clang memory sanitizer" OFF)

if (CLANG_MSAN)

set (CMAKE_CXX_FLAGS "-g -fsanitize=address -fno-omit-frame-pointer")

endif()

add_custom_target(asan

COMMAND ${CMAKE_COMMAND}

-DCLANG_MSAN=ON

-DCMAKE_CXX_COMPILER=clang++

-DCMAKE_C_COMPILER=clang)

Is it possible to do such a thing with CMake?

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值