diff --git a/examples/C/CMakeLists.txt b/examples/C/CMakeLists.txt index 1e18c0c6c56422533becd03c55a45a9da284dab7..f77188f63ecdb26685dd409918a4055b75ff193a 100644 --- a/examples/C/CMakeLists.txt +++ b/examples/C/CMakeLists.txt @@ -18,18 +18,25 @@ target_include_directories( ${CMAKE_CURRENT_BINARY_DIR}/../../kleidicv/include ) -# Trying to link without the C++ runtime. Should work in case of gcc and clang. -list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_LIBRARIES stdc++ c++) -set_target_properties( - kleidicv-c-example - PROPERTIES - LINKER_LANGUAGE "C" -) +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # Trying to link without the C++ runtime. Should work in case of gcc and clang. + list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_LIBRARIES stdc++ c++) + set_target_properties( + kleidicv-c-example + PROPERTIES + LINKER_LANGUAGE "C" + ) -# Linking the whole KleidiCV library to check whether any cpp runtime feature is used. -target_link_libraries( - kleidicv-c-example - -Wl,--whole-archive - kleidicv - -Wl,--no-whole-archive -) + # Linking the whole KleidiCV library to check whether any cpp runtime feature is used. + target_link_libraries( + kleidicv-c-example + -Wl,--whole-archive + kleidicv + -Wl,--no-whole-archive + ) +else() + target_link_libraries( + kleidicv-c-example + kleidicv + ) +endif()