Skip to content

Instantly share code, notes, and snippets.

@JM1
Last active July 5, 2019 10:25
Show Gist options
  • Save JM1/c5adad1a1e9266e934e3fec6fd72149f to your computer and use it in GitHub Desktop.
Save JM1/c5adad1a1e9266e934e3fec6fd72149f to your computer and use it in GitHub Desktop.
Fix CMake errors of VTK 6.0 with newer GCC revisions

Fix CMake errors of VTK 6.0 with newer GCC revisions

CMake files of VTK 6.0 do not handle newer GCC output correctly and thus fail with:

CMake Error at /usr/lib/cmake/vtk-6.0/GenerateExportHeader.cmake:177 (if):
  if given arguments:
    "gcc-8 (Ubuntu 8.1.0-5ubuntu1~14.04) 8.1.0
  Copyright (C) 2018 Free Software Foundation, Inc.
  This is free software" " see the source for copying conditions.  There is
  NO
  warranty" " not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
  PURPOSE." "VERSION_LESS" "4.2"
  Unknown arguments specified
Call Stack (most recent call first):
  /usr/lib/cmake/vtk-6.0/GenerateExportHeader.cmake:352 (_test_compiler_hidden_visibility)
  ...

So we just drop those bogus GNU checks in VTK's GenerateExportHeader.cmake which is exactly what newer VTK versions do.

--- a/usr/lib/cmake/vtk-6.0/GenerateExportHeader.cmake 2013-06-12 21:47:10.000000000 +0200
+++ b/usr/lib/cmake/vtk-6.0/GenerateExportHeader.cmake 2019-07-05 11:03:41.237221206 +0200
@@ -163,20 +163,7 @@
macro(_test_compiler_hidden_visibility)
if(CMAKE_COMPILER_IS_GNUCXX)
- exec_program(${CMAKE_C_COMPILER} ARGS --version
- OUTPUT_VARIABLE _gcc_version_info)
- string(REGEX MATCH "[345]\\.[0-9]\\.[0-9]"
- _gcc_version "${_gcc_version_info}")
- # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the
- # patch level, handle this here:
- if(NOT _gcc_version)
- string(REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0"
- _gcc_version "${_gcc_version_info}")
- endif()
-
- if(${_gcc_version} VERSION_LESS "4.2")
- set(GCC_TOO_OLD TRUE)
- endif()
+ set(GCC_TOO_OLD FALSE)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES Intel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment