MantisBT - CMake
View Issue Details
0013918CMakeCMakepublic2013-02-14 04:412016-06-10 14:31
Petr Kmoch 
Kitware Robot 
normalminoralways
closedmoved 
Windows7
CMake 2.8.10.2 
 
0013918: enable_language() sets CMAKE_<lang>_COMPILER_LOADED in local scope
When enable_language(<lang>) is called within a function, it sets the variable CMAKE_<lang>_COMPILER_LOADED within the scope of that function only. This behaviour is rather unexpected, or at least not mentioned in the documentation.
Run CMake on the attached CMakeList.

Expected output:
-- C was loaded
-- C reports as loaded

Actual output:
-- C was loaded
-- C reports as not loaded
No tags attached.
txt CMakeLists.txt (391) 2013-02-14 04:41
https://public.kitware.com/Bug/file/4641/CMakeLists.txt
Issue History
2013-02-14 04:41Petr KmochNew Issue
2013-02-14 04:41Petr KmochFile Added: CMakeLists.txt
2013-02-14 08:36Brad KingNote Added: 0032280
2013-02-14 08:36Brad KingStatusnew => backlog
2016-06-10 14:28Kitware RobotNote Added: 0042224
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0032280)
Brad King   
2013-02-14 08:36   
The variable gets set as documented here:

 http://www.cmake.org/cmake/help/v2.8.10/cmake.html#variable:CMAKE_LANG_COMPILER_LOADED [^]

but it gets eaten by the function's nested variable scope.

As a generalization of my comments in this thread:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/45460 [^]

the language initialization needs an overhaul to be scoped properly.

Sending to backlog for now.

Use a macro to work around.
(0042224)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.