diff --git a/CMakeLists.txt b/CMakeLists.txt index de51d6266..fef6eddac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ include(MacroEnsureOutOfSourceBuild) include(dsym) include(xcproj) include(architecture) +include(create_symlink) MACRO_ENSURE_OUT_OF_SOURCE_BUILD() diff --git a/cmake/create_symlink.cmake b/cmake/create_symlink.cmake new file mode 100644 index 000000000..f533a750f --- /dev/null +++ b/cmake/create_symlink.cmake @@ -0,0 +1,12 @@ +# +# used to create a symbolic link at configuration time +# +function(create_symlink target output_path) + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0") + # use CREATE_LINK if we can + file(CREATE_LINK "${target}" "${output_path}" SYMBOLIC) + else() + # fallback to `ln` otherwise + execute_process(COMMAND ln -sfn "${target}" "${output_path}") + endif() +endfunction()