Skip to content

Commit be914a8

Browse files
committed
[Backport PR-3722] COMP: Ensure client project can find externally build ITK module
This commit fixes a regression introduced in 5b09d54 (COMP: Allow install lib directory name changes). Client project not explicitly setting CMAKE_INSTALL_LIBDIR (or including the "GNUInstallDirs" CMake module) would fail to find externally build ITK module. This commit addresses this by setting CMAKE_INSTALL_LIBDIR default value to "lib". This approach is consistent with how the CMAKE_INSTALL_LIBDIR default value is set in the top-level CMakeLists.txt. Before this change, there was discrepancy between the value of "/path/to/<module>.cmake" used when configuring the file and the one used when looking up the file following a call to "find_package(ITK COMPONENTS <module>)". For example: Location of the configured file: /path/to/ITK-build//cmake/ITK-5.3/Modules/Ultrasound.cmake vs Location expected by "itk_module_load()" /path/to/ITK-build/lib/cmake/ITK-5.3/Modules/Ultrasound.cmake
1 parent 69e52f0 commit be914a8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMake/ITKModuleExternal.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ if(NOT ITK_BINARY_DIR)
5050
set(ITK_BINARY_DIR ${ITK_DIR})
5151
endif()
5252

53+
# Set default value for project that are not using the
54+
# "GNUInstallDirs" CMake module.
55+
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
56+
set(CMAKE_INSTALL_LIBDIR "lib")
57+
endif()
58+
5359
# The default path when not wrapping. Restore standard build location
5460
# if python wrapping is turned on, and then turned off.
5561
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)

0 commit comments

Comments
 (0)