Martchus / cpp-utilities

Common C++ classes and routines used by my applications such as argument parser, IO and conversion utilities
GNU General Public License v2.0
52 stars 18 forks source link

Unable to find strip #11

Closed ghost closed 5 years ago

ghost commented 5 years ago
$ cmake -D_CMAKE_TOOLCHAIN_PREFIX=x86_64-w64-mingw32- \
> -DCMAKE_FIND_ROOT_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw
[...]
CMake Error at cmake/modules/LibraryTarget.cmake:477 (message):
  Unable to find strip.  Please set STRIP_BINARY_PATH-NOTFOUND.
Call Stack (most recent call first):
  CMakeLists.txt:186 (include)

I see you have all this code here for finding strip:

https://github.com/Martchus/cpp-utilities/blob/master/cmake/modules/LibraryTarget.cmake

but why? It seems the standard way is to set _CMAKE_TOOLCHAIN_PREFIX as I have done, and as is used by Cmake even:

https://github.com/Kitware/CMake/blob/master/Modules/CMakeFindBinUtils.cmake

Martchus commented 5 years ago

but why?

I wasn't aware of _CMAKE_TOOLCHAIN_PREFIX and after a brief search I also couldn't find a documentation page about it. The _ prefix also indicates that it might be only an internal variable one should not rely on.

I have to admit that my CMake code is specific to Arch Linux where strip is installed under e.g. /usr/x86_64-w64-mingw32/bin/strip and CMAKE_FIND_ROOT_PATH set to /usr/x86_64-w64-mingw32. The only purpose of dealing with strip here at all is to simplify the cross compilation under Arch Linux where the package build system is not able to invoke the correct strip from the cross compilation tool-chain. I should likely make the entire code block disabled by default and only enable it under Arch Linux.

Since you're compiling under Windows you likely just want to use the regular make install and not the targets added by this problematic code.

Martchus commented 5 years ago

I disabled that code so nobody is bothered by it.

By the way, I recently did a lot of refactoring in the build system to deal with some use-cases I have in mind. I hope it still works under Windows (building static libraries and creating a fully statically linked application is now handled differently).