title: Building cross-compiled ARM files for libwebsockets, in addition to GCC files
body: <p>I am implementing a web server using libwebsockets (LWS) for an embedded ARM processor. I am testing the server on gcc in Ubuntu as I learn about LWS. I have the server working as a gcc build, but now want to build the cross-compiled version for the ARM board.</p>
  
  <p>I created a toolchain file:</p>
  
  <pre><code>// Set the path to ARM directories to just above the bin directory
  set(CROSS_PATH usr/local/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2)
  
  // Target operating system name
  set(CMAKE_SYSTEM_NAME Linux)
  
  // Name of C compiler
  set(CMAKE_C_COMPILER "${CROSS_PATH}/bin/arm-linux-gcc")
  set(CMAKE_CXX_COMPILER "${CROSS_PATH}/bin/arm-linux-g++")
  
  // Where to look for the target environment. (More paths can be added here)
  set(CMAKE_FIND_ROOT_PATH "${CROSS_PATH}")
  
  // Adjust the default behavior of the FIND_XXX() commands:
  // search programs in the host environment only.
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  
  // Search headers and libraries in the target environment only.
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  </code></pre>
  
  <p>I created a build directory at the same level as my gcc build directory.</p>
  
  <pre><code>GCC:  libwebsockets &gt; build
  ARM:  libwebsockets &gt; buildx
  </code></pre>
  
  <p>The file required by cmake, CMakeList.txt, is in "libwebsockets" which is referenced when cmake is invoked (for gcc):</p>
  
  <pre><code>cmake ..
  </code></pre>
  
  <p>or for arm-linux-gcc:</p>
  
  <pre><code>cmake .. -DCMAKE_TOOLCHAIN_FILE=../arm-linuc-gcc.cmake
  </code></pre>
  
  <p>But running this last line updates a few file (like cmake cache) and does not create the build files.</p>
  
  <p>How do I build the ARM files? Am I required to delete the existing gcc build before a new build can be created?</p>
  
  <p>Thanks for your help!</p>