diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2019-12-03 18:24:04 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2019-12-05 15:06:44 +0100 |
commit | 6d4cd58cd4b1b2f3906889009da7b71931645e93 (patch) | |
tree | 79060a11823f51b24eb5a6c56696f8aec26e0efd /src/CMakeLists.txt | |
parent | 571c8c59715656c317e1c352ea5012171583ce05 (diff) | |
download | fork-ledger-6d4cd58cd4b1b2f3906889009da7b71931645e93.tar.gz fork-ledger-6d4cd58cd4b1b2f3906889009da7b71931645e93.tar.bz2 fork-ledger-6d4cd58cd4b1b2f3906889009da7b71931645e93.zip |
Modernize CMake using backported FindPython module.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 756df376..5eddd5ac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -272,7 +272,6 @@ endif() include(GNUInstallDirs) if (BUILD_LIBRARY) - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") add_library(libledger SHARED ${LEDGER_SOURCES}) add_ledger_library_dependencies(libledger) set_target_properties(libledger PROPERTIES @@ -283,8 +282,8 @@ if (BUILD_LIBRARY) add_executable(ledger main.cc global.cc) target_link_libraries(ledger libledger) - if (CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_BOOST_PYTHON) - target_link_libraries(ledger ${PYTHON_LIBRARIES}) + if (HAVE_BOOST_PYTHON) + target_link_libraries(ledger ${Python_LIBRARIES}) endif() install(TARGETS libledger DESTINATION ${CMAKE_INSTALL_LIBDIR}) @@ -296,15 +295,7 @@ else() endif() if (USE_PYTHON) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c - "from __future__ import print_function -import distutils.sysconfig as s -print(s.get_python_lib(True, prefix=''))" - OUTPUT_VARIABLE _TMP_PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE) - set(PYTHON_SITE_PACKAGES ${_TMP_PYTHON_SITE_PACKAGES} - CACHE PATH "python module directory (${_TMP_PYTHON_SITE_PACKAGES})") - - if (PYTHON_SITE_PACKAGES) + if (Python_SITEARCH) if (WIN32 AND NOT CYGWIN) set(_ledger_python_module_name "ledger.pyd") elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) @@ -323,9 +314,9 @@ print(s.get_python_lib(True, prefix=''))" $<TARGET_FILE:libledger> "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}") install( FILES "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}" - DESTINATION ${PYTHON_SITE_PACKAGES}) + DESTINATION ${Python_SITEARCH}) else() - message(WARNING "PYTHON_SITE_PACKAGES not set. Will not install python module.") + message(WARNING "Python_SITEARCH not set. Will not install python module.") endif() endif() |