superlu icon indicating copy to clipboard operation
superlu copied to clipboard

SuperLU's CMake install is misconfigured

Open alexchandel opened this issue 1 year ago • 2 comments

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.

alexchandel avatar Feb 27 '23 17:02 alexchandel

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.

gruenich avatar Apr 06 '23 23:04 gruenich

@alexchandel, can you please check current master if the issue persist or confirm that my commits fixed them?

gruenich avatar Aug 05 '23 20:08 gruenich

No response for a year, probably fixed by #81. @xiaoyeli, do you mind closing this?

gruenich avatar Aug 06 '24 10:08 gruenich