MantisBT - CMake
View Issue Details
0015269CMakeCMakepublic2014-11-30 11:392016-06-10 14:31
David Zemon 
Kitware Robot 
normalmajoralways
closedmoved 
Parallax Propeller P8X32AUbuntu14.04
CMake 3.0.2 
 
0015269: Toolchain file not loaded without C language enabled
Problem:
My toolchain file is not being loaded.

Apparent Cause:
Any time the C language is not enabled (by either 'project' or 'enable_langauge').

Normally, I have the toolchain file loaded with a file at the top of my root CMakeLists.txt file that reads:
  set(CMAKE_TOOLCHAIN_FILE ${PROPWARE_PATH}/PropellerToolchain.cmake)
but in an effort to try and debug this, I've also added the definition to my command line. No change occurred.
Reproducing the problem is straight-forward, but requires installing a toolchain as was deemed too complicated in my previous bug. For those willing to try, see instructions here: http://public.kitware.com/Bug/view.php?id=15155 [^]

I have not yet been able to reproduce this with a desktop build, but will report back if that changes.
No tags attached.
Issue History
2014-11-30 11:39David ZemonNew Issue
2014-11-30 11:41David ZemonNote Added: 0037313
2014-12-01 11:14Brad KingNote Added: 0037328
2014-12-01 22:47David ZemonNote Added: 0037351
2014-12-02 09:13Brad KingNote Added: 0037353
2016-06-10 14:29Kitware RobotNote Added: 0042676
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0037313)
David Zemon   
2014-11-30 11:41   
I should clarify the apparent cause:
If I specify no languages with the project command (therefore leaving C and C++ enabled), it works fine. If I specify only C++ in the project command, it breaks and does not load my toolchain file.
(0037328)
Brad King   
2014-12-01 11:14   
FYI, if no project() command is present then CMake inserts one at line 0 of the top-level CMakeLists.txt file. This causes C and CXX to be enabled prior to execution of any other line in the CMakeLists.txt file.
(0037351)
David Zemon   
2014-12-01 22:47   
The PropWare build system is setup such that project() is required by all projects (the PROJECT_NAME variable is used throughout).

I ran into this when I had to enable a new language in a C++ project. I changed the project command from `project(my_project)` to `project(my_project CXX DAT)`. I can absolutely see users doing this as well, and that presents a real problem.

Also, sorry about the severity being "major" - that was mistake.
(0037353)
Brad King   
2014-12-02 09:13   
Returning to the problem in the description, the enable_language() and project() commands both call configure and/or load CMakeSystem.cmake:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalGenerator.cxx;hb=v3.0.2#l400 [^]

which loads the toolchain file:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeSystem.cmake.in;hb=v3.0.2#l6 [^]

This should work regardless of what languages are enabled or not. It happens before the list of languages is even considered.
(0042676)
Kitware Robot   
2016-06-10 14:29   
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.