Link Python privately

- Avoid dead paths if Python is installed to different dir on target
machine (etc. with binary installers)
This commit is contained in:
Matthias Hochsteger 2019-03-26 11:06:59 +01:00
parent fefddf14cc
commit b85fe2898e
2 changed files with 4 additions and 3 deletions

View File

@ -28,8 +28,8 @@ install(TARGETS ngcore DESTINATION ${NG_INSTALL_DIR} COMPONENT netgen)
if(USE_PYTHON)
target_compile_definitions(ngcore PUBLIC NETGEN_PYTHON)
target_include_directories(ngcore PUBLIC ${PYTHON_INCLUDE_DIRS})
target_link_libraries(ngcore PUBLIC ${PYTHON_LIBRARIES})
target_include_directories(ngcore PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(ngcore PRIVATE ${PYTHON_LIBRARIES})
endif(USE_PYTHON)
install(FILES ngcore.hpp archive.hpp type_traits.hpp version.hpp ngcore_api.hpp logging.hpp

View File

@ -30,7 +30,7 @@ if(USE_GUI)
target_link_libraries( gui PRIVATE ${TCL_LIBRARY} ${TK_LIBRARY})
endif(NOT APPLE)
target_link_libraries( netgen nglib gui ${LIBTOGL} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${FFMPEG_LIBRARIES} ${X11_Xmu_LIB} ${X11_X11_LIB} ${OCC_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY})
target_link_libraries( netgen nglib gui ${LIBTOGL} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${FFMPEG_LIBRARIES} ${X11_Xmu_LIB} ${X11_X11_LIB} ${OCC_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY} ${PYTHON_LIBRARIES})
if(NOT WIN32)
target_link_libraries( netgen mesh stlvis stl geom2dvis interface geom2d csg stl visual csgvis )
@ -50,6 +50,7 @@ if(USE_GUI)
endif(USE_GUI)
if(USE_PYTHON)
target_link_libraries( gui PRIVATE ${PYTHON_LIBRARIES})
add_library(ngpy SHARED netgenpy.cpp)
target_link_libraries( ngpy PUBLIC nglib PRIVATE ${PYTHON_LIBRARIES})
if(APPLE)