cmake编译多个文件夹,cmake工具链包含多个文件

For the reasons irrelevant to mention I would like to be able to include multiple files into toolchain file. Lets say my toolchain contains following:

message(STATUS "file1 is ok")

include(./build/file2)

the file2 contains identification line:

message(STATUS "file2 is ok")

the CMakeLists.txt contains:cmake_minimum_required (VERSION 2.8.8)

project (pro)

message(STATUS "cmakelists.txt is ok")

I call it using following command:cmake -DCMAKE_TOOLCHAIN_FILE=../../build/file1 ../../

Now, I would expect the following output:-- file1 is ok

-- file2 is ok

-- cmakelists.txt is ok

Yet i become this:-- file1 is ok

-- file2 is ok

-- file1 is ok

-- file2 is ok

-- The C compiler identification is Clang 5.0.0

-- The CXX compiler identification is Clang 5.0.0

-- Check for working C compiler: /usr/bin/cc

CMake Error at /fullpath/build/file1:2 (include):

include could not find load file:

./build/file2

Call Stack (most recent call first):

/fullpath/build/Mac/CMakeFiles/2.8.12/CMakeSystem.cmake:6 (include)

CMakeLists.txt:2 (PROJECT)

CMake Error: Internal CMake error, TryCompile configure of cmake failed

-- Check for working C compiler: /usr/bin/cc -- broken

CMake Error at /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):

The C compiler "/usr/bin/cc" is not able to compile a simple test program.

It fails with the following output:

CMake will not be able to correctly generate this project.

Call Stack (most recent call first):

CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!

Not only cmake prints the information twice, it also claim it cannot find included files at third time after that.

Any ideas?

解决方案Not only cmake prints the information twice

It's normal. During configuration several steps performed. On every step toolchain file used.

it also claim it cannot find included files at third time after that. Any ideas?

Use absolute path.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值