jedisct1/libsodium — pull request #156 by soundart (2014-05-17 17:15:59+00:00)
Title: cmake build

Hello,

I have prepared an initial CMake setup for libsodium, could you please consider merging it?
It requires cmake 2.8.12 or better and I have tested it on Debian x86_64 GNU/Linux.

usage:
mkdir build
cd build
cmake ..
make all test

kind regards
Frank

Status:
I have converted some of the features of the autoconf script:
* HAVE_MMINTRIN_H (mmx)
* HAVE_EMINTRIN_H (sse2)
* HAVE_PMINTRIN_H (sse3)
* HAVE_TMINTRIN_H (ssse3)
* HAVE_MEMSET_S
* HAVE_CPUID_V
* HAVE_CLOCK_GETTIME
* HAVE_FEGETENV
* HAVE_VIRTUALLOCK
* HAVE_MLOCK
* HAVE_SECUREZEROMEMORY
* HAVE_EXPLICIT_BZERO
* HAVE_POSIX_MEMALIGN
* HAVE_TI_MODE
* HAVE_AMD64_ASM

Position independant code is supported too.

Problems:

I tried to add the NDEBUG disabling, but did not manage. I am not sure if it works in autoconf correctly either. Isn't a config.h file required? Or how is this propageted to the code?

AC_CHECK_FUNC(fegetenv, , [AC_CHECK_LIB(m, fegetenv)]) is probably doing something, but I did
not find out how it modifies anything.

The other features are currently not implemented if using cmake. Especially
* enable-blocking-random
* disable-ssp (it is not enabled either)
* disable-asm (this is enabled)
* static libraries
* checks for various warning flags
* linker flags (noexec etc)
* versioning related code

If cmake support is of interest I would try to add more of the autoconf features