MatBee
MatBee

Reputation: 284

CMakeLists.txt and two .cmake files

I have two *.cmake files, lets say nacl.cmake and pnacl.cmake in my ./CMake/ folder. How do I cmake using the specific one using my CMakeLists.txt?

Upvotes: 2

Views: 1449

Answers (2)

John McFarlane
John McFarlane

Reputation: 6117

They sound like two alternative toolchains. You can chose between different toolchains during configuration with the CMAKE_TOOLCHAIN_FILE option:

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.

Upvotes: 0

arrowd
arrowd

Reputation: 34421

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()

Upvotes: 5

Related Questions