diff options
author | Tim D. Smith <git@tim-smith.us> | 2015-05-04 14:55:14 -0700 |
---|---|---|
committer | Tim D. Smith <git@tim-smith.us> | 2015-05-04 14:55:14 -0700 |
commit | 5f08e2786d483eccdc2760451f0fbdb52727ccf1 (patch) | |
tree | 7d5f1bfb6ae19b00fb53f176cb77c1f398ceb185 /CMakeLists.txt | |
parent | 61156c861818642fb624932af3c7c7b63b14a5b3 (diff) | |
download | fork-ledger-5f08e2786d483eccdc2760451f0fbdb52727ccf1.tar.gz fork-ledger-5f08e2786d483eccdc2760451f0fbdb52727ccf1.tar.bz2 fork-ledger-5f08e2786d483eccdc2760451f0fbdb52727ccf1.zip |
Don't explicitly link libpython on OS X
Use -undefined dynamic_lookup to allow Python symbols to be discovered
when the ledger module is imported instead of at build time. Without
this change, the Python interpreter crashes when ledger is imported from
a python that is different from (but compatible with) the python against
which the module was built.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index da075cde..6166780c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,7 +225,14 @@ macro(add_ledger_library_dependencies _target) target_link_libraries(${_target} ${INTL_LIB}) endif() if (HAVE_BOOST_PYTHON) - target_link_libraries(${_target} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) + if(APPLE) + # Don't link directly to a Python framework on OS X, to avoid segfaults + # when the module is imported from a different interpreter + target_link_libraries(${_target} ${Boost_LIBRARIES}) + set_target_properties(${_target} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + else() + target_link_libraries(${_target} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) + endif() else() target_link_libraries(${_target} ${Boost_LIBRARIES}) endif() |