Permalink
Browse files

CMake Python mapscript: avoid cmake 3.12 error with get_target_proper…

…ty LOCATION
  • Loading branch information...
rouault committed Sep 7, 2018
1 parent 5379636 commit 9594c2f30b6667a8109bbdb72cba79a0ca9f0ea6
Showing with 7 additions and 0 deletions.
  1. +7 −0 mapscript/python/CMakeLists.txt
@@ -39,6 +39,13 @@ set_target_properties(${SWIG_MODULE_pythonmapscript_REAL_NAME} PROPERTIES OUTPUT
execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
# FIXME: this is to avoid the following error
# CMake Error at mapscript/python/CMakeLists.txt:42 (get_target_property):
# The LOCATION property may not be read from target "_pythonmapscript". Use
# the target name directly with add_custom_command, or use the generator
# expression $<TARGET_FILE>, as appropriate.
cmake_policy(SET CMP0026 OLD)
get_target_property(LOC_MAPSCRIPT_LIB ${SWIG_MODULE_pythonmapscript_REAL_NAME} LOCATION)
set(mapscript_files ${LOC_MAPSCRIPT_LIB} ${CMAKE_CURRENT_BINARY_DIR}/mapscript.py)
install(FILES ${mapscript_files} DESTINATION ${PYTHON_SITE_PACKAGES})

0 comments on commit 9594c2f

Please sign in to comment.