Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to set output directory for CMake

📅 2014-Aug-14 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cmake ⬩ 📚 Archive

To set the output directory for executable:

set(
    CMAKE_RUNTIME_OUTPUT_DIRECTORY
    ${CMAKE_HOME_DIRECTORY}/bin
    )

To set the output directory for library:

set(
    CMAKE_LIBRARY_OUTPUT_DIRECTORY
    ${CMAKE_HOME_DIRECTORY}/lib
    )

Tried with: CMake 2.8.12.2 and Ubuntu 14.04