Skip to content

Commit 71330d8

Browse files
committed
fix: Application bundle integrity issues on macOS 13
This commit unbundles the macOS app to keep only what's really needed & get rid of the GUI stuff.
1 parent ff1a0c4 commit 71330d8

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

CMakeLists.txt

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,22 +380,41 @@ include\(\"${CMakeProject_BINARY_DIR}/cmake_install.cmake\")
380380

381381
set(CMAKE_INSTALL_MESSAGE "NEVER")
382382

383+
if(APPLE)
384+
set(distribution_root "${CMakeProject_BINARY_DISTRIBUTION_DIR}/CMake.app/Contents")
385+
else()
386+
set(distribution_root "${CMakeProject_BINARY_DISTRIBUTION_DIR}")
387+
endif()
388+
383389
# Install all files from binary distribution
384390
file(GLOB_RECURSE binary_distribution_files
385391
LIST_DIRECTORIES FALSE
386-
${CMakeProject_BINARY_DISTRIBUTION_DIR}/*
392+
${distribution_root}/*
387393
)
388394
foreach(file IN LISTS binary_distribution_files)
395+
# Skip symlinks like "CMake.app/Contents/Frameworks/QtWidgets.framework/Versions/Current"
396+
if(IS_SYMLINK ${file})
397+
continue()
398+
endif()
399+
400+
# skip some mac app bundle files
401+
set(find_index -1)
402+
foreach(name IN ITEMS CodeResources Info.plist Frameworks _CodeSignature MacOS PlugIns Resources doc/cmake/html man)
403+
string(FIND "${file}" "${distribution_root}/${name}" find_index)
404+
if("${find_index}" EQUAL 0)
405+
break()
406+
endif()
407+
endforeach()
408+
if("${find_index}" EQUAL 0)
409+
continue()
410+
endif()
411+
389412
get_filename_component(directory ${file} DIRECTORY)
390-
file(RELATIVE_PATH relative_directory ${CMakeProject_BINARY_DISTRIBUTION_DIR} ${directory})
413+
file(RELATIVE_PATH relative_directory ${distribution_root} ${directory})
391414
set(type FILES)
392415
if(relative_directory STREQUAL "bin")
393416
set(type PROGRAMS)
394417
endif()
395-
# Skip symlinks like "CMake.app/Contents/Frameworks/QtWidgets.framework/Versions/Current"
396-
if(IS_SYMLINK ${file})
397-
continue()
398-
endif()
399418
set(_permissions)
400419
get_filename_component(filename ${file} NAME)
401420
if(filename MATCHES "ccmake|cmake|cmake-gui|cpack|ctest")

src/cmake/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
if os.path.exists(_cmake_data):
3131
CMAKE_DATA = _cmake_data
3232

33-
if sys.platform.startswith("darwin"):
34-
CMAKE_DATA = os.path.join(CMAKE_DATA, 'CMake.app', 'Contents')
35-
3633
CMAKE_BIN_DIR = os.path.join(CMAKE_DATA, 'bin')
3734
CMAKE_DOC_DIR = os.path.join(CMAKE_DATA, 'doc')
3835
CMAKE_SHARE_DIR = os.path.join(CMAKE_DATA, 'share')

0 commit comments

Comments
 (0)