The architecture (32/64 bits) is now detected only on Windows

This commit is contained in:
Laurent Gomila 2012-01-03 18:02:18 +01:00
parent 88683504ba
commit 91705fe25c
3 changed files with 15 additions and 17 deletions

View File

@ -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()

View File

@ -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

View File

@ -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()