mborgerding/kissfft

`make install` attempts to install to system-root (`/kissfft`)

JayFoxRox opened this issue · 0 comments

I'm cross-compiling and getting the following:

$ make install
[...]
[100%] Linking C static library libkissfft-float.a
[100%] Built target kissfft
Install the project...
-- Install configuration: ""
-- Installing: /my-custom-toolchain-path/usr/local/lib/libkissfft-float.a
CMake Error at cmake_install.cmake:53 (file):
  file cannot create directory: /kissfft.  Maybe need administrative
  privileges.

This has to do with:

kissfft/CMakeLists.txt

Lines 104 to 110 in 8f47a67

#
# Add GNUInstallDirs for GNU infrastructure before target)include_directories
#
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" AND NOT CMAKE_CROSSCOMPILING)
include(GNUInstallDirs)
endif()

I'm compiling for a "Generic" system (which will probably change as the CMake support in our toolchain improves), and I'm cross-compiling. So GNUInstallDirs is not included.

This breaks the next few lines break, because CMAKE_INSTALL_INCLUDEDIR was never set:

kissfft/CMakeLists.txt

Lines 112 to 117 in 8f47a67

#
# Declare PKGINCLUDEDIR for kissfft include path
#
set(PKGINCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/kissfft")
message(STATUS "PKGINCLUDEDIR is ${PKGINCLUDEDIR}")

I think it's best to include GNUInstallDirs unconditionally. Although I'm not sure how deployment on Windows works.

It's worth noting that our toolchain is using a GNU toolchain layout with /usr/local/include (but it's also using clang in MSVC compatibility mode to compile for Windows - similar to cygwin/mingw, except it's neither of those).