fix #108: macOS Big Sur: dtrace does not understand -G switch
[awesomized/libmemcached] / CMake / EnableDtrace.cmake
index 184a327a7fc68f807886dcb387b09628e3ea610d..ea7499d7e52b3171e0b811a3cf5f8f16c4fbe33d 100644 (file)
@@ -30,11 +30,14 @@ function(enable_dtrace_for TARGET PROBES_D PROBES_H)
             set_source_files_properties(${TARGET}_probes.o PROPERTIES
                     GENERATED true
                     EXTERNAL_OBJECT true)
-        else() # not Linux
+            return()
+        endif()
+        cmake_host_system_information(RESULT OS_RELEASE QUERY OS_RELEASE)
+        if(NOT (CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin AND OS_RELEASE VERSION_GREATER_EQUAL 11))
             set(PROBES_C ${TARGET}_probes.cc)
             file(GENERATE
                     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROBES_C}
-                    CONTENT "#include \"${PROBES_H}\""
+                    CONTENT "#include \"${PROBES_H}\"\n"
                     )
             add_custom_command(
                     TARGET ${TARGET}