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

CMake: Lib Symlink w/ Complex Paths #3602

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -401,23 +401,21 @@ install(TARGETS ${WarpX_INSTALL_TARGET_NAMES}
# this is currently expected by Python bindings
if(WarpX_LIB)
if(WarpX_DIMS STREQUAL RZ)
set(lib_suffix "rz")
set(lib_dim "rz")
else()
set(lib_suffix "${WarpX_DIMS}d")
endif()
if(WIN32)
set(mod_ext "dll")
else()
set(mod_ext "so")
set(lib_dim "${WarpX_DIMS}d")
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
set(ABS_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
else()
set(ABS_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
endif()
# escape spaces for generated cmake_install.cmake file
file(TO_CMAKE_PATH "${ABS_INSTALL_LIB_DIR}" ABS_INSTALL_LIB_DIR)

install(CODE "file(CREATE_LINK
$<TARGET_FILE_NAME:shared>
${ABS_INSTALL_LIB_DIR}/libwarpx.${lib_suffix}.${mod_ext}
\"${ABS_INSTALL_LIB_DIR}/libwarpx.${lib_dim}$<TARGET_FILE_SUFFIX:shared>\"
COPY_ON_ERROR SYMBOLIC)")
endif()

Expand Down