Backport from trunk:
Bug #18593044 COMPILE FLAGS NOT PASSED TO DTRACE, BREAKS CROSS BUILD
This commit is contained in:
parent
a195cedcec
commit
16b81798aa
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -74,13 +74,6 @@ IF(ENABLE_DTRACE)
|
|||||||
${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
|
${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
|
||||||
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
|
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
|
||||||
)
|
)
|
||||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
||||||
# Systemtap object
|
|
||||||
EXECUTE_PROCESS(
|
|
||||||
COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
|
|
||||||
-o ${CMAKE_BINARY_DIR}/probes_mysql.o
|
|
||||||
)
|
|
||||||
ENDIF()
|
|
||||||
ADD_CUSTOM_TARGET(gen_dtrace_header
|
ADD_CUSTOM_TARGET(gen_dtrace_header
|
||||||
DEPENDS
|
DEPENDS
|
||||||
${CMAKE_BINARY_DIR}/include/probes_mysql.d
|
${CMAKE_BINARY_DIR}/include/probes_mysql.d
|
||||||
@ -99,12 +92,7 @@ FUNCTION(DTRACE_INSTRUMENT target)
|
|||||||
IF(ENABLE_DTRACE)
|
IF(ENABLE_DTRACE)
|
||||||
ADD_DEPENDENCIES(${target} gen_dtrace_header)
|
ADD_DEPENDENCIES(${target} gen_dtrace_header)
|
||||||
|
|
||||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
# Invoke dtrace to generate object file and link it together with target.
|
||||||
TARGET_LINK_LIBRARIES(${target} ${CMAKE_BINARY_DIR}/probes_mysql.o)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# On Solaris, invoke dtrace -G to generate object file and
|
|
||||||
# link it together with target.
|
|
||||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||||
SET(objdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir)
|
SET(objdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir)
|
||||||
SET(outfile ${objdir}/${target}_dtrace.o)
|
SET(outfile ${objdir}/${target}_dtrace.o)
|
||||||
@ -121,6 +109,21 @@ FUNCTION(DTRACE_INSTRUMENT target)
|
|||||||
-P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake
|
-P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake
|
||||||
WORKING_DIRECTORY ${objdir}
|
WORKING_DIRECTORY ${objdir}
|
||||||
)
|
)
|
||||||
|
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
# dtrace on Linux runs gcc and uses flags from environment
|
||||||
|
SET(CFLAGS_SAVED $ENV{CFLAGS})
|
||||||
|
SET(ENV{CFLAGS} ${CMAKE_C_FLAGS})
|
||||||
|
SET(outfile "${CMAKE_BINARY_DIR}/probes_mysql.o")
|
||||||
|
# Systemtap object
|
||||||
|
EXECUTE_PROCESS(
|
||||||
|
COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
|
||||||
|
-o ${outfile}
|
||||||
|
)
|
||||||
|
SET(ENV{CFLAGS} ${CFLAGS_SAVED})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Do not try to extend the library if we have not built the .o file
|
||||||
|
IF(outfile)
|
||||||
# Add full object path to linker flags
|
# Add full object path to linker flags
|
||||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||||
IF(NOT target_type MATCHES "STATIC")
|
IF(NOT target_type MATCHES "STATIC")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user