Skip to content

Commit 4fdd294

Browse files
committed
remove broken macOS LaunchServices database search
1 parent 210e926 commit 4fdd294

File tree

1 file changed

+0
-72
lines changed

1 file changed

+0
-72
lines changed

CMake/Mathematica/FindMathematica.cmake

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ set (Mathematica_CMAKE_MODULE_VERSION "4.1.0")
3636
include(TestBigEndian)
3737
include(CMakeParseArguments)
3838
include(FindPackageHandleStandardArgs)
39-
include(CMakeFindFrameworks)
4039

4140
# internal function to convert Windows path to Cygwin workable CMake path
4241
# E.g., "C:\Program Files" is converted to "/cygdrive/c/Program Files"
@@ -276,75 +275,6 @@ function (_add_registry_search_paths _outSearchPaths)
276275
endif()
277276
endfunction()
278277

279-
# internal function to determine Mathematica installation paths from macOS LaunchServices database
280-
function (_add_launch_services_search_paths _outSearchPaths)
281-
if (CMAKE_HOST_APPLE)
282-
# the lsregister executable is needed to search the LaunchServices database
283-
# the executable usually resides in the LaunchServices framework Support directory
284-
# The LaunchServices framework is a sub-framework of the CoreServices umbrella framework
285-
cmake_find_frameworks(CoreServices)
286-
find_program (Mathematica_LSRegister_EXECUTABLE
287-
NAMES "lsregister"
288-
PATH_SUFFIXES "/Frameworks/LaunchServices.framework/Support"
289-
HINTS ${CoreServices_FRAMEWORKS})
290-
mark_as_advanced(
291-
Mathematica_CoreServices_DIR
292-
Mathematica_LaunchServices_DIR
293-
Mathematica_LSRegister_EXECUTABLE)
294-
if (NOT Mathematica_LSRegister_EXECUTABLE)
295-
message (STATUS "Skipping search of the LaunchServices database, because the lsregister executable could not be found.")
296-
return()
297-
endif()
298-
foreach (_bundleID IN ITEMS ${ARGN})
299-
execute_process(
300-
COMMAND "${Mathematica_LSRegister_EXECUTABLE}" "-dump"
301-
COMMAND "grep" "--before-context=20" "--after-context=20" "${_bundleID}"
302-
COMMAND "grep" "--only-matching" "/.*\\.app"
303-
TIMEOUT 20 OUTPUT_VARIABLE _queryResult ERROR_QUIET)
304-
string (REPLACE ";" "\\;" _queryResult "${_queryResult}")
305-
string (REPLACE "\n" ";" _appPaths "${_queryResult}")
306-
if (_appPaths)
307-
# put paths into canonical order
308-
list (SORT _appPaths)
309-
list (REVERSE _appPaths)
310-
else()
311-
message (STATUS "No Mathematica apps registered in macOS LaunchServices database.")
312-
endif()
313-
if (Mathematica_DEBUG)
314-
message (STATUS "macOS LaunchServices database registered apps=${_appPaths}")
315-
endif()
316-
if (_appPaths)
317-
set (_paths "")
318-
set (_insertIndex 0)
319-
foreach (_appPath IN LISTS _appPaths)
320-
# ignore paths that no longer exist
321-
if (EXISTS "${_appPath}")
322-
_to_cmake_path("${_appPath}" _appPath)
323-
if (Mathematica_FIND_VERSION AND Mathematica_FIND_VERSION_EXACT)
324-
if ("${_appPath}" MATCHES "${Mathematica_FIND_VERSION_MAJOR}.${Mathematica_FIND_VERSION_MINOR}")
325-
# insert in front of other versions if version matches requested one
326-
list (LENGTH _paths _len)
327-
if (_len EQUAL _insertIndex)
328-
list (APPEND _paths "${_appPath}")
329-
else()
330-
list (INSERT _paths ${_insertIndex} "${_appPath}")
331-
endif()
332-
math(EXPR _insertIndex "${_insertIndex} + 1")
333-
else()
334-
list (APPEND _paths "${_appPath}")
335-
endif()
336-
else()
337-
list (APPEND _paths "${_appPath}")
338-
endif()
339-
endif()
340-
endforeach()
341-
list (APPEND ${_outSearchPaths} ${_paths})
342-
endif()
343-
endforeach()
344-
set (${_outSearchPaths} ${${_outSearchPaths}} PARENT_SCOPE)
345-
endif()
346-
endfunction()
347-
348278
# internal macro to determine default Mathematica installation (the one which is on the system search path)
349279
macro (_add_default_search_path _outSearchPaths)
350280
set (_searchPaths "")
@@ -412,8 +342,6 @@ macro (_get_search_paths _outSearchPaths)
412342
if (CMAKE_SYSTEM_APPBUNDLE_PATH)
413343
list (APPEND ${_outSearchPaths} ${CMAKE_SYSTEM_APPBUNDLE_PATH})
414344
endif()
415-
# add non-standard installation paths from macOS LaunchServices database
416-
_add_launch_services_search_paths(${_outSearchPaths} "com.wolfram.Mathematica")
417345
elseif (CMAKE_HOST_UNIX)
418346
# add standard Mathematica Unix installation paths
419347
list (APPEND ${_outSearchPaths} "/usr/local/Wolfram" "/opt/Wolfram")

0 commit comments

Comments
 (0)