diff options
author | Simon Butcher <simon.butcher@arm.com> | 2018-06-01 19:20:25 +0100 |
---|---|---|
committer | Simon Butcher <simon.butcher@arm.com> | 2018-06-01 19:20:25 +0100 |
commit | b02f7893f63c5736c8e6a34a537ccf628847a5e2 (patch) | |
tree | 93844975a6b68ba25ddb86fee073eb7f2164db78 /CMakeLists.txt | |
parent | ba9199458df7fd811f9e9203c3b2d012902ceb40 (diff) | |
parent | c33c7c8363e998a0d7b54f1f310372757c67ada4 (diff) | |
download | mbedtls-b02f7893f63c5736c8e6a34a537ccf628847a5e2.zip mbedtls-b02f7893f63c5736c8e6a34a537ccf628847a5e2.tar.gz mbedtls-b02f7893f63c5736c8e6a34a537ccf628847a5e2.tar.bz2 |
Merge remote-tracking branch 'public/pr/1470' into development
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2018d35..587cfe2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,30 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build: None Debug Release Coverage ASan ASanDbg MemSan MemSanDbg Check CheckFull" FORCE) +# Create a symbolic link from ${base_name} in the binary directory +# to the corresponding path in the source directory. +function(link_to_source base_name) + # Get OS dependent path to use in `execute_process` + file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${base_name}" link) + file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${base_name}" target) + + if (NOT EXISTS ${link}) + if (CMAKE_HOST_UNIX) + set(command ln -s ${target} ${link}) + else() + set(command cmd.exe /c mklink /j ${link} ${target}) + endif() + + 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}") + endif() + endif() +endfunction(link_to_source) + string(REGEX MATCH "Clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}") if(CMAKE_COMPILER_IS_GNUCC) @@ -164,3 +188,12 @@ if(ENABLE_TESTING) ) endif(UNIX) endif() + +# Make scripts needed for testing available in an out-of-source build. +if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) + link_to_source(scripts) + # Copy (don't link) DartConfiguration.tcl, needed for memcheck, to + # keep things simple with the sed commands in the memcheck target. + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DartConfiguration.tcl + ${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl COPYONLY) +endif() |