From 4b6d2aabcb00b879f4509d63fe32593b820a6feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 17 Aug 2022 23:24:20 +0100 Subject: [PATCH] CMakeLists.txt: fix install on macOS if GNU coreutils are used (#203) * CMakeLists.txt: fix install on macOS if GNU coreutils are used bsd ln supports both `-h` and `-n`, while GNU only supports `-n`. In Nix we use GNU coreutils and hence the installation breaks. Also see https://github.com/NixOS/nixpkgs/pull/182909 With this patch installation will work with both variants of `ln` * CMakeLists.txt: use CMAKE_INSTALL_FULL_INCLUDEDIR for header files This allows to install header files in prefixes different from the rest. We need this for nix as well. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6ea8b5e..d87fa17a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,8 @@ add_library(OpenCL::Headers ALIAS Headers) if(CMAKE_SYSTEM_NAME MATCHES Darwin) execute_process( - COMMAND ln -shf ${CMAKE_CURRENT_SOURCE_DIR}/CL ${CMAKE_CURRENT_BINARY_DIR}/CL - COMMAND ln -shf ${CMAKE_CURRENT_SOURCE_DIR}/CL ${CMAKE_CURRENT_BINARY_DIR}/OpenCL + COMMAND ln -snf ${CMAKE_CURRENT_SOURCE_DIR}/CL ${CMAKE_CURRENT_BINARY_DIR}/CL + COMMAND ln -snf ${CMAKE_CURRENT_SOURCE_DIR}/CL ${CMAKE_CURRENT_BINARY_DIR}/OpenCL ) target_include_directories(Headers INTERFACE @@ -31,9 +31,9 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin) $ ) install(CODE " - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/CL) + file(MAKE_DIRECTORY ${CMAKE_INSTALL_FULL_INCLUDEDIR}/CL) execute_process( - COMMAND ln -shf CL ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/OpenCL + COMMAND ln -snf CL ${CMAKE_INSTALL_FULL_INCLUDEDIR}/OpenCL )" ) else()