Skip to content

Commit

Permalink
Symlink IgnPython and IgnBenchmark for downstream libs (#274)
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jul 9, 2022
1 parent 797a9f6 commit 049cbc5
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 049cbc5

Please sign in to comment.