[CMake] Where to change default link line on Cmake

Rene Salmon salmr0 at bp.com
Tue May 4 18:26:22 EDT 2010



> Set environment variables to choose your compiler:
> 
>  $ rm -rf build
>  $ mkdir build
>  $ cd build
>  $ export CC=xlc CXX=xlC FC=xlf
>  $ cmake ..

OK. That works. Thanks.  But I guess that brings up another question.


I have this in my CMakeLists.txt file so that (I thought) would not have to
set the CC, CXX, and FC environment variables.

# flags ppc64
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")
# choose c c++ compilers and flags
set (CMAKE_C_COMPILER xlc_r)
set (CMAKE_CXX_COMPILER xlc++_r)
set (CMAKE_C_FLAGS "-O3 -qhot")
# choose fortran compilers and flags
set (CMAKE_Fortran_COMPILER xfl_r)
set (CMAKE_Fortran_FLAGS "-O3 -qhot)
endif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")


The above seems to somewhat work with ccmake as I can do a configure and
then a generate. I guess it does not work with cmake. How do I pick
compilers using the CMakeLists.txt file rather than setting environment
variables.

Thanks
Rene





More information about the CMake mailing list