Commit dd4b51b9 authored by Brad King's avatar Brad King

Report runtime linker search path to VTK clients

Add a <module>_RUNTIME_LIBRARY_DIRS module information value.  Teach
vtk_module_config to report <ns>_RUNTIME_LIBRARY_DIRS by collecting and
de-duplicating the directories from the modules.

This restores the VTK_RUNTIME_LIBRARY_DIRS value provided by VTKConfig
prior to modularization.  It is useful for consuming applications to
find their runtime library files for packaging.

Change-Id: I488d5c1395203a2492a4f5cc9b3c1d97385a31c3
parent 23438f53
......@@ -16,6 +16,7 @@ macro(_vtk_module_config_recurse ns mod)
list(APPEND ${ns}_LIBRARIES ${${mod}_LIBRARIES})
list(APPEND ${ns}_INCLUDE_DIRS ${${mod}_INCLUDE_DIRS})
list(APPEND ${ns}_LIBRARY_DIRS ${${mod}_LIBRARY_DIRS})
list(APPEND ${ns}_RUNTIME_LIBRARY_DIRS ${${mod}_RUNTIME_LIBRARY_DIRS})
foreach(iface IN LISTS ${mod}_IMPLEMENTS)
list(APPEND _${ns}_AUTOINIT_${iface} ${mod})
list(APPEND _${ns}_AUTOINIT ${iface})
......@@ -38,6 +39,7 @@ endmacro()
# <module>_LIBRARIES = Libraries to link
# <module>_INCLUDE_DIRS = Header search path
# <module>_LIBRARY_DIRS = Library search path (for outside dependencies)
# <module>_RUNTIME_LIBRARY_DIRS = Runtime linker search path
macro(vtk_module_load mod)
if(NOT ${mod}_LOADED)
include("${VTK_MODULES_DIR}/${mod}.cmake" OPTIONAL RESULT_VARIABLE _found)
......@@ -97,6 +99,7 @@ endmacro()
# <namespace>_LIBRARIES = Libraries to link
# <namespace>_INCLUDE_DIRS = Header search path
# <namespace>_LIBRARY_DIRS = Library search path (for outside dependencies)
# <namespace>_RUNTIME_LIBRARY_DIRS = Runtime linker search path
#
# Calling this macro also recursively calls vtk_module_load for all modules
# explicitly named, and their dependencies, making them available in the local
......@@ -121,6 +124,7 @@ macro(vtk_module_config ns)
set(${ns}_LIBRARIES "")
set(${ns}_INCLUDE_DIRS "")
set(${ns}_LIBRARY_DIRS "")
set(${ns}_RUNTIME_LIBRARY_DIRS "")
set(_${ns}_AUTOINIT "")
set(_${ns}_USED_MODULES "")
......@@ -133,7 +137,7 @@ macro(vtk_module_config ns)
unset(_${ns}_USED_MODULES)
foreach(v ${ns}_LIBRARIES ${ns}_INCLUDE_DIRS ${ns}_LIBRARY_DIRS
_${ns}_AUTOINIT)
${ns}_RUNTIME_LIBRARY_DIRS _${ns}_AUTOINIT)
if(${v})
list(REMOVE_DUPLICATES ${v})
endif()
......
......@@ -3,5 +3,6 @@ set(@vtk-module@_DEPENDS "@vtk-module-DEPENDS@")
set(@vtk-module@_LIBRARIES "@vtk-module-LIBRARIES@")
set(@vtk-module@_INCLUDE_DIRS "@vtk-module-INCLUDE_DIRS@")
set(@vtk-module@_LIBRARY_DIRS "@vtk-module-LIBRARY_DIRS@")
set(@vtk-module@_RUNTIME_LIBRARY_DIRS "@vtk-module-RUNTIME_LIBRARY_DIRS@")
set(@vtk-module@_WRAP_HIERARCHY_FILE "@vtk-module-WRAP_HIERARCHY_FILE@")
@vtk-module-EXPORT_CODE@
......@@ -208,13 +208,22 @@ macro(vtk_module_export_info)
list(APPEND vtk-module-INCLUDE_DIRS-build "${${vtk-module}_SYSTEM_INCLUDE_DIRS}")
list(APPEND vtk-module-INCLUDE_DIRS-install "${${vtk-module}_SYSTEM_INCLUDE_DIRS}")
endif()
if(WIN32)
set(vtk-module-RUNTIME_LIBRARY_DIRS-build "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
set(vtk-module-RUNTIME_LIBRARY_DIRS-install "\${VTK_INSTALL_PREFIX}/${VTK_INSTALL_RUNTIME_DIR}")
else()
set(vtk-module-RUNTIME_LIBRARY_DIRS-build "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
set(vtk-module-RUNTIME_LIBRARY_DIRS-install "\${VTK_INSTALL_PREFIX}/${VTK_INSTALL_LIBRARY_DIR}")
endif()
set(vtk-module-LIBRARY_DIRS "${${vtk-module}_SYSTEM_LIBRARY_DIRS}")
set(vtk-module-RUNTIME_LIBRARY_DIRS "${vtk-module-RUNTIME_LIBRARY_DIRS-build}")
set(vtk-module-INCLUDE_DIRS "${vtk-module-INCLUDE_DIRS-build}")
set(vtk-module-EXPORT_CODE "${vtk-module-EXPORT_CODE-build}")
set(vtk-module-WRAP_HIERARCHY_FILE "${${vtk-module}_WRAP_HIERARCHY_FILE}")
configure_file(${_VTKModuleMacros_DIR}/vtkModuleInfo.cmake.in
${VTK_MODULES_DIR}/${vtk-module}.cmake @ONLY)
set(vtk-module-INCLUDE_DIRS "${vtk-module-INCLUDE_DIRS-install}")
set(vtk-module-RUNTIME_LIBRARY_DIRS "${vtk-module-RUNTIME_LIBRARY_DIRS-install}")
set(vtk-module-EXPORT_CODE "${vtk-module-EXPORT_CODE-install}")
set(vtk-module-WRAP_HIERARCHY_FILE
"\${CMAKE_CURRENT_LIST_DIR}/${vtk-module}Hierarchy.txt")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment