view Resources/LinuxStandardBaseToolchain.cmake @ 3047:1c095185074c db-changes

move class SetOfResources to plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 Dec 2018 16:06:38 +0100
parents 94423976888e
children 32596919d729
line wrap: on
line source

# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON

INCLUDE(CMakeForceCompiler)

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

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

IF (EXISTS ${LSB_PATH}/lib64)
  SET(LSB_TARGET_PROCESSOR "x86_64")
  SET(LSB_LIBPATH ${LSB_PATH}/lib64-${LSB_TARGET_VERSION})
ELSEIF (EXISTS ${LSB_PATH}/lib)
  SET(LSB_TARGET_PROCESSOR "x86")
  SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION})
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(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 NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)

SET(CMAKE_CROSSCOMPILING OFF)


SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include" CACHE INTERNAL "" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward" CACHE INTERNAL "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE)

if (NOT "${LSB_CXX}" STREQUAL "")
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cxx=${LSB_CXX}")
  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}")
  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}")
endif()

if (NOT "${LSB_CC}" STREQUAL "")
  SET(CMAKE_C_FLAGS "${CMAKE_CC_FLAGS} --lsb-cc=${LSB_CC}")
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cc=${LSB_CC}")
  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cc=${LSB_CC}")
  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cc=${LSB_CC}")
endif()