From 3eb4b064fb2263648f90c9e0d710dcfa44631e1d Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 14:02:53 +0200 Subject: [PATCH] Changed: Use of LIB_PREFIX only if defined Changed: Compilation with all cores for VC++ 2008 and 2010 Changed: New method to determine the target CPU --- code/CMakeModules/nel.cmake | 42 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index dbe0991a4..c123ca8a8 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -44,8 +44,10 @@ MACRO(NL_DEFAULT_PROPS name label) IF(${type} STREQUAL SHARED_LIBRARY) # Set versions only if target is a shared library SET_TARGET_PROPERTIES(${name} PROPERTIES - VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR} - INSTALL_NAME_DIR ${NL_LIB_PREFIX}) + VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR}) + IF(LIB_PREFIX) + SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${LIB_PREFIX}) + ENDIF(LIB_PREFIX) ENDIF(${type} STREQUAL SHARED_LIBRARY) IF(WITH_STLPORT AND WIN32) SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") @@ -299,7 +301,7 @@ MACRO(NL_SETUP_BUILD) SET(MIN_OPTIMIZATIONS "/Ob1") ENDIF(MSVC10) - SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000") + SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP") # Exceptions are only set for C++ SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa") @@ -332,23 +334,25 @@ MACRO(NL_SETUP_BUILD) ENDIF(WIN32) - # Determine host CPU - IF(UNIX AND NOT WIN32) - FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) - IF(CMAKE_UNAME) - EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR) - SET(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)") - IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - ADD_DEFINITIONS(-DHAVE_X86_64) - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") - ADD_DEFINITIONS(-DHAVE_IA64) - ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - ADD_DEFINITIONS(-DHAVE_X86) - ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - ELSE(CMAKE_UNAME) # Assume that if uname is not found that we're x86. + # Determine target CPU + IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") + IF(NOT CMAKE_SIZEOF_VOID_P) + INCLUDE (CheckTypeSize) + CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) + ENDIF(NOT CMAKE_SIZEOF_VOID_P) + + # Using 32 or 64 bits libraries + SET(TARGET_X86 1) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(ARCH "x86_64") + SET(TARGET_X64 1) + ADD_DEFINITIONS(-DHAVE_X86_64) + ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(ARCH "x86") ADD_DEFINITIONS(-DHAVE_X86) - ENDIF(CMAKE_UNAME) - ENDIF(UNIX AND NOT WIN32) + ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) +# ADD_DEFINITIONS(-DHAVE_IA64) + ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") ENDMACRO(NL_SETUP_BUILD)