0
|
1 # 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
|
|
2
|
|
3 INCLUDE(CMakeForceCompiler)
|
|
4
|
|
5 SET(LSB_PATH $ENV{LSB_PATH})
|
|
6 SET(LSB_CC $ENV{LSB_CC})
|
|
7 SET(LSB_CXX $ENV{LSB_CXX})
|
|
8 SET(LSB_TARGET_VERSION "4.0")
|
|
9
|
|
10 IF ("${LSB_PATH}" STREQUAL "")
|
|
11 SET(LSB_PATH "/opt/lsb")
|
|
12 ENDIF()
|
|
13
|
|
14 IF (EXISTS ${LSB_PATH}/lib64)
|
|
15 SET(LSB_TARGET_PROCESSOR "x86_64")
|
|
16 SET(LSB_LIBPATH ${LSB_PATH}/lib64-${LSB_TARGET_VERSION})
|
|
17 ELSEIF (EXISTS ${LSB_PATH}/lib)
|
|
18 SET(LSB_TARGET_PROCESSOR "x86")
|
|
19 SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION})
|
|
20 ELSE()
|
|
21 MESSAGE(FATAL_ERROR "Unable to detect the target processor architecture. Check the LSB_PATH environment variable.")
|
|
22 ENDIF()
|
|
23
|
|
24 SET(LSB_CPPPATH ${LSB_PATH}/include)
|
|
25 SET(PKG_CONFIG_PATH ${LSB_LIBPATH}/pkgconfig/)
|
|
26
|
|
27 # the name of the target operating system
|
|
28 SET(CMAKE_SYSTEM_NAME Linux)
|
|
29 SET(CMAKE_SYSTEM_VERSION LinuxStandardBase)
|
|
30 SET(CMAKE_SYSTEM_PROCESSOR ${LSB_TARGET_PROCESSOR})
|
|
31
|
|
32 # which compilers to use for C and C++
|
|
33 SET(CMAKE_C_COMPILER ${LSB_PATH}/bin/lsbcc)
|
|
34 CMAKE_FORCE_CXX_COMPILER(${LSB_PATH}/bin/lsbc++ GNU)
|
|
35
|
|
36 # here is the target environment located
|
|
37 SET(CMAKE_FIND_ROOT_PATH ${LSB_PATH})
|
|
38
|
|
39 # adjust the default behaviour of the FIND_XXX() commands:
|
|
40 # search headers and libraries in the target environment, search
|
|
41 # programs in the host environment
|
|
42 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
43 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
|
|
44 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
|
|
45
|
|
46 SET(CMAKE_CROSSCOMPILING OFF)
|
|
47
|
|
48
|
|
49 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include" CACHE INTERNAL "" FORCE)
|
|
50 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)
|
|
51 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE)
|
|
52 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE)
|
|
53
|
|
54 if (NOT "${LSB_CXX}" STREQUAL "")
|
|
55 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cxx=${LSB_CXX}")
|
|
56 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}")
|
|
57 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}")
|
|
58 endif()
|
|
59
|
|
60 if (NOT "${LSB_CC}" STREQUAL "")
|
|
61 SET(CMAKE_C_FLAGS "${CMAKE_CC_FLAGS} --lsb-cc=${LSB_CC}")
|
|
62 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cc=${LSB_CC}")
|
|
63 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cc=${LSB_CC}")
|
|
64 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cc=${LSB_CC}")
|
|
65 endif()
|
|
66
|