Skip to content

Building stlab libraries with CLion

Foster Brereton edited this page Jul 25, 2017 · 1 revision

This file assumes CLion is properly installed on your machine, and that you have stlab cloned to ~/git/github/stlab.

  1. In a Terminal, run the following to download and install the conan dependencies, and save conanbuildinfo.cmake to the build directory:
    cd ~/git/github/stlab # Your path may vary
    mkdir -p build
    cd build
    conan install .. --build=missing -s build_type=Debug
    cd ..
    (This set of steps is identical to the Xcode setup script, except cmake is not executed here - CLion will handle that for you.)
  2. Open CLion, select "Open Project", and open stlab's top-level CMakeLists.txt file: Open Project
  3. Two things need to change to get stlab to build, which will solve next:
    • The build directory is cmake-build-debug, not build
    • The stlab_testing=ON setting needs to be added to the CMake invocation
  4. Make sure you can see the CMake panel at the bottom of the IDE window. If you do not, you may have to select it from View → Tool Windows → CMake: CMake panel menu item
  5. In the CMake panel, click the gear icon and select "CMake Settings" CMake Settings
  6. In the ensuing Preferences Window, change:
    • Add "-Dstlab_testing=ON" to the "CMake options" field
    • Set the Generation Path to "build" CMake Project Preferences
  7. You may have to close and reopen the stlab project in the IDE. You may also have to Reload the CMake project from within the CMake Panel: Imgur
  8. Building and Running should now be available in the Run menu.

(You can safely delete the cmake-build-debug directory if it exists.

Clone this wiki locally