Bug 923024 - cmake should pull in gcc-c++ as a runtime dependency
Summary: cmake should pull in gcc-c++ as a runtime dependency
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: cmake
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-19 03:11 UTC by Michel Lind
Modified: 2013-03-20 02:54 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-03-20 02:39:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Michel Lind 2013-03-19 03:11:57 UTC
Description of problem:
Cmake is normally used to build C++ programs, so this is not often an issue. However, today I'm trying to compile Granite (part of Elementary OS), which is written in Vala but uses Cmake as its build system.

There is no mention of CXX -- or any C++ source files -- in the Granite tree (it does the normal Vala->C->binary compilation process), but the cmake invocation would still fail if g++ is not detected.

If the test for CXX cannot be disabled, perhaps the Cmake package should just add gcc-c++ as a runtime dep?

(note: I tried installing gcc-c++ but renaming the compiler binary to g++.bak, ensuring that any attempt to use it will fail -- CMake picked up that C++ is installed but the compilation still succeeds, so the CXX test is definitely not needed)

Version-Release number of selected component (if applicable):
cmake-2.8.10.2-3.fc18.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install cmake
2. Remove gcc-c++
3. Try and compile Granite: https://code.launchpad.net/granite
  
Actual results:
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.


Expected results:
CMake should either not assume a project depend on a C++ compiler by default, or the packaging should depend on it.

Additional info:

Comment 1 Petr Machata 2013-03-19 11:23:21 UTC
(In reply to comment #0)
> (note: I tried installing gcc-c++ but renaming the compiler binary to
> g++.bak, ensuring that any attempt to use it will fail -- CMake picked up
> that C++ is installed but the compilation still succeeds, so the CXX test is
> definitely not needed)

Are you sure it didn't just try "gcc -x c++", or even simply "cc -c test.cc"?  You don't have to go through the g++ driver to compile C++ code.

Comment 2 Michel Lind 2013-03-19 14:03:13 UTC
No mention of c++ or cc anywhere in the source tree. Though I'm not that familiar with CMake internals, so someone more knowledgeable should probably check if there is something wrong in the various CMakeFiles in the project.

  $ bzr branch lp:granite

Comment 3 Orion Poplawski 2013-03-19 17:32:18 UTC
Why not just ignore the error?  I don't believe it causes any problems.

Comment 4 Michel Lind 2013-03-20 02:06:31 UTC
(In reply to comment #3)
> Why not just ignore the error?  I don't believe it causes any problems.

On the build systems, no problem because gcc-c++ is part of the default environment. On user systems, it could cause some surprise for non-C++-developers such as myself

Comment 5 Orion Poplawski 2013-03-20 02:39:24 UTC
C++ is enabled in cmake by default.  If the project does not use it then it should state explicitly the language(s) it uses, e.g.:

project (granite C)

Comment 6 Michel Lind 2013-03-20 02:54:10 UTC
Aha, thanks, that indeed fixes the problem. Filing a bug with upstream


Note You need to log in before you can comment on or make changes to this bug.