[CMake] "Toolchain" for native builds

S. Levent Yilmaz leventyilmaz at gmail.com
Thu Jul 9 19:06:16 EDT 2009


This question was asked a while ago:
http://www.cmake.org/pipermail/cmake/2009-June/030404.html with no
definitive answer..
So, I'll try to raise this issue from a different angle, perhaps this will
make more sense to the developers.

Take a look at this line:

cmake \
   -DCMAKE_CXX_COMPILER=icpc \
   -DCMAKE_C_COMPILER=icc \
   -DCMAKE_Fortran_COMPILER=ifort \
   -DCMAKE_CXX_FLAGS_RELWITHDEBINFO='-O2 -g -debug inline-debug-info'  \
   -DCMAKE_C_FLAGS_RELWITHDEBINFO='-O2 -g -debug inline-debug-info'  \
   -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO='-O2 -g -debug inline-debug-info'  \
   -DBLA_VENDOR=Intel \
   -DBLA_BLA \
   /path/to/source

Now, the thing I want to emphasize about this "configuration" line is that
the settings are not specific to a given project. It just "activates" a
custom compiler suite. Another perfectly reasonable scenario is further
refinements made for specific platforms. And, really, compilation being
cross or native is an orthogonal issue here.

The earlier dialog was:

>> [Will Dicharry wrote:]

>> Am I misusing the toolchain file capability?

> [Bill Hoffman wrote:]

> Yes, that should only be used for cross-compiling.

> To set the compilers you can set the environment variables FC, CC, and CXX
> before running CMake.


So, now my question is, how can I reduce the above cmake configure line
muddied with plethora of compiler (and/or platform) specific definitions (or
preceding environment variables for that matter) into:

cmake -DCMAKE_OK_NOT_TOOLCHAIN_BUT_WHAT_FILE=site/macros/intel.cmake
/path/to/source

?

Levent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090709/5df891c2/attachment.htm>


More information about the CMake mailing list