Imported Upstream version 3.2
[platform/upstream/libwebsockets.git] / contrib / cross-arm-linux-gnueabihf.cmake
1 #
2 # CMake Toolchain file for crosscompiling on ARM.
3 #
4 # This can be used when running cmake in the following way:
5 #  cd build/
6 #  cmake .. -DCMAKE_TOOLCHAIN_FILE=../cross-arm-linux-gnueabihf.cmake
7 #
8
9 set(CROSS_PATH /opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.02-01-20130221_linux)
10
11 # Target operating system name.
12 set(CMAKE_SYSTEM_NAME Linux)
13
14 # Name of C compiler.
15 set(CMAKE_C_COMPILER "${CROSS_PATH}/bin/arm-linux-gnueabihf-gcc")
16 set(CMAKE_CXX_COMPILER "${CROSS_PATH}/bin/arm-linux-gnueabihf-g++")
17
18 #
19 # Different build system distros set release optimization level to different
20 # things according to their local policy, eg, Fedora is -O2 and Ubuntu is -O3
21 # here.  Actually the build system's local policy is completely unrelated to
22 # our desire for cross-build release optimization policy for code built to run
23 # on a completely different target than the build system itself.
24 #
25 # Since this goes last on the compiler commandline we have to override it to a
26 # sane value for cross-build here.  Notice some gcc versions enable broken
27 # optimizations with -O3.
28 #
29 if (CMAKE_BUILD_TYPE MATCHES RELEASE OR CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES release)
30         set(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} -O2)
31         set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} -O2)
32 endif()
33
34 # Where to look for the target environment. (More paths can be added here)
35 set(CMAKE_FIND_ROOT_PATH "${CROSS_PATH}")
36
37 # Adjust the default behavior of the FIND_XXX() commands:
38 # search programs in the host environment only.
39 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
40
41 # Search headers and libraries in the target environment only.
42 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
43 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
44