From e1d7cd879d0630379a44a281332692c382d4f85c Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Fri, 12 May 2017 13:10:10 +0200 Subject: [PATCH] Don't link TCL/TK to gui lib on MacOS In case there are multiple versions of tcl/tk available on MacOS, the system complains about it if we link against one version and python/tkinter links against another. Thus don't link with any tcl at all in the gui library. This means the library will use the version loaded by tkinter. --- ng/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ng/CMakeLists.txt b/ng/CMakeLists.txt index 1a553edc..9fca6c27 100644 --- a/ng/CMakeLists.txt +++ b/ng/CMakeLists.txt @@ -19,11 +19,20 @@ if(USE_GUI) add_library(gui SHARED ${gui_sources}) add_executable(netgen ${netgen_sources}) - target_link_libraries( gui PUBLIC nglib ${TK_LIBRARY} ${TCL_LIBRARY} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${FFMPEG_LIBRARIES} ${X11_X11_LIB} ${OCC_LIBRARIES} ) + target_link_libraries( gui PUBLIC nglib ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${FFMPEG_LIBRARIES} ${X11_X11_LIB} ${OCC_LIBRARIES} ) target_link_libraries( gui PRIVATE ${LIBTOGL}) target_link_libraries( netgen nglib gui ) + if(APPLE) + # Leave decision about which tcl/tk version to use open to python (and it's tkinter package). + # Thus, only link tcl/tk to the netgen executable and not to the gui library. + target_link_libraries( netgen ${TK_LIBRARY} ${TCL_LIBRARY}) + else(APPLE) + # On other systems assume that the found libraries are compatible with python/tkinter + target_link_libraries( gui PUBLIC ${TK_LIBRARY} ${TCL_LIBRARY}) + endif(APPLE) + if(NOT WIN32) target_link_libraries( netgen mesh stlvis stl geom2dvis interface geom2d csg stl visual csgvis ) target_link_libraries( gui PUBLIC mesh stlvis stl geom2dvis interface geom2d csg stl visual csgvis )