From 91705fe25c7db965b1cd48ca624702a381721013 Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Tue, 3 Jan 2012 18:02:18 +0100 Subject: [PATCH] The architecture (32/64 bits) is now detected only on Windows --- CMakeLists.txt | 2 +- cmake/Config.cmake | 26 ++++++++++++-------------- src/SFML/CMakeLists.txt | 4 ++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56d358bf1..af6575fe1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,7 +193,7 @@ if(WINDOWS) if(ARCH_32BITS) install(FILES extlibs/bin/x86/libsndfile-1.dll DESTINATION bin) install(FILES extlibs/bin/x86/openal32.dll DESTINATION bin) - else() + elseif(ARCH_64BITS) install(FILES extlibs/bin/x64/libsndfile-1.dll DESTINATION bin) install(FILES extlibs/bin/x64/openal32.dll DESTINATION bin) endif() diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 2c98f26dd..a1c626408 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -2,6 +2,18 @@ # detect the OS if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(WINDOWS 1) + + # detect the architecture (note: this test won't work for cross-compilation) + include(CheckTypeSize) + check_type_size(void* SIZEOF_VOID_PTR) + if(${SIZEOF_VOID_PTR} EQUAL "4") + set(ARCH_32BITS 1) + elseif(${SIZEOF_VOID_PTR} EQUAL "8") + set(ARCH_64BITS 1) + else() + message(FATAL_ERROR "Unsupported architecture") + return() + endif() elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(LINUX 1) elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") @@ -17,25 +29,11 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") message(FATAL_ERROR "Unsupported version of OS X : ${MACOSX_VERSION_RAW}") return() endif() - else() message(FATAL_ERROR "Unsupported operating system") return() endif() -# detect the architecture -# note: this test won't work for cross-compilation -include(CheckTypeSize) -check_type_size(void* SIZEOF_VOID_PTR) -if(${SIZEOF_VOID_PTR} MATCHES "^4$") - set(ARCH_32BITS 1) -elseif(${SIZEOF_VOID_PTR} MATCHES "^8$") - set(ARCH_64BITS 1) -else() - message(FATAL_ERROR "Unsupported architecture") - return() -endif() - # detect the compiler and its version # Note: on some platforms (OS X), CMAKE_COMPILER_IS_GNUCXX is true # even when CLANG is used, therefore the Clang test is done first diff --git a/src/SFML/CMakeLists.txt b/src/SFML/CMakeLists.txt index 26454b0ab..9c83ce5ba 100644 --- a/src/SFML/CMakeLists.txt +++ b/src/SFML/CMakeLists.txt @@ -9,13 +9,13 @@ if (WINDOWS) set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw") if(ARCH_32BITS) set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/bin/x86") - else() + elseif(ARCH_64BITS) set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/bin/x64") endif() elseif(COMPILER_MSVC) if(ARCH_32BITS) set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc/x86") - else() + elseif(ARCH_64BITS) set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc/x64") endif() endif()