From 3d52ab76f68a64ef8c856b034dc8c6fda86526e0 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Fri, 7 Mar 2014 10:33:55 +0100 Subject: [PATCH] Fixed CMake symlinking on out-of-source builds --- ChangeLog | 1 + tests/CMakeLists.txt | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a27f2cc9..df0ef7711 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ Bugfix * Fix bug in RSA PKCS#1 v1.5 "reversed" operations * Fixed testing with out-of-source builds using cmake * Fixed version-major intolerance in server + * Fixed CMake symlinking on out-of-source builds = PolarSSL 1.3.4 released on 2014-01-27 Features diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 74ec5d511..d5b0512dd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -93,18 +93,20 @@ if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/data_files" link) file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data_files" target) - if (UNIX) - set(command ln -s ${target} ${link}) - else() - set(command cmd.exe /c mklink ${link} ${target}) - endif() + if (NOT EXISTS ${link}) + if (UNIX) + set(command ln -s ${target} ${link}) + else() + set(command cmd.exe /c mklink ${link} ${target}) + endif() - execute_process(COMMAND ${command} - RESULT_VARIABLE result - ERROR_VARIABLE output) + execute_process(COMMAND ${command} + RESULT_VARIABLE result + ERROR_VARIABLE output) - if (NOT ${result} EQUAL 0) - message(FATAL_ERROR "Could not create symbolic link for: ${target} --> ${output}") + if (NOT ${result} EQUAL 0) + message(FATAL_ERROR "Could not create symbolic link for: ${target} --> ${output}") + endif() endif() endif()