From 5693e31af45e6adbe4c99dbf5a57d76f02945a5b Mon Sep 17 00:00:00 2001 From: methylDragon Date: Sat, 9 Jul 2022 01:44:27 -0700 Subject: [PATCH] Symlink IgnPython and IgnBenchmark for downstream libs (#274) Signed-off-by: methylDragon --- CMakeLists.txt | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbe2b3dd..6691809c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,25 +141,52 @@ install( #============================================================================ # Install the files for this package #============================================================================ -set(ign_modules_install_dir "${gz_config_install_dir}/cmake${PROJECT_VERSION_MAJOR}") +set(gz_modules_install_dir "${gz_config_install_dir}/cmake${PROJECT_VERSION_MAJOR}") file(GLOB modules "cmake/*.cmake") file(GLOB templates "cmake/*.in") install( FILES ${modules} ${templates} - DESTINATION ${ign_modules_install_dir} + DESTINATION ${gz_modules_install_dir} COMPONENT modules) file(GLOB pkgconfig_templates "cmake/pkgconfig/*.in") install( FILES ${pkgconfig_templates} - DESTINATION ${ign_modules_install_dir}/pkgconfig + DESTINATION ${gz_modules_install_dir}/pkgconfig COMPONENT modules) message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") +# TODO(CH3): Deprecated. Remove on tock. +# Install symlinks for IgnPython and IgnBenchmark +set(tick_tocked_cmake_files + "GzPython.cmake" + "GzBenchmark.cmake") + +# TODO(CH3): Deprecated. Remove on tock. +# Install symlinks for IgnPython and IgnBenchmark +foreach(cmake_file ${tick_tocked_cmake_files}) + string(REGEX REPLACE "^Gz" "Ign" ign_cmake_file ${cmake_file}) + + 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})") + 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() +endforeach() + include(CTest) if (BUILD_TESTING) add_subdirectory(test)