[CMake] "Toolchain" for native builds

Will Dicharry wdicharry at stellarscience.com
Fri Jul 10 11:18:35 EDT 2009


Adolfo Rodríguez wrote:
> 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?
>

Thank you for the solution! I think that would accomplish what I am 
going for in most cases.  The only problem I see with that approach (and 
it's a small problem that I'm willing to deal with) is the difference in 
build procedure between cross-compiling and non cross-compiling 
environments.  Actually, will the initial cache work properly with 
cross-compiling if I set CMAKE_TOOLCHAIN_FILE in the initial cache 
file?  If that will work, then I think this solution will work just fine 
for our needs.

Thanks again,
Will

> Adolfo.
>
> On Fri, Jul 10, 2009 at 1:06 AM, S. Levent Yilmaz 
> <leventyilmaz at gmail.com <mailto: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 <http://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.
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3344 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090710/5bd8eb60/attachment-0001.bin>


More information about the CMake mailing list