From a9aba57e7c210f3565fd20e354789954ea41f8a0 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Tue, 6 Jun 2017 16:11:52 +0000 Subject: [PATCH] build: add compatibility symlink for block headers On FreeBSD and OSX, the block runtime functions are defined on a Block.h and a Block_private.h headers on the include path as opposed to libobjc2's objc/blocks_runtime.h and objc/blocks_private.h respectively. This commit amends libobjc2's install routine to create the FreeBSD-style headers as symlinks to the ones provided by libobjc2 for improved compatibility. --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16b42a7..0438909 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,13 @@ cmake_minimum_required(VERSION 2.8) - project(libobjc) enable_language(ASM) +macro(install_symlink filepath sympath) + install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${filepath} ${sympath})") + install(CODE "message(\"-- Symlinking: ${sympath} -> ${filepath}\")") +endmacro(install_symlink) + set(CMAKE_C_FLAGS_DEBUG "-g -O0 -fno-inline ${CMAKE_C_FLAGS_DEBUG}") set(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}") @@ -309,7 +313,8 @@ install(TARGETS ${INSTALL_TARGETS} install(FILES ${libobjc_HDRS} DESTINATION "${HEADER_INSTALL_PATH}/${INCLUDE_DIRECTORY}") - +install_symlink(${HEADER_INSTALL_PATH}/${INCLUDE_DIRECTORY}/blocks_runtime.h ${HEADER_INSTALL_PATH}/Block.h) +install_symlink(${HEADER_INSTALL_PATH}/${INCLUDE_DIRECTORY}/blocks_private.h ${HEADER_INSTALL_PATH}/Block_private.h) set(CPACK_GENERATOR TGZ CACHE STRING "Installer types to generate. Sensible options include TGZ, RPM and DEB")