MantisBT - CMake | |||||||||||||||
View Issue Details | |||||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||||
0009220 | CMake | CMake | public | 2009-06-29 18:33 | 2016-06-10 14:30 | ||||||||||
Reporter | Alan W. Irwin | ||||||||||||||
Assigned To | Kitware Robot | ||||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||||
Status | closed | Resolution | moved | ||||||||||||
Platform | OS | OS Version | |||||||||||||
Product Version | CMake-2-6 | ||||||||||||||
Target Version | Fixed in Version | ||||||||||||||
Summary | 0009220: enable_language(.... OPTIONAL) signature does not work correctly | ||||||||||||||
Description | I have been testing the OPTIONAL signature for enable_language using the following simple CMakeLists.txt file: ******* cmake_minimum_required(VERSION 2.6.4) project(test NONE) enable_language(C OPTIONAL) message(STATUS "CMAKE_C_COMPILER_WORKS = ${CMAKE_C_COMPILER_WORKS}") ******* According to the documentation the OPTIONAL signature is to help CMake-based build systems deal smoothly with bad/broken compilers by allowing them to take their own actions to deal with the compiler issue based on the value of CMAKE_<languageName>_COMPILER_WORKS. However, the OPTIONAL signature does not work and bad/broken compilers error out before the above message command can be reached. The same issue also occurs for C++ and Fortran. To illustrate the issue as simply as possible, I emulate a missing/broken compiler as follows: software@raven> CC='gcc whatever' cmake .. -- The C compiler identification is unknown -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- broken CMake Error at /home/software/cmake/install-2.6.4/share/cmake-2.6/Modules/CMakeTestCCompiler.cmake:32 (MESSAGE): The C compiler "/usr/bin/gcc" is not able to compile a simple test program. It fails with the following output: Change Dir: /tmp/build_dir/CMakeFiles/CMakeTmp Run Build Command:/usr/bin/make "cmTryCompileExec/fast" /usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build make[1]: Entering directory `/tmp/build_dir/CMakeFiles/CMakeTmp' /home/software/cmake/install-2.6.4/bin/cmake -E cmake_progress_report /tmp/build_dir/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o /usr/bin/gcc whatever -o CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c /tmp/build_dir/CMakeFiles/CMakeTmp/testCCompiler.c gcc: whatever: No such file or directory make[1]: Leaving directory `/tmp/build_dir/CMakeFiles/CMakeTmp' make[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o] Error 1 make: *** [cmTryCompileExec/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (enable_language) -- Configuring incomplete, errors occurred! The "whatever" inserts an extra unknown file into the compilation process which makes try_compile not work, and which therefore tests the OPTIONAL signature. However, instead of returning properly to the original CMakeLists.txt file to allow the build system to do something about CMAKE_C_COMPILER_WORKS being false it errors out as above. The source of the issue is line 32 of CMakeTestCCompiler.cmake which uses message(FATAL_ERROR ...) If you change that to message(STATUS ...) , then that solves the issue and control is returned back to the originating CMakeLists.txt file with this (correct) result [...] CMake will not be able to correctly generate this project. -- CMAKE_C_COMPILER_WORKS = FALSE -- Configuring done -- Generating done -- Build files have been written to: /tmp/build_dir However, that is not a good general solution because the same fix means that if you drop OPTIONAL, i.e., use "enable_language(C)" control is incorrectly returned to the original CMakeLists.txt and the project is incorrectly configured and generated without a CMake error. I had a look at cmEnableLanguageCommand.cxx to see what it did with OPTIONAL. It appears that it simply lets the Generator know that the language is optional. I suggest it should also set a CMake variable that CMakeTestCCompiler.cmake (and also CMakeTestCXXCompiler.cmake and CMakeTestFortranCompiler.cmake) could use to send STATUS or FATAL_ERROR messages as appropriate. The reason I am bringing up these OPTIONAL C, C++, and Fortran language support issues now is I am beginning to encounter reports from PLplot users with broken compilers, and I would prefer to give them a much smoother landing (disable that part of PLplot that depends on the compiler in question with a warning message and keep going) than is possible now. Once the OPTIONAL signature to enable_language actually works, I presume a substantial number of other multi-language projects would find it useful as well. | ||||||||||||||
Steps To Reproduce | |||||||||||||||
Additional Information | |||||||||||||||
Tags | No tags attached. | ||||||||||||||
Relationships |
| ||||||||||||||
Attached Files | language_support.cmake (1,285) 2009-07-16 19:45 https://public.kitware.com/Bug/file/2365/language_support.cmake language_support_v2.cmake (2,248) 2009-08-22 22:23 https://public.kitware.com/Bug/file/2421/language_support_v2.cmake | ||||||||||||||
Issue History | |||||||||||||||
Date Modified | Username | Field | Change | ||||||||||||
2009-06-29 18:33 | Alan W. Irwin | New Issue | |||||||||||||
2009-06-29 19:45 | Alan W. Irwin | Note Added: 0016780 | |||||||||||||
2009-06-30 12:58 | Alex Neundorf | Status | new => assigned | ||||||||||||
2009-06-30 12:58 | Alex Neundorf | Assigned To | => Alex Neundorf | ||||||||||||
2009-07-16 19:45 | Alan W. Irwin | File Added: language_support.cmake | |||||||||||||
2009-07-16 19:52 | Alan W. Irwin | Note Added: 0016887 | |||||||||||||
2009-08-22 22:22 | Greg Sharp | Note Added: 0017180 | |||||||||||||
2009-08-22 22:23 | Greg Sharp | File Added: language_support_v2.cmake | |||||||||||||
2009-08-22 22:34 | Greg Sharp | Note Added: 0017181 | |||||||||||||
2009-08-22 23:09 | Greg Sharp | Note Edited: 0017180 | |||||||||||||
2009-08-22 23:09 | Greg Sharp | Note Deleted: 0017181 | |||||||||||||
2009-08-22 23:09 | Greg Sharp | Note Edited: 0017180 | |||||||||||||
2009-08-22 23:10 | Greg Sharp | Note Edited: 0017180 | |||||||||||||
2009-11-25 18:13 | Marcel Loose | Note Added: 0018597 | |||||||||||||
2009-11-27 04:00 | Marcel Loose | Note Added: 0018600 | |||||||||||||
2010-06-18 12:51 | David Cole | Summary | enable_language(.... OPTIONAL) signature does not work correctly => enable_language(.... OPTIONAL) signature does not work correctly | ||||||||||||
2011-04-14 14:28 | David Cole | Target Version | => CMake 2.8.5 | ||||||||||||
2011-05-25 16:59 | David Cole | Note Added: 0026593 | |||||||||||||
2011-05-25 16:59 | David Cole | Target Version | CMake 2.8.5 => | ||||||||||||
2011-08-01 11:32 | David Cole | Assigned To | Alex Neundorf => David Cole | ||||||||||||
2011-08-01 11:32 | David Cole | Target Version | => CMake 2.8.6 | ||||||||||||
2011-09-22 16:56 | David Cole | Note Added: 0027476 | |||||||||||||
2011-09-22 16:56 | David Cole | Target Version | CMake 2.8.6 => | ||||||||||||
2012-05-18 10:12 | sleske | Note Added: 0029507 | |||||||||||||
2012-05-18 10:39 | sleske | Note Added: 0029510 | |||||||||||||
2012-05-21 08:20 | Marcel Loose | Note Added: 0029517 | |||||||||||||
2012-05-21 15:06 | sleske | Note Added: 0029533 | |||||||||||||
2012-10-15 11:31 | David Cole | Relationship added | related to 0010227 | ||||||||||||
2012-10-15 11:32 | David Cole | Relationship added | related to 0008345 | ||||||||||||
2012-11-21 14:57 | David Cole | Note Added: 0031650 | |||||||||||||
2012-11-21 14:58 | David Cole | Assigned To | David Cole => | ||||||||||||
2012-11-21 15:11 | David Cole | Status | assigned => new | ||||||||||||
2012-11-21 15:11 | David Cole | Note Added: 0031671 | |||||||||||||
2014-09-10 16:36 | sleske | Note Edited: 0029533 | bug_revision_view_page.php?bugnote_id=29533#r1566 | ||||||||||||
2015-02-06 14:15 | Brad King | Note Added: 0037940 | |||||||||||||
2015-02-12 08:35 | Brad King | Note Added: 0037958 | |||||||||||||
2016-06-10 14:27 | Kitware Robot | Note Added: 0041575 | |||||||||||||
2016-06-10 14:27 | Kitware Robot | Status | new => resolved | ||||||||||||
2016-06-10 14:27 | Kitware Robot | Resolution | open => moved | ||||||||||||
2016-06-10 14:27 | Kitware Robot | Assigned To | => Kitware Robot | ||||||||||||
2016-06-10 14:30 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|