在makefile中调用了更改编译器
Change compiler called in makefile
我有一个make文件,它当前使用cmake
编译一组源文件,但我想更改它,使其使用英特尔的c编译器。我可以把所有的cmake
都改成icc
吗?或者。。。如何做到这一点?
下面是make文件,它来自字节币的加密挖矿守护进程。
all: all-release
cmake-debug:
mkdir -p build/debug
cd build/debug && cmake -D CMAKE_BUILD_TYPE=Debug ../..
build-debug: cmake-debug
cd build/debug && $(MAKE)
test-debug: build-debug
cd build/debug && $(MAKE) test
all-debug: build-debug
cmake-release:
mkdir -p build/release
cd build/release && cmake -D CMAKE_BUILD_TYPE=Release ../..
build-release: cmake-release
cd build/release && $(MAKE)
test-release: build-release
cd build/release && $(MAKE) test
all-release: build-release
clean:
rm -rf build
tags:
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
.PHONY: all cmake-debug build-debug test-debug all-debug cmake-release build-release test-release all-release clean tags
如果有帮助的话,我可以在正常构建后发布它在/build中创建的其他文件,但我想无论我要做什么来更改编译器,每个MAKE文件都是一样的。
否则,其余的源文件可以在这里找到:
https://github.com/amjuarez/bytecoin
我运行的是Ubuntu 14.04。
提前感谢!
在第一次调用CMake时,使用带有-DCMAKE_TOOLCHAIN_FILE=path/to/file
的toolchain.txt
文件为CMake指定工具链设置,生成makefiles:
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=<path_to>/toolchain.txt
应该有类似的条目
set(CMAKE_C_COMPILER /<your-toolchain-path>/gcc)
set(CMAKE_CXX_COMPILER /<your-toolchain-path>/g++)
在CCD_ 6中。
通常CXX=<mycompiler> cmake
应该执行您想要的操作。或者,您可以修改项目的工具链文件,假设您想永久性地进行更改。
这是我的脚本,它运行cmake来构建带有clang和clang++的llvm/crang:
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD=X86 ../llvm
相关文章:
- 是否有C++编译器选项允许激进地删除所有函数调用,并将参数传递给具有空体的函数
- 使用仅使用一次的变量调用的复制构造函数.这可能是通过调用move构造函数进行编译器优化的情况吗
- 重载方法的方式会在使用临时调用时生成编译器错误
- C++ DLL 类导出、编译器"optimizes"虚拟调用
- 这个C++编译器优化(在自身的实例上调用对象自己的构造函数)的名称是什么,它是如何工作的?
- 编译器调用复制运算符而不是移动运算符
- 为什么编译器将其解析为函数指针而不是递归调用?
- C++ 编译器错误:P1LinkedList.cpp:145:错误:重载的"to_string(int&)"调用不明确
- 在构建过程中捕获所有编译器调用和命令行参数
- 更改CMAKE中的编译器调用
- 你如何告诉 Clang 编译器调用使用框架
- 为什么编译器调用 -> 运算符两次
- 不同的强制转换操作符被不同的编译器调用
- 为什么编译器调用默认构造函数
- c++编译器调用错误
- 编译器调用基类方法而不是子类方法
- 显示对as, ar, ld等工具的编译器调用或确定等效调用
- g++ 编译器调用函数时出错(向量<向量<int> > &)
- 使用c++ /intel c++编译器调用fortran函数
- 为什么编译器调用第一个重载函数而不是第二个