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
This commit is contained in:
kervala 2011-05-14 14:02:53 +02:00
parent 7b472a2456
commit 3eb4b064fb

View file

@ -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")
# 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)
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64")
ADD_DEFINITIONS(-DHAVE_IA64)
ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(ARCH "x86")
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.
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)