summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-08-25 15:00:35 (GMT)
committerBrad King <brad.king@kitware.com>2023-08-25 15:05:18 (GMT)
commit6b01a27f901b5eb392955fea322cde44a1b782a3 (patch)
tree331d6031910ec79cd0bb22e7ced9ea37b505e805 /Modules
parent5ae0030e90df07e56dc16b0210bd334650dcc9d4 (diff)
downloadCMake-6b01a27f901b5eb392955fea322cde44a1b782a3.zip
CMake-6b01a27f901b5eb392955fea322cde44a1b782a3.tar.gz
CMake-6b01a27f901b5eb392955fea322cde44a1b782a3.tar.bz2
macOS: Simplify imported framework locations in find modules
Take advantage of commit d605f728f7 (macOS: Allow IMPORTED_LOCATION to be a framework folder, 2023-06-16) to remove special-case framework logic from find modules. This changes link lines from `/path/to/Foo.framework/Foo[.tbd]` to `-framework Foo`. With the latter, the linker will automatically choose the `.tbd` if it exists. Issue: #24946
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindGLUT.cmake55
-rw-r--r--Modules/FindOpenAL.cmake12
-rw-r--r--Modules/FindOpenGL.cmake26
3 files changed, 25 insertions, 68 deletions
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index 09403bc..613d315 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -107,18 +107,8 @@ elseif(APPLE)
if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa)
add_library(GLUT::Cocoa UNKNOWN IMPORTED)
- # Cocoa should always be a Framework, but we check to make sure.
- if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$")
- set(_glut_cocoa "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}")
- if(EXISTS "${_glut_cocoa}.tbd")
- string(APPEND _glut_cocoa ".tbd")
- endif()
- set_target_properties(GLUT::Cocoa PROPERTIES
- IMPORTED_LOCATION "${_glut_cocoa}")
- else()
- set_target_properties(GLUT::Cocoa PROPERTIES
- IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}")
- endif()
+ set_target_properties(GLUT::Cocoa PROPERTIES
+ IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}")
endif()
else()
if(BEOS)
@@ -196,32 +186,23 @@ if (GLUT_FOUND)
add_library(GLUT::GLUT UNKNOWN IMPORTED)
set_target_properties(GLUT::GLUT PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIRS}")
- if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$")
- set(_glut_glut "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}")
- if(EXISTS "${_glut_glut}.tbd")
- string(APPEND _glut_glut ".tbd")
- endif()
+ if(GLUT_glut_LIBRARY_RELEASE)
+ set_property(TARGET GLUT::GLUT APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(GLUT::GLUT PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${GLUT_glut_LIBRARY_RELEASE}")
+ endif()
+
+ if(GLUT_glut_LIBRARY_DEBUG)
+ set_property(TARGET GLUT::GLUT APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(GLUT::GLUT PROPERTIES
- IMPORTED_LOCATION "${_glut_glut}")
- else()
- if(GLUT_glut_LIBRARY_RELEASE)
- set_property(TARGET GLUT::GLUT APPEND PROPERTY
- IMPORTED_CONFIGURATIONS RELEASE)
- set_target_properties(GLUT::GLUT PROPERTIES
- IMPORTED_LOCATION_RELEASE "${GLUT_glut_LIBRARY_RELEASE}")
- endif()
-
- if(GLUT_glut_LIBRARY_DEBUG)
- set_property(TARGET GLUT::GLUT APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(GLUT::GLUT PROPERTIES
- IMPORTED_LOCATION_DEBUG "${GLUT_glut_LIBRARY_DEBUG}")
- endif()
-
- if(NOT GLUT_glut_LIBRARY_RELEASE AND NOT GLUT_glut_LIBRARY_DEBUG)
- set_property(TARGET GLUT::GLUT APPEND PROPERTY
- IMPORTED_LOCATION "${GLUT_glut_LIBRARY}")
- endif()
+ IMPORTED_LOCATION_DEBUG "${GLUT_glut_LIBRARY_DEBUG}")
+ endif()
+
+ if(NOT GLUT_glut_LIBRARY_RELEASE AND NOT GLUT_glut_LIBRARY_DEBUG)
+ set_property(TARGET GLUT::GLUT APPEND PROPERTY
+ IMPORTED_LOCATION "${GLUT_glut_LIBRARY}")
endif()
if(TARGET GLUT::Xmu)
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index 3d58569..c8e295b 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -106,15 +106,9 @@ find_package_handle_standard_args(
mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL)
- if(OPENAL_LIBRARY MATCHES "/([^/]+)\\.framework$")
- add_library(OpenAL::OpenAL INTERFACE IMPORTED)
- set_target_properties(OpenAL::OpenAL PROPERTIES
- INTERFACE_LINK_LIBRARIES "${OPENAL_LIBRARY}")
- else()
- add_library(OpenAL::OpenAL UNKNOWN IMPORTED)
- set_target_properties(OpenAL::OpenAL PROPERTIES
- IMPORTED_LOCATION "${OPENAL_LIBRARY}")
- endif()
+ add_library(OpenAL::OpenAL UNKNOWN IMPORTED)
+ set_target_properties(OpenAL::OpenAL PROPERTIES
+ IMPORTED_LOCATION "${OPENAL_LIBRARY}")
set_target_properties(OpenAL::OpenAL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}")
endif()
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 843f787..1527c31 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -655,17 +655,8 @@ if(OPENGL_FOUND)
# A legacy GL library is available, so use it for the legacy GL target.
if(IS_ABSOLUTE "${OPENGL_gl_LIBRARY}")
add_library(OpenGL::GL UNKNOWN IMPORTED)
- if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$")
- set(_gl_fw "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}")
- if(EXISTS "${_gl_fw}.tbd")
- string(APPEND _gl_fw ".tbd")
- endif()
- set_target_properties(OpenGL::GL PROPERTIES
- IMPORTED_LOCATION "${_gl_fw}")
- else()
- set_target_properties(OpenGL::GL PROPERTIES
- IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}")
- endif()
+ set_target_properties(OpenGL::GL PROPERTIES
+ IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}")
else()
add_library(OpenGL::GL INTERFACE IMPORTED)
set_target_properties(OpenGL::GL PROPERTIES
@@ -709,17 +700,8 @@ if(OPENGL_FOUND)
if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU)
if(IS_ABSOLUTE "${OPENGL_glu_LIBRARY}")
add_library(OpenGL::GLU UNKNOWN IMPORTED)
- if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$")
- set(_glu_fw "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}")
- if(EXISTS "${_glu_fw}.tbd")
- string(APPEND _glu_fw ".tbd")
- endif()
- set_target_properties(OpenGL::GLU PROPERTIES
- IMPORTED_LOCATION "${_glu_fw}")
- else()
- set_target_properties(OpenGL::GLU PROPERTIES
- IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}")
- endif()
+ set_target_properties(OpenGL::GLU PROPERTIES
+ IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}")
else()
add_library(OpenGL::GLU INTERFACE IMPORTED)
set_target_properties(OpenGL::GLU PROPERTIES