[cmake-developers] [CMake 0014841]: setting CMAKE_C_COMPILER to gcc creates endless loops

Mantis Bug Tracker mantis at public.kitware.com
Wed Mar 26 09:57:47 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14841 
====================================================================== 
Reported By:                wim van loocke
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14841
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2014-03-26 09:57 EDT
Last Modified:              2014-03-26 09:57 EDT
====================================================================== 
Summary:                    setting CMAKE_C_COMPILER to gcc creates endless
loops
Description: 
Create 2 projects

cmake_minimum_required(VERSION 2.8.11)
project(pro1 )

#adding crosscompiler stuff
SET( CMAKE_C_COMPILER   ${COMPILER_PATH}${CROSS_COMPILE}gcc )
message("CMAKE_C_COMPILER  ${CMAKE_C_COMPILER} " )
SET( CMAKE_CXX_COMPILER ${COMPILER_PATH}${CROSS_COMPILE}g++ )
message("CMAKE_CXX_COMPILER  ${CMAKE_CXX_COMPILER} " )

add_subdirectory(pro2)


cmake_minimum_required(VERSION 2.8.4)
project(pro2 )

message( STATUS "CMAKE_C_COMPILER      = ${CMAKE_C_COMPILER}" )
message( STATUS "CMAKE_CXX_COMPILER    = ${CMAKE_CXX_COMPILER}" )

Steps to Reproduce: 
just run cmake . and you will see endless loop 

CMAKE_C_COMPILER  gcc 
CMAKE_CXX_COMPILER  g++ 
-- CMAKE_C_COMPILER      = /usr/bin/gcc
-- CMAKE_CXX_COMPILER    = /usr/bin/g++
-- 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/cc

-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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
CMAKE_C_COMPILER  gcc 
CMAKE_CXX_COMPILER  g++ 
-- CMAKE_C_COMPILER      = /usr/bin/gcc
-- CMAKE_CXX_COMPILER    = /usr/bin/g++
-- 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/cc
CMAKE_CXX_COMPILER= /usr/bin/c++

-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info


Additional Information: 
I suppose that at the top level project you can define the compiler for all
subprojects.


I also found out that when SET( CMAKE_C_COMPILER .. ) is done after the
add_subdirectory(pro2), there is no endless loop, but i have to redefine
CMAKE_C_COMPILER in the CMakeLists.txt of the pro2



====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-03-26 09:57 wim van loocke New Issue                                    
2014-03-26 09:57 wim van loocke File Added: CMakeLists.txt                    
======================================================================



More information about the cmake-developers mailing list