Skip to content

Commit 44ec93d

Browse files
committed
add if-clause for macOS
1 parent 0d96e36 commit 44ec93d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

CMakeLists.txt

+11-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,17 @@ include(${CMAKE_MODULE_PATH}/get_version.cmake) # Determine project version
7474

7575
include(GNUInstallDirs) # Define GNU standard installation directories
7676

77-
# Define install directory /usr/local/share [the new MacOS does not allow changes to /usr/share ]
78-
set(CMAKE_INSTALL_SHAREDIR /usr/local/share/)
77+
# Define install directory /usr/local/share [not /usr/share on MacOS]
78+
cmake_host_system_information(RESULT OS_NAME QUERY OS_NAME)
79+
message(STATUS "Checking for OS_NAME: ${OS_NAME}")
80+
81+
if (OS_NAME STREQUAL "macOS")
82+
message(STATUS "set(CMAKE_INSTALL_SHAREDIR /usr/local/share)")
83+
set(CMAKE_INSTALL_SHAREDIR /usr/local/share/)
84+
else ()
85+
message(STATUS "set(CMAKE_INSTALL_SHAREDIR /usr/share)")
86+
set(CMAKE_INSTALL_SHAREDIR /usr/share/)
87+
endif ()
7988

8089
## Set C build flags
8190
if (NOT MSVC)

0 commit comments

Comments
 (0)