[CMake] "Toolchain" for native builds

Adolfo Rodríguez dofo79 at gmail.com
Fri Jul 10 03:33:01 EDT 2009


One alternative that comes into my mind would be to invoke cmake like

cmake -C initialCache.cmake

where initialCache.cmake is a script that preloads a set of cache variables,
i.e., with entries like
set(CMAKE_CXX_COMPILER icpc CACHE STRING "CXX compiler." FORCE)

Would this accomplish what you want?

Adolfo.

On Fri, Jul 10, 2009 at 1:06 AM, S. Levent Yilmaz <leventyilmaz at gmail.com>wrote:

> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09
AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden
contener información privilegiada y/o confidencial que está dirigida
exclusivamente a su destinatario. Si usted recibe este mensaje y no es el
destinatario indicado, o el empleado encargado de su entrega a dicha
persona, por favor, notifíquelo inmediatamente y remita el mensaje original
a la dirección de correo electrónico indicada. Cualquier copia, uso o
distribución no autorizados de esta comunicación queda estrictamente
prohibida.

CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may
contain confidential information which is privileged and intended only for
the individual or entity to whom they are addressed.  If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution or use of this e-mail and/or accompanying document(s) is
strictly prohibited.  If you have received this e-mail in error, please
immediately notify the sender at the above e-mail address.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090710/97897531/attachment-0001.htm>


More information about the CMake mailing list