[CMake] Question about loading Toolchain files

Murali Paluru mpaluru at gmail.com
Tue May 26 14:31:49 EDT 2015


Hi,

The current way of specifying a toolchain file is during the configure step
via the command line.

mkdir /tmp/build && cd /tmp/build
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain.cmake /path/to/source

In the project that I am working on I need to load different toolchain
files depending on the application/target I need to build.

For that reason, I set the CMAKE_*_COMPILER before I call the project().
But if I want to figure out the host system and load the toolchain based on
that it's not possible.

CMAKE_SYSTEM_NAME is available only after project() call is finished. Is
there anyway I can figure out the host information before the call to
project()?

What I would like to do:

include(toolchain-${CMAKE_SYSTEM_NAME}-${MYPRODUCT_ARCH}.cmake)

project(myproject)
add_subdirectory(src)


Regards,
Murali.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150526/b83ff3b3/attachment-0001.html>


More information about the CMake mailing list