MantisBT - CMake
View Issue Details
0013756CMakeCMakepublic2012-11-28 17:292013-12-02 08:51
Nick Hutchinson 
Brad King 
CMake 2.8.11CMake 2.8.11 
0013756: Infinite loop when reconfiguring with different CMAKE_C_COMPILER
It's possible to get CMake stuck in a seemingly infinite loop when reconfiguring a project.
1. Create the following trivial CMakeList.txt:
cmake_minimum_required(VERSION 2.8.8)

2. `cd` to the directory containing this file, and execute `cmake .`
3. Execute `cmake . -DCMAKE_C_COMPILER=cc`

Expected Behaviour:
CMake reconfigures the project with the specified compiler.

Actual Behaviour:
CMake prints the following to stdout in an infinite loop:
-- 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:
No tags attached.
related to 0006102closed Bill Hoffman Changing compilers should be an easier operation 
related to 0013901closed Brad King cmake . -DCMAKE_CXX_COMPILER= results in segfault 
has duplicate 0013927closed Brad King CMake loops indefinitely when compiler is changed 
has duplicate 0013989closed Robert Maynard Unable to change native compilers after initial configuration 
related to 0013926closed Brad King CMake hangs on OSX 
related to 0008193closed Bill Hoffman Cmake goes to endless loop on mac os X when trying to generate Unix make files. 
related to 0014097closed  variable UNIX set to 1 on windows xp in VM on linux host 
related to 0014294closed Brad King Specifying CMAKE_CXX_COMPILER=g++ after first run deletes all cached values 
Issue History
2012-11-28 17:29Nick HutchinsonNew Issue
2012-12-10 10:29Benjamin SchindlerNote Added: 0031864
2012-12-10 10:32Benjamin SchindlerNote Edited: 0031864bug_revision_view_page.php?bugnote_id=31864#r969
2013-02-08 16:39Brad KingRelationship addedrelated to 0006102
2013-02-08 16:39Brad KingRelationship addedrelated to 0013901
2013-02-08 16:45Brad KingNote Added: 0032240
2013-02-17 09:24Brad KingRelationship addedhas duplicate 0013927
2013-02-20 08:12Brad KingNote Added: 0032354
2013-02-20 08:12Brad KingAssigned To => Brad King
2013-02-20 08:12Brad KingStatusnew => resolved
2013-02-20 08:12Brad KingResolutionopen => fixed
2013-02-20 08:12Brad KingFixed in Version => CMake 2.8.11
2013-02-20 08:12Brad KingTarget Version => CMake 2.8.11
2013-02-20 08:14Brad KingRelationship addedrelated to 0013926
2013-03-07 08:51Robert MaynardRelationship addedhas duplicate 0013989
2013-03-15 09:02Brad KingRelationship addedrelated to 0008193
2013-04-18 08:22Brad KingRelationship addedrelated to 0014097
2013-07-16 08:39Brad KingRelationship addedrelated to 0014294
2013-12-02 08:51Robert MaynardNote Added: 0034646
2013-12-02 08:51Robert MaynardStatusresolved => closed

Benjamin Schindler   
2012-12-10 10:29   
(edited on: 2012-12-10 10:32)
I experience exactly the same thing with cmake-gui. I start the gui, specify a different native compiler, run configure. The configure step fails for other reasons but the cache is deleted. I could manually add all variables required to make configure work, but its about 10 variables and if just one is wrong, I have to start afresh. Really annoying! In my opinion not so minor.

I just tried 2.8.9 and there, it works

Brad King   
2013-02-08 16:45   
For reference, see comment 0013901:0032239.
Brad King   
2013-02-20 08:12   
Fixed (see commit message for explanation):;a=commitdiff;h=1df09e57 [^]

and test added:;a=commitdiff;h=e83e6a1c [^]
Robert Maynard   
2013-12-02 08:51   
Closing resolved issues that have not been updated in more than 4 months.