mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 06:07:48 +00:00
[cmake] update CMake configurations for Apple platforms (#12729)
This commit updates various CMake configuration files to simplify the check for Apple platforms. It replaces the `CMAKE_CXX_COMPILER_ID` check for `AppleClang` with the built-in `APPLE` variable across multiple targets (such as `ftd`, `mtd`, `cli`, and others). This ensures that Apple-specific linker and compiler flags (like `-Wl,-map` and `-Wimplicit-int-conversion`) are correctly applied when building on macOS, regardless of the specific compiler used. Additionally, this commit updates `CMakeLists.txt` to explicitly set the `CMAKE_AR` and `CMAKE_RANLIB` paths to the default system locations (`/usr/bin/ar` and `/usr/bin/ranlib`) when the `APPLE` variable is set.
This commit is contained in:
@@ -56,7 +56,7 @@ target_link_libraries(ot-cli-ftd PRIVATE
|
||||
)
|
||||
|
||||
if(OT_LINKER_MAP)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
|
||||
if(APPLE)
|
||||
target_link_libraries(ot-cli-ftd PRIVATE -Wl,-map,ot-cli-ftd.map)
|
||||
else()
|
||||
target_link_libraries(ot-cli-ftd PRIVATE -Wl,-Map=ot-cli-ftd.map)
|
||||
|
||||
@@ -56,7 +56,7 @@ target_link_libraries(ot-cli-mtd PRIVATE
|
||||
)
|
||||
|
||||
if(OT_LINKER_MAP)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
|
||||
if(APPLE)
|
||||
target_link_libraries(ot-cli-mtd PRIVATE -Wl,-map,ot-cli-mtd.map)
|
||||
else()
|
||||
target_link_libraries(ot-cli-mtd PRIVATE -Wl,-Map=ot-cli-mtd.map)
|
||||
|
||||
@@ -60,7 +60,7 @@ target_link_libraries(ot-cli-radio PRIVATE
|
||||
)
|
||||
|
||||
if(OT_LINKER_MAP)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
|
||||
if(APPLE)
|
||||
target_link_libraries(ot-cli-radio PRIVATE -Wl,-map,ot-cli-radio.map)
|
||||
else()
|
||||
target_link_libraries(ot-cli-radio PRIVATE -Wl,-Map=ot-cli-radio.map)
|
||||
|
||||
Reference in New Issue
Block a user