CMake: Add ucontext
This commit is contained in:
@@ -61,6 +61,7 @@ if (UNIX)
|
|||||||
find_package(Sigaction)
|
find_package(Sigaction)
|
||||||
find_package(Sigaltstack)
|
find_package(Sigaltstack)
|
||||||
find_package(SelfDbg)
|
find_package(SelfDbg)
|
||||||
|
find_package(Ucontext)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
|
|
||||||
find_package(SSE)
|
find_package(SSE)
|
||||||
|
23
cmake/FindUcontext.cmake
Normal file
23
cmake/FindUcontext.cmake
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
include(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <ucontext.h>
|
||||||
|
int main() {
|
||||||
|
ucontext_t context;
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
void *ptr = (void *) context.uc_mcontext.gregs[REG_RIP];
|
||||||
|
#elif defined(__i386)
|
||||||
|
void *ptr = (void *) context.uc_mcontext.gregs[REG_EIP];
|
||||||
|
#else
|
||||||
|
#error Unknown arch
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
UCONTEXT_FOUND
|
||||||
|
)
|
||||||
|
|
||||||
|
if (UCONTEXT_FOUND)
|
||||||
|
add_compile_options(
|
||||||
|
-DWITH_UCONTEXT
|
||||||
|
)
|
||||||
|
endif (UCONTEXT_FOUND)
|
Reference in New Issue
Block a user