[Insight-developers] Path problem with Wrapping/WrapITK/WrapITKConfig.cmake
kent williams
norman-k-williams at uiowa.edu
Wed May 20 18:01:48 EDT 2009
Bear with me on this because it isn't easy to explain.
The problem is caused by these lines:
--------------------------------------------------------------------------
# Some macros require LIBRARY_OUTPUT_PATH to be set. For now, set it to its
default.
# Re-set later if a different library output path is needed.
SET(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
# If WrapITK has been installed, we need to point the linker at the various
# language directories, where libSwigRuntime has been installed.
# Otherwise, we need to point the linker at the bin directory of the build
dir.
MACRO(LINK_IF_EXISTS dir)
IF(EXISTS "${dir}")
LINK_DIRECTORIES("${dir}")
ENDIF(EXISTS "${dir}")
ENDMACRO(LINK_IF_EXISTS)
LINK_DIRECTORIES("/scratch/kent/BT/BRAINS-COMPILE/Darwin/DEBUG-lib/Insight-b
uild/bin")
# libraries are all in the same dir
SET (LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib" CACHE INTERNAL "Single
output directory for building all libraries.")
----------------------------------------------------------------------------
And the problem is that LIBRARY_OUTPUT_PATH ends up being set to the
${PROJECT_BINARY_DIR}/lib every time WrapITKConfig.cmake is included.
My problem comes from trying to build a KWWidgets application, and use the
KWWidgetsSetupPaths.cmake. It is putting LIBRARY_OUTPUT_PATH into the
LD_LIBRARY_PATH even though the libraries won't always go to
LIBRARY_OUTPUT_PATH. In fact if you heed the warning of the CMake
documents, LIBRARY_OUTPUT_PATH 'should no longer be used as of CMake 2.6'
So I have the situation where the libraries from my project are written to
$CMAKE_LIBRARY_OUTPUT_DIRECTORY, but the generated Launcher program thinks
they should be in $LIBRARY_OUTPUT_PATH.
How should this be addressed? Well 2 things:
1. WrapITKConfig.cmake probably has no business setting LIBRARY_OUTPUT_PATH.
The comments _say_ it's needed in some macros, but I couldn't find those
macros anywhere, and THOSE hypothetical macros shouldn't be using
LIBRARY_OUTPUT_PATH, at least no if the CMake version is greater than 2.6
2. KWWidgetsPathMacros.cmake should not be using LIBRARY_OUTPUT_PATH. Or
alternatively, it should add CMAKE_LIBRARY_OUTPUT_DIRECTORY also when
building up KWWidgets_SHARED_LIBRARY_PATH_ENV.
More information about the Insight-developers
mailing list