Opened 6 years ago

Closed 2 months ago

#1041 closed defect/bug (fixed)

If no C++ compiler is installed, CMake configure step is re-run for every "make"

Reported by: sleske Owned by: KaZeR
Priority: minor Milestone: version 0.5.1
Component: core Version: git master
Severity: normal Keywords: build, make, compile, cmake
Cc:

Description

Normally when building with CMake, the CMake configure step (checking for installed compilers, libs etc.) only happens once, and is only repeated when CMakeLists.txt has changed.

However, if no C++ compiler is installed, the CMake configure step is re-run for every invocation of "make".

This does not cause the build to fail, but slows it down, especially if only a few files need to be recompiled.

To reproduce: Deinstall g++ (or temporarily rename /usr/bin/g++ & /usr/bin/c++ ). Run cmake, then run make. Note that the CMake configure step is re-run when invoking "make".

Platform: Debian squeeze.

Change History (6)

comment:1 Changed 6 years ago by sleske

This is caused by a bug in CMake. Navit's main CMakeLists.txt uses

enable_language(CXX OPTIONAL)

However, enable_language(... OPTIONAL) is currently broken in CMake (see http://public.kitware.com/Bug/view.php?id=9220 , http://public.kitware.com/Bug/view.php?id=8345 ).

There is a workaround in CMakeLists.txt (see comment), but it cannot fix the problem described in this bug.

comment:2 Changed 4 years ago by usul

  • Keywords build make compile cmake added
  • Milestone set to version 0.5.1

Is this issue still a problem or does current versions of CMake have fixed this bug?

comment:3 Changed 4 years ago by sleske

This problem still occurs (tested with CMake 2.8.11). The CMake bugs linke above have not been addressed in the meantime, so it seems unlikely CMake will fix this shortly.

comment:4 Changed 3 years ago by sleske

  • Severity set to normal

TThe problem no longer occurs with CMake 2.8.12.2 (but is still reproducible with 2.8.11), so it seems to have been fixed in CMake. Kudos to the CMake devs!

Tested on: Debian jessie, current SVN (rev.5889).

This means that for CMake 2.8.12.2, the workaround in CMakeLists.txt can be removed. I'm still keeping it for now, because with CMake <=2.8.9 the build will fail without the workaround if no C++ compiler is installed (error message: "get_filename_component called with incorrect number of arguments").

So to remove the workaround, we'd need to require at least CMake 2.8.10 (released October 2012). Before we do this, I'd like to make sure this does not break anyone's builds (particularly the nightly builds). Any ideas?

comment:5 Changed 3 years ago by tryagain

Sleske, our nightly build uses CMake 2.8.8, so please don't remove the workaround now.

comment:6 Changed 2 months ago by http://wiki.navit-project.org/index.php/user:jkoan

  • Resolution set to fixed
  • Status changed from new to closed

https://cmake.org/cmake/help/v3.10/command/enable_language.html as said in there docs, the Keyword "OPTIONAL" is only a Placeholder so it should not work.

Even trough we have a workaround and it is working, so closing right now.

Note: See TracTickets for help on using tickets.