Created
May 14, 2016 14:43
-
-
Save rafamanzo/2a6b86dc868e8bcd9394680db0174e1d to your computer and use it in GitHub Desktop.
Fixes VTK 7.0.0 compilation with GCC 6.1.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: CMake/GenerateExportHeader.cmake | |
=================================================================== | |
--- a/CMake/GenerateExportHeader.cmake | |
+++ b/CMake/GenerateExportHeader.cmake | |
@@ -163,19 +163,7 @@ endmacro() | |
macro(_test_compiler_hidden_visibility) | |
if(CMAKE_COMPILER_IS_GNUCXX) | |
- execute_process(COMMAND ${CMAKE_C_COMPILER} ARGS --version | |
- OUTPUT_VARIABLE _gcc_version_info | |
- ERROR_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") | |
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2") | |
set(GCC_TOO_OLD TRUE) | |
endif() | |
endif() | |
Index: CMake/vtkCompilerExtras.cmake | |
=================================================================== | |
--- a/CMake/vtkCompilerExtras.cmake | |
+++ b/CMake/vtkCompilerExtras.cmake | |
@@ -27,24 +27,12 @@ if(CMAKE_COMPILER_IS_GNUCXX) | |
"${VTK_EXTRA_SHARED_LINKER_FLAGS} -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}") | |
endif() | |
- # Now check if we can use visibility to selectively export symbols | |
- execute_process(COMMAND ${CMAKE_C_COMPILER} ARGS --version | |
- OUTPUT_VARIABLE _gcc_version_info | |
- ERROR_VARIABLE _gcc_version_info) | |
- | |
- string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]*" | |
- _gcc_version "${_gcc_version_info}") | |
- if(NOT _gcc_version) | |
- string (REGEX REPLACE ".*\\(GCC\\).*([34]\\.[0-9]).*" "\\1.0" | |
- _gcc_version "${_gcc_version_info}") | |
- endif() | |
- | |
# GCC visibility support, on by default and in testing. | |
check_cxx_compiler_flag(-fvisibility=hidden HAVE_GCC_VISIBILITY) | |
option(VTK_USE_GCC_VISIBILITY "Use GCC visibility support if available." OFF) | |
mark_as_advanced(VTK_USE_GCC_VISIBILITY) | |
- if(${_gcc_version} VERSION_GREATER 4.2.0 AND BUILD_SHARED_LIBS | |
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.2.0 AND BUILD_SHARED_LIBS | |
AND HAVE_GCC_VISIBILITY AND VTK_USE_GCC_VISIBILITY | |
AND NOT MINGW AND NOT CYGWIN) | |
# Should only be set if GCC is newer than 4.2.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Successfully compiled vtk6 on CentOS 8 (GCC 8) ,good job !@rafamanzo