From 70cbcb1da302e4e04e6769e0ec19951fe46d1e74 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 15 Jul 2024 14:56:18 -0400 Subject: FindMatlab: Restore support for finding Matlab without any languages Revise commit 657064b6d4 (FindMatlab: Refactor: Eliminate _matlab_64Build, 2024-01-24, v3.30.0-rc1~594^2~5) to more faithfully reproduce the original behavior. Revise commit 91c672e5ae (FindMatlab: Use find_package(Threads) instead of checking -pthread, 2024-02-02, v3.30.0-rc1~594^2~1) to restore the old behavior of looking for threads only with C or CXX enabled. Fixes: #26121 --- Modules/FindMatlab.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 84f7c62..45d4681 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -297,7 +297,8 @@ set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}") include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -if(NOT WIN32 AND NOT APPLE AND NOT Threads_FOUND) +if(NOT WIN32 AND NOT APPLE AND NOT Threads_FOUND + AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)) # MEX files use pthread if available set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads) @@ -1776,10 +1777,10 @@ endif() set(MATLAB_INCLUDE_DIR_TO_LOOK ${Matlab_ROOT_DIR}/extern/include) -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_matlab_current_suffix ${_matlab_bin_suffix_64bits}) -else() +if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(_matlab_current_suffix ${_matlab_bin_suffix_32bits}) +else() + set(_matlab_current_suffix ${_matlab_bin_suffix_64bits}) endif() set(Matlab_BINARIES_DIR -- cgit v0.12