From c1c550141cae1a7c19860fb4943b0a1145b8e2d6 Mon Sep 17 00:00:00 2001 From: Huanchen Zhai Date: Fri, 13 Oct 2023 20:03:31 -0700 Subject: [PATCH] fix macos-12 build --- CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f5b68d..73bc362 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,16 @@ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; \ print(distutils.sysconfig.get_config_var('INCLUDEDIR'))" OUTPUT_VARIABLE PYTHON_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) -IF (NOT PYTHONLIBS_FOUND) +IF (PYTHONLIBS_FOUND) + STRING(FIND ${PYTHONLIBS_VERSION_STRING} "." PYV_L REVERSE) + STRING(SUBSTRING ${PYTHONLIBS_VERSION_STRING} 0 ${PYV_L} PYTHONLIBS_VERSION_STRING_SHORT) +ELSE() + SET(PYTHONLIBS_VERSION_STRING_SHORT 0.0) +ENDIF() + +MESSAGE(STATUS "PYTHONLIBS_VERSION_STRING_SHORT = ${PYTHONLIBS_VERSION_STRING_SHORT}") + +IF ((NOT PYTHONLIBS_FOUND) OR NOT (${PYTHONLIBS_VERSION_STRING_SHORT} EQUAL ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})) EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; \ import os; print(os.path.join(distutils.sysconfig.get_config_var('LIBDIR'), \ distutils.sysconfig.get_config_var('LDLIBRARY')))" @@ -248,11 +257,11 @@ ENDIF() SET(OPT_FLAG ${OPT_FLAG} -fvisibility=hidden) IF ((NOT APPLE) AND (NOT WIN32)) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC rt) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rt) ENDIF() -TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${OMP_LIB_NAME} ${PTHREAD}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MKL_LIBS} ${HPTT_LIB} ${CUT_LIB}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${OMP_LIB_NAME} ${PTHREAD}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MKL_LIBS} ${HPTT_LIB} ${CUT_LIB}) MESSAGE(STATUS "ARCH_FLAG = ${ARCH_FLAG}") MESSAGE(STATUS "OPT_FLAG = ${OPT_FLAG}")