View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014841CMakeCMakepublic2014-03-26 09:572014-10-06 10:33
Reporterwim van loocke 
Assigned To 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
Platformmint 16 OSlinuxOS VersionLinux-3.11.0-12-
Product VersionCMake 2.8.12.2 
Target VersionFixed in Version 
Summary0014841: setting CMAKE_C_COMPILER to gcc creates endless loops
DescriptionCreate 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 Reproducejust 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 InformationI 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


TagsNo tags attached.
Attached Filestxt file icon CMakeLists.txt [^] (7,475 bytes) 2014-03-26 09:57 [Show Content]

 Relationships

  Notes
(0035526)
Rolf Eike Beer (developer)
2014-03-26 10:17

Do not fiddle with CMakes knowledge about the compiler once it was set, use a proper toolchain file: http://www.cmake.org/Wiki/CMake_Cross_Compiling [^]
(0035527)
Brad King (manager)
2014-03-26 10:45

CMAKE_<LANG>_COMPILER should not be set after a language is enabled by the project() or enable_language() command. Normally it should not be set in your CMakeLists.txt code at all. The link in 0014841:0035526 explains the proper way to configure cross-compiling.

If you need further help please ask on the mailing list:

 http://www.cmake.org/mailman/listinfo/cmake [^]
(0036956)
Robert Maynard (manager)
2014-10-06 10:33

Closing resolved issues that have not been updated in more than 4 months.

 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
2014-03-26 10:17 Rolf Eike Beer Note Added: 0035526
2014-03-26 10:45 Brad King Note Added: 0035527
2014-03-26 10:45 Brad King Status new => resolved
2014-03-26 10:45 Brad King Resolution open => no change required
2014-10-06 10:33 Robert Maynard Note Added: 0036956
2014-10-06 10:33 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team