Skip to content

Commit

Permalink
[macOS] Ask CMake to look in the right place for include & link direc…
Browse files Browse the repository at this point in the history
…tories (#12516)

* Ask CMake to look in the right place for include_directories and link_directories on macOS (arm64 and x86_64)

Homebrew installs to a different location on Arm Macs compared to Intel Macs. 

This change prevents this error when compiling on Arm:   
`ld: warning: directory not found for option '-L/opt/local/lib'`

Use STREQUAL instead of MATCHES, since MATCHES is supposed to be used with regular expressions. 

Also update the homebrew directories for Intel, since they were wrong.

Remove the conditional check for x86 Apple, as usr/local is part of the default search path.
Tested on Intel and the warning does not appear.
  • Loading branch information
shinra-electric authored Sep 26, 2022
1 parent c996be3 commit db9389d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ if(WIN32)
add_definitions(-D_WIN32_WINNT=0x0602)
endif()

if(APPLE)
include_directories(/opt/local/include)
link_directories(/opt/local/lib)
if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
include_directories(/opt/homebrew/include)
link_directories(/opt/homebrew/lib)
endif()

# Warnings are silenced for 3rdparty code
Expand Down

0 comments on commit db9389d

Please sign in to comment.