Fix CMake build error on Cygwin and minGW platforms
Signed-off-by: Qixiang Xu <qixiang.xu@arm.com>
This commit is contained in:
parent
d5d01a0435
commit
7346b312e1
1 changed files with 8 additions and 2 deletions
|
@ -88,8 +88,14 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
|
||||||
# to the corresponding path in the source directory.
|
# to the corresponding path in the source directory.
|
||||||
function(link_to_source base_name)
|
function(link_to_source base_name)
|
||||||
# Get OS dependent path to use in `execute_process`
|
# Get OS dependent path to use in `execute_process`
|
||||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${base_name}" link)
|
if (CMAKE_HOST_WIN32)
|
||||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${base_name}" target)
|
#mklink is an internal command of cmd.exe it can only work with \
|
||||||
|
string(REPLACE "/" "\\" link "${CMAKE_CURRENT_BINARY_DIR}/${base_name}")
|
||||||
|
string(REPLACE "/" "\\" target "${CMAKE_CURRENT_SOURCE_DIR}/${base_name}")
|
||||||
|
else()
|
||||||
|
set(link "${CMAKE_CURRENT_BINARY_DIR}/${base_name}")
|
||||||
|
set(target "${CMAKE_CURRENT_SOURCE_DIR}/${base_name}")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT EXISTS ${link})
|
if (NOT EXISTS ${link})
|
||||||
if (CMAKE_HOST_UNIX)
|
if (CMAKE_HOST_UNIX)
|
||||||
|
|
Loading…
Reference in a new issue