简体   繁体   English

CMakeLists.txt 和两个 .cmake 文件

[英]CMakeLists.txt and two .cmake files

I have two *.cmake files, lets say nacl.cmake and pnacl.cmake in my ./CMake/ folder.我有两个 *.cmake 文件,比如说 nacl.cmake 和 pnacl.cmake 在我的 ./CMake/ 文件夹中。 How do I cmake using the specific one using my CMakeLists.txt?如何使用我的 CMakeLists.txt 使用特定的 cmake?

Make an option to let user switch between them: 选择让用户在它们之间切换:

option(USE_PNACL "Use PNaCl instead fo NaCl" TRUE)

if(USE_PNACL)
  include(CMake/PNacl.cmake)
else()
  include(CMake/Nacl.cmake)
endif()

They sound like two alternative toolchains .它们听起来像是两个替代工具链 You can chose between different toolchains during configuration with the CMAKE_TOOLCHAIN_FILE option:您可以在配置期间使用CMAKE_TOOLCHAIN_FILE选项在不同的工具链之间进行选择:

cmake -DCMAKE_TOOLCHAIN_FILE=<project-folder>/CMake/PNacl.cmake <project-folder>

If you don't specify a toolchain file, the build system will target the build machine.如果您不指定工具链文件,构建系统将以构建机器为目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM