Skip to content

Commit

Permalink
Fix symlink installs for windows
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jul 11, 2022
1 parent 0ab091e commit a49c239
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,22 @@ set(tick_tocked_cmake_files
# Install symlinks for IgnPython and IgnBenchmark
foreach(cmake_file ${tick_tocked_cmake_files})
string(REGEX REPLACE "^Gz" "Ign" ign_cmake_file ${cmake_file})
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/cmake")

if (WIN32) # Windows requires copy instead of symlink
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy \
${gz_modules_install_dir}\/${cmake_file} \
${gz_modules_install_dir}\/${ign_cmake_file})")
${CMAKE_INSTALL_PREFIX}\/${gz_modules_install_dir}\/${cmake_file} \
${PROJECT_BINARY_DIR}\/cmake/${ign_cmake_file})")
else()
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/cmake")
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_INSTALL_PREFIX}\/${gz_modules_install_dir}\/${cmake_file} \
${PROJECT_BINARY_DIR}\/cmake/${ign_cmake_file})")
install(
FILES ${PROJECT_BINARY_DIR}/cmake/${ign_cmake_file}
DESTINATION ${gz_modules_install_dir}
COMPONENT modules)
endif()

install(
FILES ${PROJECT_BINARY_DIR}/cmake/${ign_cmake_file}
DESTINATION ${gz_modules_install_dir}
COMPONENT modules)
endforeach()

include(CTest)
Expand Down

0 comments on commit a49c239

Please sign in to comment.