mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
bug #891: Determine sizeof(void*) via CMAKE variable instead of test program
This commit is contained in:
parent
d3f52debc6
commit
0ec1fc9e11
@ -489,20 +489,12 @@ macro(ei_set_build_string)
|
||||
endmacro(ei_set_build_string)
|
||||
|
||||
macro(ei_is_64bit_env VAR)
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/is64.cpp"
|
||||
"int main() { return (sizeof(int*) == 8 ? 1 : 0); }
|
||||
")
|
||||
try_run(run_res compile_res
|
||||
${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/is64.cpp"
|
||||
RUN_OUTPUT_VARIABLE run_output)
|
||||
|
||||
if(compile_res AND run_res)
|
||||
set(${VAR} ${run_res})
|
||||
elseif(CMAKE_CL_64)
|
||||
set(${VAR} 1)
|
||||
elseif("$ENV{Platform}" STREQUAL "X64") # nmake 64 bit
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(${VAR} 1)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(${VAR} 0)
|
||||
else()
|
||||
message(WARNING "Unsupported pointer size. Please contact the authors.")
|
||||
endif()
|
||||
endmacro(ei_is_64bit_env)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user