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

Will Dicharry wdicharry at stellarscience.com
Thu Nov 5 13:36:21 EST 2009


I think the best way to do that is with an initial cache via the -C flag 
to cmake.  Then you can set the initial CMAKE_<LANG>_COMPILER option in 
a CMake file and start with that file.

I currently don't do this, but I should.  At the moment I am doing this 
wrong by using the CMAKE_TOOLCHAIN_FILE variable and setting up the MPI 
wrapper compilers in there.  This is currently working for me, but it is 
the wrong way of doing it since the toolchain files should really only 
be used for cross compiling.

-- Will

On 11/05/2009 11:07 AM, bthomas at nexus.hu wrote:
> 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"
>
>
>
>
>    
>
>
> _______________________________________________
> 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 --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091105/d6f3f926/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3344 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091105/d6f3f926/attachment.bin>


More information about the CMake mailing list