Changed: Use only static libraries under Mac OS X if WITH_STATIC_EXTERNAL is used

Changed: Strip binaries under Mac OS X by default in Release (use WITH_SYMBOLS if you don't want)
This commit is contained in:
kervala 2012-05-07 10:27:54 +02:00
parent 54b1709d14
commit 2b82f9a31c

View file

@ -355,7 +355,7 @@ MACRO(NL_SETUP_BUILD)
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release") ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(HOST_CPU ${CMAKE_SYSTEM_PROCESSOR}) SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
IF(HOST_CPU MATCHES "amd64") IF(HOST_CPU MATCHES "amd64")
SET(HOST_CPU "x86_64") SET(HOST_CPU "x86_64")
@ -382,6 +382,11 @@ MACRO(NL_SETUP_BUILD)
# DEB_HOST_ARCH_ENDIAN is 'little' or 'big' # DEB_HOST_ARCH_ENDIAN is 'little' or 'big'
# DEB_HOST_ARCH_BITS is '32' or '64' # DEB_HOST_ARCH_BITS is '32' or '64'
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CLANG ON)
MESSAGE(STATUS "Using Clang compiler")
ENDIF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
# If target and host CPU are the same # If target and host CPU are the same
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
# x86-compatible CPU # x86-compatible CPU
@ -397,8 +402,13 @@ MACRO(NL_SETUP_BUILD)
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(TARGET_CPU "x86") SET(TARGET_CPU "x86")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSEIF(HOST_CPU MATCHES "arm")
SET(TARGET_CPU "arm")
ELSE(HOST_CPU MATCHES "x86")
SET(TARGET_CPU "unknown")
MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}")
ENDIF(HOST_CPU MATCHES "x86") ENDIF(HOST_CPU MATCHES "x86")
# TODO: add checks for ARM and PPC # TODO: add checks for PPC
ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}") ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}") MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}")
ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
@ -409,6 +419,9 @@ MACRO(NL_SETUP_BUILD)
ELSEIF(TARGET_CPU STREQUAL "x86") ELSEIF(TARGET_CPU STREQUAL "x86")
SET(TARGET_X86 1) SET(TARGET_X86 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86")
ELSEIF(TARGET_CPU STREQUAL "arm")
SET(TARGET_ARM 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM")
ENDIF(TARGET_CPU STREQUAL "x86_64") ENDIF(TARGET_CPU STREQUAL "x86_64")
# Fix library paths suffixes for Debian MultiArch # Fix library paths suffixes for Debian MultiArch
@ -514,12 +527,14 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_SYMBOLS) IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g") SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g")
ELSE(WITH_SYMBOLS) ELSE(WITH_SYMBOLS)
IF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") IF(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip -Wl,-x ${NL_RELEASE_LINKFLAGS}")
ELSE(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}")
ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") ENDIF(APPLE)
ENDIF(WITH_SYMBOLS) ENDIF(WITH_SYMBOLS)
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}") SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}")
ENDIF(MSVC) ENDIF(MSVC)
ENDMACRO(NL_SETUP_BUILD) ENDMACRO(NL_SETUP_BUILD)
@ -710,7 +725,7 @@ MACRO(SETUP_EXTERNAL)
ELSE(WIN32) ELSE(WIN32)
IF(APPLE) IF(APPLE)
IF(WITH_STATIC_EXTERNAL) IF(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib .so) SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
ELSE(WITH_STATIC_EXTERNAL) ELSE(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a)
ENDIF(WITH_STATIC_EXTERNAL) ENDIF(WITH_STATIC_EXTERNAL)