From e389ab727d6eb1024567c2629150a72fc26fb7ef Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 27 Mar 2012 18:58:04 +0400 Subject: [PATCH] Detect amd64. --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80045a4bb..565cabe04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,19 @@ IF(CMAKE_INSTALL_PREFIX) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) ENDIF(CMAKE_INSTALL_PREFIX) +# Try to detect platform for further configuration +CHECK_C_SOURCE_COMPILES ("#if !defined(__x86_64) && !defined(__amd64) && !defined(_M_X64) + #error assume 32 bit arch + #endif + int main() { return 0;}" AMD_64) +IF(NOT BUILD_CPU_MODE) + IF(AMD_64) + SET (BUILD_CPU_MODE "64") + ELSE(AMD_64) + SET (BUILD_CPU_MODE "32") + ENDIF(AMD_64) +ENDIF(NOT BUILD_CPU_MODE) + # Platform specific configuration IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DFREEBSD") -- 2.39.5