summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindMPI.cmake2
-rw-r--r--Modules/FindOpenGL.cmake70
-rw-r--r--Modules/FindOpenMP.cmake3
-rw-r--r--Modules/Platform/Windows-MSVC.cmake6
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Tests/FindPatch/Test/CMakeLists.txt4
6 files changed, 69 insertions, 18 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 7f4c44c..3320a07 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -346,7 +346,7 @@ function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE)
# library that has invalid or missing version information there would be warning
# messages emitted by ld.so in the compiler output. In either case, we'll treat
# the output as invalid.
- if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available")
+ if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available|command not found")
set(WRAPPER_RETURN 255)
endif()
# Ensure that no error output might be passed upwards.
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 11843ef..9063492 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -84,12 +84,26 @@
# ``OpenGL::GLX`` or ``OpenGL::EGL``.
#
# Projects may use the ``OpenGL::GL`` target (or ``OPENGL_LIBRARIES`` variable)
-# to use legacy GL. By default, these will use the legacy libGL library file.
-# If ``OPENGL_gl_LIBRARY`` is empty or not found and GLVND is available, the
-# ``OpenGL::GL`` target will use GLVND ``OpenGL::OpenGL`` and ``OpenGL::GLX``
-# (and the ``OPENGL_LIBRARIES`` variable will use the corresponding libraries).
-# Thus, for non-EGL-based Linux targets, the ``OpenGL::GL`` target is most
-# portable.
+# to use legacy GL interfaces. These will use the legacy GL library located
+# by ``OPENGL_gl_LIBRARY``, if available. If ``OPENGL_gl_LIBRARY`` is empty or
+# not found and GLVND is available, the ``OpenGL::GL`` target will use GLVND
+# ``OpenGL::OpenGL`` and ``OpenGL::GLX`` (and the ``OPENGL_LIBRARIES``
+# variable will use the corresponding libraries). Thus, for non-EGL-based
+# Linux targets, the ``OpenGL::GL`` target is most portable.
+#
+# A ``OpenGL_GL_PREFERENCE`` variable may be set to specify the preferred way
+# to provide legacy GL interfaces in case multiple choices are available.
+# The value may be one of:
+#
+# ``GLVND``
+# If the GLVND OpenGL and GLX libraries are available, prefer them.
+# This forces ``OPENGL_gl_LIBRARY`` to be empty.
+# This is the default if components were requested (since components
+# correspond to GLVND libraries).
+#
+# ``LEGACY``
+# Prefer to use the legacy libGL library, if available.
+# This is the default if no components were requested.
#
# For EGL targets the client must rely on GLVND support on the user's system.
# Linking should use the ``OpenGL::OpenGL OpenGL::EGL`` targets. Using GLES*
@@ -179,13 +193,6 @@ else()
/opt/graphics/OpenGL/include /usr/X11R6/include
)
- find_library(OPENGL_gl_LIBRARY
- NAMES GL MesaGL
- PATHS /opt/graphics/OpenGL/lib
- /usr/openwin/lib
- /usr/shlib /usr/X11R6/lib
- ${_OPENGL_LIB_PATH}
- )
# Search for the GLVND libraries. We do this regardless of COMPONENTS; we'll
# take into account the COMPONENTS logic later.
find_library(OPENGL_opengl_LIBRARY
@@ -213,6 +220,43 @@ else()
/usr/shlib /usr/X11R6/lib
)
+ if(NOT DEFINED OpenGL_GL_PREFERENCE)
+ set(OpenGL_GL_PREFERENCE "")
+ endif()
+ if(NOT OpenGL_GL_PREFERENCE STREQUAL "")
+ # A preference has been explicitly specified.
+ if(NOT OpenGL_GL_PREFERENCE MATCHES "^(GLVND|LEGACY)$")
+ message(FATAL_ERROR
+ "OpenGL_GL_PREFERENCE value '${OpenGL_GL_PREFERENCE}' not recognized. "
+ "Allowed values are 'GLVND' and 'LEGACY'."
+ )
+ endif()
+ elseif(OpenGL_FIND_COMPONENTS)
+ # No preference was explicitly specified, but the caller did request
+ # at least one GLVND component. Prefer GLVND for legacy GL.
+ set(OpenGL_GL_PREFERENCE "GLVND")
+ else()
+ # No preference was explicitly specified and no GLVND components were
+ # requested. Prefer libGL for legacy GL.
+ set(OpenGL_GL_PREFERENCE "LEGACY")
+ endif()
+
+ if("x${OpenGL_GL_PREFERENCE}x" STREQUAL "xGLVNDx" AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY)
+ # We can provide legacy GL using GLVND libraries.
+ # Do not use any legacy GL library.
+ set(OPENGL_gl_LIBRARY "")
+ else()
+ # We cannot provide legacy GL using GLVND libraries.
+ # Search for the legacy GL library.
+ find_library(OPENGL_gl_LIBRARY
+ NAMES GL MesaGL
+ PATHS /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ ${_OPENGL_LIB_PATH}
+ )
+ endif()
+
# FPHSA cannot handle "this OR that is required", so we conditionally set what
# it must look for. First clear any previous config we might have done:
set(_OpenGL_REQUIRED_VARS)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 489476b..a6eba6e 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -230,6 +230,7 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
DOC "Path to the ${_OPENMP_IMPLICIT_LIB_PLAIN} library for OpenMP"
HINTS ${OpenMP_${LANG}_IMPLICIT_LINK_DIRS}
CMAKE_FIND_ROOT_PATH_BOTH
+ NO_DEFAULT_PATH
)
endif()
mark_as_advanced(OpenMP_${_OPENMP_IMPLICIT_LIB_PLAIN}_LIBRARY)
@@ -244,6 +245,8 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
find_library(OpenMP_libiomp5md_LIBRARY
NAMES "libiomp5md"
HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}
+ CMAKE_FIND_ROOT_PATH_BOTH
+ NO_DEFAULT_PATH
)
mark_as_advanced(OpenMP_libiomp5md_LIBRARY)
else()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 4719563..0737c12 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -48,7 +48,11 @@ else()
endif()
if(NOT MSVC_VERSION)
- if(CMAKE_C_SIMULATE_VERSION)
+ if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC")
+ set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
+ set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ elseif(CMAKE_C_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_C_SIMULATE_VERSION})
elseif(CMAKE_CXX_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8409287..f1cdb35 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 10)
-set(CMake_VERSION_PATCH 20171115)
+set(CMake_VERSION_PATCH 20171116)
#set(CMake_VERSION_RC 1)
diff --git a/Tests/FindPatch/Test/CMakeLists.txt b/Tests/FindPatch/Test/CMakeLists.txt
index f4cd621..66c672c 100644
--- a/Tests/FindPatch/Test/CMakeLists.txt
+++ b/Tests/FindPatch/Test/CMakeLists.txt
@@ -70,8 +70,8 @@ index 68059b3..c6f30c2 100644
)
add_custom_target(TestPatch ALL
- COMMAND ${Patch_EXECUTABLE} -p1 -i quote-add-author.patch
- COMMAND Patch::patch -p1 -i quote-add-date.patch
+ COMMAND ${Patch_EXECUTABLE} -p1 -i quote-add-author.patch --binary
+ COMMAND Patch::patch -p1 -i quote-add-date.patch --binary
COMMAND ${CMAKE_COMMAND} -E compare_files QUOTE.txt QUOTE.txt.baseline
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)