Skip to content

Commit

Permalink
Fix python module install on macos
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sisson <5761292+marksisson@users.noreply.github.com>
  • Loading branch information
marksisson authored and cary-ilm committed Apr 28, 2020
1 parent 0b26caf commit b9199b5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions PyIlmBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ function(PYILMBASE_EXTRACT_REL_SITEARCH varname pyver pyexe pysitearch)
endwhile()
math(EXPR _elen "${_elen}+1")
string(SUBSTRING ${_basedir} ${_elen} -1 _reldir)
if(APPLE)
# on macOS, set install path to user's python package directory
# so that elevated privileges are not necessary
execute_process(
COMMAND "${pyexe}" -c "if True:
import sysconfig
print(sysconfig.get_path('platlib', 'posix_user'))"
OUTPUT_VARIABLE _reldir
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
set(${varname} ${_reldir} CACHE STRING "Destination sub-folder (relative) for the python ${pyver} modules")
message(STATUS " -> Will install to: ${_reldir}")
endfunction()
Expand Down

0 comments on commit b9199b5

Please sign in to comment.