OUTPUT_VARIABLE compile_makecontext_output)
#If can have both context
- if(compile_makecontext)
- set(HAVE_UCONTEXT_CONTEXTS 1)
- message(STATUS "Support for ucontext factory ok.")
- else()
+ if(NOT compile_makecontext)
message(STATUS "Error: <ucontext.h> exists, but makecontext is not compilable. Compilation output:\n ${compile_makecontext_output}")
message(STATUS "No ucontext factory: makecontext() is not compilable.")
- endif()
-
- # Stack setup (size and address)
- try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
- ${CMAKE_BINARY_DIR} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stacksetup.c
- RUN_OUTPUT_VARIABLE stack_setup)
-
- LIST(LENGTH stack_setup stack_setup_len)
- if("${stack_setup_len}" STREQUAL "2")
- LIST(GET stack_setup 0 makecontext_addr)
- LIST(GET stack_setup 1 makecontext_size)
- set(sg_makecontext_stack_addr "#define sg_makecontext_stack_addr(skaddr) (${makecontext_addr})")
- set(sg_makecontext_stack_size "#define sg_makecontext_stack_size(sksize) (${makecontext_size})")
else()
- message(FATAL_ERROR "Could not figure out the stack setup. Compil: ${RUN_makecontext_VAR}. Exec: ${COMPILE_makecontext_VAR}. Output: ${stack_setup}")
+ message(STATUS "Support for ucontext factory ok.")
+ set(HAVE_UCONTEXT_CONTEXTS 1)
+
+ # Stack setup (size and address)
+ try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
+ ${CMAKE_BINARY_DIR} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stacksetup.c
+ RUN_OUTPUT_VARIABLE stack_setup)
+
+ LIST(LENGTH stack_setup stack_setup_len)
+ if("${stack_setup_len}" STREQUAL "2")
+ LIST(GET stack_setup 0 makecontext_addr)
+ LIST(GET stack_setup 1 makecontext_size)
+ set(sg_makecontext_stack_addr "#define sg_makecontext_stack_addr(skaddr) (${makecontext_addr})")
+ set(sg_makecontext_stack_size "#define sg_makecontext_stack_size(sksize) (${makecontext_size})")
+ else()
+ message(FATAL_ERROR "Could not figure out the stack setup. Compil: ${RUN_makecontext_VAR}. Exec: ${COMPILE_makecontext_VAR}. Output: ${stack_setup}")
+ endif()
endif()
endif()