1 # - Convenience include for using pin library
2 # Finds if pin is installed
3 # and set the appropriate libs, incdirs, flags etc.
4 # INCLUDE_DIRECTORIES, LINK_DIRECTORIES and ADD_DEFINITIONS
7 # If you need to link extra libraries use PINTOOL_LINK_LIBS
8 # variable to set them.
10 # Author: Manuel Niekamp
11 # Email: niekma@upb.de
16 macro(ADD_PINTOOL pin_tool_name)
19 include_directories(${PIN_INCLUDE_DIRS})
20 endif(PIN_INCLUDE_DIRS)
23 link_directories(${PIN_LIBRARY_DIRS})
24 endif(PIN_LIBRARY_DIRS)
26 add_library(${pin_tool_name} SHARED ${ARGN})
28 set_target_properties(${pin_tool_name} PROPERTIES
31 COMPILE_DEFINITIONS "${PIN_DEFINITIONS}"
32 LINK_FLAGS "${PIN_LINKER_FLAGS}"
35 foreach(_entry ${ARGN})
36 get_source_file_property(_prop ${_entry} LANGUAGE)
37 if("${_prop}" STREQUAL "C")
38 list(APPEND ${pin_tool_name}_C_FILES ${_entry})
39 elseif("${_prop}" STREQUAL "CXX")
40 list(APPEND ${pin_tool_name}_CXX_FILES ${_entry})
41 endif("${_prop}" STREQUAL "C")
44 set_source_files_properties(${${pin_tool_name}_C_FILES} PROPERTIES
45 COMPILE_FLAGS ${PIN_C_FLAGS}
48 set_source_files_properties(${${pin_tool_name}_CXX_FILES} PROPERTIES
49 COMPILE_FLAGS ${PIN_CXX_FLAGS}
52 target_link_libraries(${pin_tool_name} ${PINTOOL_LINK_LIBS} pin xed dwarf elf dl)
54 endmacro(ADD_PINTOOL pin_tool_name)
58 message(FATAL_ERROR "Pin was not found!")