view Resources/LinuxStandardBaseToolchain.cmake @ 540:eaca3d38b2aa laaw

many fixes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Sep 2013 12:55:07 +0200
parents a1b9d1e1497b
children ded40a9e8cc8
line wrap: on
line source

INCLUDE(CMakeForceCompiler)

SET(LSB_PATH $ENV{LSB_PATH})
SET(LSB_TARGET_VERSION "4.0")

IF ("${LSB_PATH}" STREQUAL "")
  SET(LSB_PATH "/opt/lsb")
ENDIF()

message("Using the following Linux Standard Base: ${LSB_PATH}")

IF (EXISTS ${LSB_PATH}/lib64)
  SET(LSB_TARGET_PROCESSOR "x86_64")
ELSEIF (EXISTS ${LSB_PATH}/lib)
  SET(LSB_TARGET_PROCESSOR "x86")
ELSE()
  MESSAGE(FATAL_ERROR "Unable to detect the target processor architecture. Check the LSB_PATH environment variable.")
ENDIF()

SET(LSB_CPPPATH ${LSB_PATH}/include)
SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION})
SET(PKG_CONFIG_PATH ${LSB_LIBPATH}/pkgconfig/)

# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION LinuxStandardBase)
SET(CMAKE_SYSTEM_PROCESSOR ${LSB_TARGET_PROCESSOR})

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER ${LSB_PATH}/bin/lsbcc)
CMAKE_FORCE_CXX_COMPILER(${LSB_PATH}/bin/lsbc++ GNU)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH ${LSB_PATH})

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search 
# programs in the host environment
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)