Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I use <a href="http://www.cmake.org" rel="nofollow">CMake</a> to compile my ROOT-based projects. If you have a project directory proj/ and it contains src/ and bin/, you'll need 3 CMakeList.txt files, one in each directory.</p> <p>A simple example CMakeList.txt in the main project directory:</p> <pre><code>cmake_minimum_required(VERSION 2.6) project (SOME_PROJ_NAME) add_subdirectory(src) add_subdirectory(bin) </code></pre> <p>src/ directory is where you keep your .h and .cxx proj. library files. Example CMakeList.txt file:</p> <pre><code># get all the *.cxx filenames, to compile them into a lib file(GLOB SOME_PROJ_LIB_SRCS "${PROJECT_SOURCE_DIR}/src/*.cxx") # include ROOT library and include files include_directories(/path/to/root/dir/include/dir) link_directories(/path/to/root/dir/lib/dir) # and compile src into a library add_library(Proj_lib_name ${SOME_PROJ_LIB_SRCS}) # here, list the ROOT libraries you require target_link_libraries(Proj_lib_name dl Core Cint RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread Gui pthread m) </code></pre> <p>bin/ directory is where you keep your app .cxx files and it has a CMakeList.txt file:</p> <pre><code>include_directories(${PROJECT_SOURCE_DIR}/src) link_directories(${PROJECT_SOURCE_DIR}/src) include_directories(/path/to/root/dir/include/dir) link_directories(/path/to/root/dir/lib/dir) add_executable(example_app.exe example_app.cxx) target_link_libraries(example_app.exe Proj_lib_name dl Core Cint RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread Gui pthread m) </code></pre> <p>Finally, to compile ROOT-based code with CMake, out of source, you create a "build" dir in your top level project dir, so that your dir structure looks like this:</p> <pre><code>proj/ bin/ build/ src/ </code></pre> <p>Then </p> <pre><code>cd build cmake .. </code></pre> <p>Your binaries will be located in build/bin/ directory</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload