Skip to content

Commit 322e6fe

Browse files
committed
update CML to install to /usr/local on macos
1 parent 6c4c268 commit 322e6fe

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
9494
- name: Build mgconsole
9595
run: |
96-
cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .
96+
cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release .
9797
cmake --build build
9898
sudo cmake --install build
9999

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
3333
# Enable explicit static linking of SSL because of generic Linux binary.
3434
set(MGCONSOLE_STATIC_SSL OFF CACHE STRING "Statically link SSL")
3535

36-
# Set default installation directory to '/usr'
36+
# Set default installation directory
3737
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
38-
# '/usr' is a special case, for more details see:
39-
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases
40-
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "install dir" FORCE)
38+
if(APPLE)
39+
# On macOS, use /usr/local as /usr/bin is protected by SIP
40+
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "install dir" FORCE)
41+
else()
42+
# '/usr' is a special case, for more details see:
43+
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases
44+
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "install dir" FORCE)
45+
endif()
4146
endif()
4247

4348
add_subdirectory(src)

0 commit comments

Comments
 (0)