summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2015-11-01 20:37:19 +0100
committerStefan Weil <sw@weilnetz.de>2016-01-06 18:06:45 +0100
commitc00ee8bff7cd6473021cb6f40199d25898d09250 (patch)
tree526b966458e8eec727b64c1ad6f45a303598f090 /CMakeLists.txt
parenta205f703283d42e1989da3670cb1c4bb5d8ae193 (diff)
Fix support of posix_memalign for Linux
posix_memalign is only declared conditionally in stdlib.h, so add one of the possible definitions to get the declaration. Signed-off-by: Stefan Weil <sw@weilnetz.de>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt4
1 files changed, 3 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b014a00f..3326b54e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -231,8 +231,10 @@ check_include_files(malloc.h OPJ_HAVE_MALLOC_H)
include(CheckSymbolExists)
# _aligned_alloc https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
check_symbol_exists(_aligned_malloc malloc.h OPJ_HAVE__ALIGNED_MALLOC)
-# posix_memalign
+# posix_memalign (needs _POSIX_C_SOURCE >= 200112L on Linux)
+set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L)
check_symbol_exists(posix_memalign stdlib.h OPJ_HAVE_POSIX_MEMALIGN)
+unset(CMAKE_REQUIRED_DEFINITIONS)
# memalign (obsolete)
check_symbol_exists(memalign malloc.h OPJ_HAVE_MEMALIGN)
#-----------------------------------------------------------------------------