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 1787101c66
commit bbbf8754fb

View file

@ -44,8 +44,10 @@ MACRO(NL_DEFAULT_PROPS name label)
IF(${type} STREQUAL SHARED_LIBRARY) IF(${type} STREQUAL SHARED_LIBRARY)
# Set versions only if target is a shared library # Set versions only if target is a shared library
SET_TARGET_PROPERTIES(${name} PROPERTIES SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR} VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR})
INSTALL_NAME_DIR ${NL_LIB_PREFIX}) IF(LIB_PREFIX)
SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${LIB_PREFIX})
ENDIF(LIB_PREFIX)
ENDIF(${type} STREQUAL SHARED_LIBRARY) ENDIF(${type} STREQUAL SHARED_LIBRARY)
IF(WITH_STLPORT AND WIN32) IF(WITH_STLPORT AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
@ -299,7 +301,7 @@ MACRO(NL_SETUP_BUILD)
SET(MIN_OPTIMIZATIONS "/Ob1") SET(MIN_OPTIMIZATIONS "/Ob1")
ENDIF(MSVC10) 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++ # Exceptions are only set for C++
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa") SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
@ -332,23 +334,25 @@ MACRO(NL_SETUP_BUILD)
ENDIF(WIN32) ENDIF(WIN32)
# Determine host CPU # Determine target CPU
IF(UNIX AND NOT WIN32) IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) IF(NOT CMAKE_SIZEOF_VOID_P)
IF(CMAKE_UNAME) INCLUDE (CheckTypeSize)
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR) CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
SET(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)") ENDIF(NOT CMAKE_SIZEOF_VOID_P)
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ADD_DEFINITIONS(-DHAVE_X86_64) # Using 32 or 64 bits libraries
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") SET(TARGET_X86 1)
ADD_DEFINITIONS(-DHAVE_IA64) IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") SET(ARCH "x86_64")
ADD_DEFINITIONS(-DHAVE_X86) SET(TARGET_X64 1)
ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") ADD_DEFINITIONS(-DHAVE_X86_64)
ELSE(CMAKE_UNAME) # Assume that if uname is not found that we're x86. ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(ARCH "x86")
ADD_DEFINITIONS(-DHAVE_X86) ADD_DEFINITIONS(-DHAVE_X86)
ENDIF(CMAKE_UNAME) ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(UNIX AND NOT WIN32) # ADD_DEFINITIONS(-DHAVE_IA64)
ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
ENDMACRO(NL_SETUP_BUILD) ENDMACRO(NL_SETUP_BUILD)