include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../common ${CMAKE_CURRENT_SOURCE_DIR}/../libelf ) set(libsrcs elftc_bfdtarget.c elftc_copyfile.c elftc_demangle.c elftc_set_timestamps.c elftc_string_table.c elftc_version.c libelftc_bfdtarget.c libelftc_dem_arm.c libelftc_dem_gnu2.c libelftc_dem_gnu3.c libelftc_hash.c libelftc_vstr.c ) set(man3 elftc.3 elftc_bfd_find_target.3 elftc_copyfile.3 elftc_demangle.3 elftc_set_timestamps.3 elftc_string_table_create.3 elftc_version.3 ) add_library(elftcobj OBJECT ${libsrcs}) set_property(TARGET elftcobj PROPERTY POSITION_INDEPENDENT_CODE 1) add_library(elftc SHARED $) add_library(elftc_pic STATIC $) add_library(elftc_static ${libsrcs}) set_target_properties(elftc PROPERTIES VERSION 1.0) set_target_properties(elftc PROPERTIES SOVERSION 1) set_target_properties(elftc PROPERTIES PUBLIC_HEADER libelftc.h) target_link_libraries(elftc elf) macro(install_symlink filepath sympath) install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${filepath} ${sympath})") install(CODE "message(\"-- Created symlink: ${sympath} -> ${filepath}\")") endmacro(install_symlink) install(TARGETS elftc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(TARGETS elftc_pic LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libelftc_static.a RENAME libelftc.a DESTINATION lib) # install(FILES gelf.h ../common/elfdefinitions.h DESTINATION include) install(FILES ${man3} DESTINATION share/man/man3) # man page links set(m3dir ${RAVDEST}${CMAKE_INSTALL_MANDIR}/man3) install_symlink(elftc_bfd_find_target.3 ${m3dir}/elftc_bfd_target_byteorder.3) install_symlink(elftc_bfd_find_target.3 ${m3dir}/elftc_bfd_target_class.3) install_symlink(elftc_bfd_find_target.3 ${m3dir}/elftc_bfd_target_flavor.3) install_symlink(elftc_string_table_create.3 ${m3dir}/elftc_string_table_from_section.3) install_symlink(elftc_string_table_create.3 ${m3dir}/elftc_string_table_destroy.3) install_symlink(elftc_string_table_create.3 ${m3dir}/elftc_string_table_image.3) install_symlink(elftc_string_table_create.3 ${m3dir}/elftc_string_table_insert.3) install_symlink(elftc_string_table_create.3 ${m3dir}/elftc_string_table_lookup.3)