Skip to content
Permalink
Browse files

cmake: Fix building for macOS with Xcode generator (thanks, dungaipar…

…a!).

Fixes Bugzilla #3625.
  • Loading branch information
icculus committed Aug 18, 2017
1 parent e3e6b4f commit f75caa2ff61799174bc1d87bf69836bda9cb3444
Showing with 9 additions and 5 deletions.
  1. +9 −5 CMakeLists.txt
@@ -433,11 +433,15 @@ if(USE_GCC OR USE_CLANG)
list(APPEND EXTRA_CFLAGS "-Wshadow")
endif()

set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined")
check_c_compiler_flag("" HAVE_NO_UNDEFINED)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
if(HAVE_NO_UNDEFINED)
list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined")
if(APPLE)
list(APPEND EXTRA_LDFLAGS "-Wl,-undefined,error")
else()
set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined")
check_c_compiler_flag("" HAVE_NO_UNDEFINED)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
if(HAVE_NO_UNDEFINED)
list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined")
endif()
endif()
endif()

0 comments on commit f75caa2

Please sign in to comment.