superlu
superlu copied to clipboard
SuperLU's CMake install is misconfigured
SuperLU repeatedly uses CMAKE_INSTALL_PREFIX
to assert its installation location during configuration, and even sets it.
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
if (NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX /usr/local)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/superlu.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
This is one of the most grievous CMake sins you can commit.
You must not assume CMAKE_INSTALL_PREFIX
is valid at configuration, nor set it. You must pass relative paths to install()
, because the user must be able to substitute an installation root at installation time. Instead of passing your desired absolute path to install()
, you should invoke installation as cmake --install . --prefix /usr/local
.
I think
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
and
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/superlu.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
are both ok, and can remain.
The other two issues mentioned, should be fixed. I give it a try, see https://github.com/xiaoyeli/superlu/pull/81.
@alexchandel, can you please check current master if the issue persist or confirm that my commits fixed them?
No response for a year, probably fixed by #81. @xiaoyeli, do you mind closing this?