maxmind/libmaxminddb

CMake issue with missing file t/libtap

bsergean opened this issue · 7 comments

It looks like some unittest C files are missing: on macOS with XCode 12 I'm getting those errors after typical cmake invocation. There is an empty t/libtap folder.

mkdir build
cd build
cmake ..

....
INSTALL TARGETS - target maxminddb has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
-- Configuring done
CMake Error at t/CMakeLists.txt:1 (add_library):
Cannot find source file:

libtap/tap.c

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc

CMake Error at t/CMakeLists.txt:1 (add_library):
No SOURCES given to target: tap


It's probably worth adding an option to disable building unittest when building.

Another tip (I hope I can help), is that using target_* family of functions should make it easier to use CMake tools such as FetchContent which are great for bringing in third party libraries easily.

How are you downloading the source code? If you are cloning the repo, you will need to download the submodules as well. If you are downloading it from the release section, please use the named release files, e.g., libmaxminddb-1.4.3.tar.gz, rather than the files automatically generated by GitHub.

If you've already cloned it, git submodule update --init --recursive should do the trick.

The cmake build files are brand new and likely have rough edges. You can see how they are currently tested on macOS, Windows, and Linux via the GitHub Action. They were primarily added to replace an poorly aging MSBuild files for Windows. A PR to improve them for more use cases would definitely be appreciated.

Here we go, I tried to improve the cmake files ; now they let me build on my mac, and I can make install it and the output look good. The library can be used externally with FetchContent now.