diff options
author | Jamie Snape <jamie.snape@kitware.com> | 2016-09-26 17:59:37 (GMT) |
---|---|---|
committer | Jamie Snape <jamie.snape@kitware.com> | 2016-09-26 17:59:37 (GMT) |
commit | 33ec71f343f8b508b16437cc282607d77b996df1 (patch) | |
tree | a3304f4baf79ab13bf8c36c8bb24fd01b9d3923b /Modules | |
parent | a721830767c6a7819ed82cda5f910b732201f885 (diff) | |
download | CMake-33ec71f343f8b508b16437cc282607d77b996df1.zip CMake-33ec71f343f8b508b16437cc282607d77b996df1.tar.gz CMake-33ec71f343f8b508b16437cc282607d77b996df1.tar.bz2 |
FindMatlab: Fix -pthread check for projects with only C enabled
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindMatlab.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 8b41bb9..d016848 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -225,6 +225,7 @@ set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}") include(FindPackageHandleStandardArgs) include(CheckCXXCompilerFlag) +include(CheckCCompilerFlag) # The currently supported versions. Other version can be added by the user by @@ -871,7 +872,11 @@ function(matlab_add_mex) if(NOT WIN32) # we do not need all this on Windows # pthread options - check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD) + if(CMAKE_CXX_COMPILER_LOADED) + check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD) + elseif(CMAKE_C_COMPILER_LOADED) + check_c_compiler_flag(-pthread HAS_MINUS_PTHREAD) + endif() # we should use try_compile instead, the link flags are discarded from # this compiler_flag function. #check_cxx_compiler_flag(-Wl,--exclude-libs,ALL HAS_SYMBOL_HIDING_CAPABILITY) |