不使用兼容工具箱时删除预配置

时间:2019-05-16 13:04:09

标签: c++ premake

我正在使用premake5作为项目生成器。我使用它来生成需要的makefile或Visual Studio(分别为Linux和Windows)。 我只想在我的C ++项目中使用gcc或clang(其他工具集不支持它)时才具有SAN(地址/行为不明确的SANitizer)配置。 遗憾的是我没有成功设置它。

我正在使用premake5 Alpha13。我在过滤器中尝试了notorand的各种组合:

workspace "MyWorkspace"

configurations { "Debug", "DebugSAN", "Release" }

filter "toolset:not(gcc or clang)"
    removeconfigurations "*SAN"

filter { "configurations:*SAN", "toolset:gcc or clang" }
    buildoptions { "-fno-omit-frame-pointer" }
    buildoptions { "-fsanitize=undefined,address" }
    linkoptions { "-fsanitize=undefined,address" }

尝试过"toolset:not gcc and not clang"{"toolset:not gcc", "toolset:not clang"} ...

在具有默认GCC的Linux上生成时,我应该以3种配置结束,而在premake5.lua中强制toolset "msc"时只有2种配置。但是在这两种情况下,我仍然得到相同的makefile。

$ make help
Usage: make [config=name] [target]

CONFIGURATIONS:
  debug
  debugsan <- Showing-up when it wants
  release

1 个答案:

答案 0 :(得分:1)

remove命令似乎适用于“项​​目配置”

https://github.com/premake/premake-core/wiki/Removing-Values

所以类似的事情似乎可行

project "Test"
    kind "StaticLib"

filter {"toolset: not gcc or toolset: not clang"}
  removeconfigurations "*SAN"

此项目中将没有* san配置。 但是我不认为有一种方法可以将其从“工作区”中删除,也就是您的make文件。

相关问题