如何前缀CMake编译器? [英] How to prefix CMake Compiler?

查看:281
本文介绍了如何前缀CMake编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用一个实用程序脚本给编译器添加前缀,所以不用像 g ++ - 4.7 main.cpp kinst-ompp g ++ - 4.7 main.cpp 被调用。

I want to prefix the compiler with a utility script, so instead of for example g++-4.7 main.cpp,kinst-ompp g++-4.7 main.cpp is invoked.

我试着在CMakeLists.txt中做这件事,但我得到一个not found错误:

I tried doing this in the CMakeLists.txt, but I'm getting a "not found" error:

set(CMAKE_CXX_COMPILER "${OMPP_CXX} ${CMAKE_CXX_COMPILER}")
set(CMAKE_C_COMPILER "${OMPP_CC} ${CMAKE_C_COMPILER}")

如何使用CMake正确配置这个?

How do I properly configure this using CMake?

推荐答案

我通过将我的编译器设置为前缀,然后将真实的编译器名称作为第一个参数传递给我。丑,我知道。

I got this to work by setting my compiler to the prefix and then passing the real compiler name as first argument. Ugly, I know.

set(CMAKE_CXX_COMPILER "${OMPP_CXX}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_COMPILER} ${commonCXXFlags} ${commonReleaseFlags}")

这篇关于如何前缀CMake编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆