Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cmake soft errors due to failing creation of links on windows #2645

Merged
merged 1 commit into from May 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Expand Up @@ -81,6 +81,7 @@ include(HPX_Libraries)
include(HPX_LibraryDir)
include(HPX_AddConfigTest)
include(HPX_AddDefinitions)
include(HPX_CreateSymbolicLink)

hpx_force_out_of_tree_build("This project requires an out-of-source-tree build. See README.rst. Clean your CMake cache and CMakeFiles if this message persists.")

Expand Down Expand Up @@ -1871,9 +1872,8 @@ endif()
include(HPX_GeneratePackage)

# Create a symlink in share pointing to the latest HPX installation
execute_process(COMMAND
"${CMAKE_COMMAND}" -E create_symlink "hpx-${HPX_VERSION}" "hpx"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/share")
create_symbolic_link("${CMAKE_BINARY_DIR}/share/hpx-${HPX_VERSION}"
"${CMAKE_BINARY_DIR}/share/hpx")

message("")
message("HPX will be installed to ${CMAKE_INSTALL_PREFIX}")
Expand Down
21 changes: 21 additions & 0 deletions cmake/HPX_CreateSymbolicLink.cmake
@@ -0,0 +1,21 @@
# Copyright (c) 2017 Denis Blank
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

# Creates a symbolic link from the destination to the target,
# if the link doesn't exist yet.
# Since `create_symlink` is only available for unix derivates,
# we work around that in this macro.
macro(create_symbolic_link SYM_TARGET SYM_DESTINATION)
if(WIN32)
if(NOT EXISTS ${SYM_DESTINATION})
# Create a junction for windows links
execute_process(COMMAND cmd /C "${CMAKE_SOURCE_DIR}/cmake/scripts/create_symbolic_link.bat"
${SYM_DESTINATION} ${SYM_TARGET})
endif()
else()
# Only available on unix derivates
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink ${SYM_TARGET} ${SYM_DESTINATION})
endif()
endmacro(create_symbolic_link)
6 changes: 6 additions & 0 deletions cmake/scripts/create_symbolic_link.bat
@@ -0,0 +1,6 @@
:: Copyright (c) 2017 Denis Blank
::
:: Distributed under the Boost Software License, Version 1.0. (See accompanying
:: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

mklink /J "%1" "%2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file misses copyright and license

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/fixed

26 changes: 14 additions & 12 deletions docs/CMakeLists.txt
Expand Up @@ -381,20 +381,22 @@ endif()

# Create links to properly view the docs in the build directory
set(DOCS_OUTPUT_DIR "${CMAKE_BINARY_DIR}/share/hpx-${HPX_VERSION}/docs/html")

execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${DOCS_OUTPUT_DIR}" )
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${DOCS_OUTPUT_DIR}/code" )
execute_process(
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PROJECT_SOURCE_DIR}/docs/html/src" "${DOCS_OUTPUT_DIR}/src")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PROJECT_SOURCE_DIR}/docs/html/images" "${DOCS_OUTPUT_DIR}/images")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PROJECT_SOURCE_DIR}/hpx" "${DOCS_OUTPUT_DIR}/code/hpx")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PROJECT_SOURCE_DIR}/src" "${DOCS_OUTPUT_DIR}/code/src")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PROJECT_SOURCE_DIR}/examples" "${DOCS_OUTPUT_DIR}/code/examples")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PROJECT_SOURCE_DIR}/tests" "${DOCS_OUTPUT_DIR}/code/tests")

create_symbolic_link("${PROJECT_SOURCE_DIR}/docs/html/src"
"${DOCS_OUTPUT_DIR}/src")
create_symbolic_link("${PROJECT_SOURCE_DIR}/docs/html/images"
"${DOCS_OUTPUT_DIR}/images")
create_symbolic_link("${PROJECT_SOURCE_DIR}/hpx"
"${DOCS_OUTPUT_DIR}/code/hpx")
create_symbolic_link("${PROJECT_SOURCE_DIR}/src"
"${DOCS_OUTPUT_DIR}/code/src")
create_symbolic_link("${PROJECT_SOURCE_DIR}/examples"
"${DOCS_OUTPUT_DIR}/code/examples")
create_symbolic_link("${PROJECT_SOURCE_DIR}/tests"
"${DOCS_OUTPUT_DIR}/code/tests")

source_group(Documentation FILES ${base_files})
source_group("Documentation\\Manual" FILES ${manual_files})
Expand Down