[CMake] infinite loop when trying to change the compiler in CMakeLists.txt

bthomas at nexus.hu bthomas at nexus.hu
Thu Nov 5 13:07:28 EST 2009


Dear All,

I am managing a CFD code where wish to set the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to openmpi 
wrappers.

So far i was using cmake 2.4.7 and in the CMakeLists.txt the following lines were working perfectly:
SET(CMAKE_C_COMPILER ${MPI_INSTALL_ROOT}/bin/mpicc )
SET(CMAKE_CXX_COMPILER ${MPI_INSTALL_ROOT}/bin/mpic++ )

Now that I changed to CMake 2.8.0 there is an infinite loop when trying to configure:

name at machine: ./deps/bin/cmake ../
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= /usr/bin/gcc
CMAKE_CXX_COMPILER= /usr/bin/c++

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= /usr/bin/gcc
CMAKE_CXX_COMPILER= /usr/bin/c++

... and enters an infinite loop.

If I set the compilers via command line arguments, its fine.
But for easy-to-compile-by-the-users reason, I would like to set them in the CMakeLists.txt if
possible.
Can somebody help me out how to do this right?

The machine: Ubuntu, openmpi 1.3.3 with system gcc 4.4.1 behind

Thx:
Th

P.S.: I noted a bugfix in CMake 2.6.2 RC 2, may be connected:
"Fix infinite recursion bug with try-compile and change of compilers"






More information about the CMake mailing list